Commit graph

57152 commits

Author SHA1 Message Date
Tom Cherry
91fd50c78f Merge "base: reimagine line splitting in logger.cpp" 2020-04-27 16:03:46 +00:00
Jooyung Han
60985953bd Merge "Add min_sdk_version:R to updatable apexes" 2020-04-25 04:41:43 +00:00
Treehugger Robot
d694a67865 Merge changes I25df8eec,I493ff192
* changes:
  result.h - fix bugprone-suspicious-semicolon warning
  expected.h - fix bugprone-forwarding-reference-overload warnings
2020-04-24 20:43:33 +00:00
Maciej Żenczykowski
57d2fa4e52 result.h - fix bugprone-suspicious-semicolon warning
Fixes:
  system/core/base/include/android-base/result.h:
  133:94: warning: potentially unintended semicolon [bugprone-suspicious-semicolon]

Bernie says:
  it probably means that there's a parser bug with "if constexpr"

  maybe, at static analysis pass, the "if constexpr" was evaluated to false,
  and the compiler removed the "then" block from the AST...
  ... and then it thought you had written it that way :-)
  https://reviews.llvm.org/D46027

Test: builds
Bug: 153035880
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I25df8eeca4ec06b3180c1cd21b554fc583c5581a
2020-04-24 11:28:06 -07:00
Maciej Żenczykowski
dc12124aba expected.h - fix bugprone-forwarding-reference-overload warnings
Fixes:
  system/core/base/include/android-base/expected.h:
  186:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload]
  195:22: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload]
  611:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload]

To quote Tom Cherry:
  I'm a bit confused at what's happening there.
  I think it's a bug in the linter itself.
  The general solution to that problem is a heavy dose of std::enable_if<>
  to hide that constructor when the 'U' parameter is the same class,
  but those constructors do have the necessarily std::enable_if<> lines.

  I think the problem is that the linter doesn't check that the macro
  _ENABLE_IF() expands into std::enable_if<>.  Let me try explicitly
  putting the std::enable_if<> instead of the macro and check if it
  goes away.

  I expanded the macro but the linter doesn't still doesn't accept
  the format of `std::enable_if_t<(condition_here)>* = nullptr`.
  It does accept `typename Enable = std::enable_if_t<(condition_here), void>`,
  which is the syntax used on their example here:
    https://clang.llvm.org/extra/clang-tidy/checks/bugprone-forwarding-reference-overload.html.

  That latter syntax doesn't work for us.
  See the Notes section on
    https://en.cppreference.com/w/cpp/types/enable_if
  as a reference for why what we're doing is correct.

Test: builds
Bug: 153035880
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I493ff19208cc104f5f176a36ec23fbcb914388f7
2020-04-24 11:28:06 -07:00
Treehugger Robot
e0edc7ec32 Merge "llkd: Print thread group before panic the kernel" 2020-04-24 14:04:03 +00:00
Joshua Duong
3eea62432d Merge "[adb] Disable _adb._tcp. service auto-connect by default." 2020-04-24 05:38:22 +00:00
Woody Lin
e5a09d8da5 llkd: Print thread group before panic the kernel
Debugging information for addressing the reason why the process stops as
a zombie, can be found by observing the call trace and running status of
threads in thread group of the zombie process.

Bug: 154667692
Change-Id: Icd7fa2161e88b08fd5ce0d5dc3a3790ed4ac02d1
2020-04-24 02:55:00 +00:00
Ytai Ben-tsvi
07ccf08af2 Merge "Control audio HAL services in start/stop" 2020-04-24 02:40:10 +00:00
Treehugger Robot
abc40c7c5d Merge "Using ABB for install-multi." 2020-04-24 01:15:49 +00:00
Joshua Duong
2eedc2303b [adb] Disable _adb._tcp. service auto-connect by default.
Added ADB_MDNS_AUTO_CONNECT envionment variable to control which
services to allow auto-connect. By default, only _adb-tls-connect
services can auto-connect, since these services only auto-connect once
paired. _adb services will try to auto-connect to every service found.

Bug: 152636135

Test: ADB_TRACE=1 adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb,adb-tls-connect adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb-tls-connect adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=0 adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=1 adb server nodaemon | grep whitelist

Change-Id: Ie562ea24fea3d6d96e67b376a0523b09e2778eb7
2020-04-23 16:55:52 -07:00
Treehugger Robot
2722a3bef9 Merge "expected.h - fix bugprone-branch-clone warning" 2020-04-23 23:48:09 +00:00
Tom Cherry
36d31c530d base: reimagine line splitting in logger.cpp
Previously, we would split messages by line and call the logger
function for each line.  We would hold a lock during this, to ensure
that multiple threads would not interleave their messages.

There are a few problems with this approach:
1) Using a lock is not efficient and is not fork safe
2) With APEX, there is one lock per instance of libbase, so we must
   move the lock to a location where all instances can access it, or
   perform the line splitting in a way that does not require the lock.

To solve these issues, we reimagine line splitting.
1) We move the lock out of the LogMessage::~LogMessage() and make it
   the logger's responsibility to split lines, giving the logger the
   option to lock or not.
2) We do not need any locks at all for StderrLogger.
   Instead, we generate a single string that contains all of the lines
   with their appropriate log header.  A single write() call is used
   to output this at once.
3) Logd handles log messages with newlines correctly, however it only
   accepts up to a maximum size of log message.  Therefore we
   separate the incoming log message into chunks, delimited by new
   lines, up to that maximum size, and send each of those to logd.
   Note that this is the strategy used in
   android.util.Log.printlns().
   This should solve a majority of use cases, since the maximum size
   that logd accepts is nearly 4K, while remaining lock free.
   If interleaving messages absolutely must be avoided, a lock can
   still be used given 1) above.

Bug: 65062446
Bug: 153824050
Test: logging, particularly multi-line stack traces, show correctly
Test: existing and new unit tests
Change-Id: Id0cb5669bee7f912da1e17f7010f0ee4c93be1e3
2020-04-23 16:38:11 -07:00
Alex Buynytskyy
a59e9b4e70 Using ABB for install-multi.
ABB uses single shared CMD for all operations which improves
reliability.

Bug: b/153486595
Test: atest adb_test adbd_test fastdeploy_test
Change-Id: I1e3da63882c980811ed2e9f5556732b24a041ce5
2020-04-23 16:30:49 -07:00
Treehugger Robot
e1b7d47c29 Merge "Add AOSP preupload hook." 2020-04-23 22:53:08 +00:00
Josh Gao
a675727a81 Merge changes I5fd3b25d,I6c039b32,I014d7ad2
* changes:
  adb: allow filtering by file in coverage/show.sh.
  adbd: don't use libc++_static.
  adb: split transport_local.cpp into client/daemon.
2020-04-23 21:53:08 +00:00
Jaegeuk Kim
928bdbf5ec Merge "logcatd: unset pinning log files" 2020-04-23 20:53:25 +00:00
Jaegeuk Kim
2e5b7c425f logcatd: unset pinning log files
commit 5327d931ac ("logcatd: fallocate and fadvise to logcat files")
introduced pinning log files in order to avoid f2fs fragmentation.

But, logcatd does not guarantee to write data within fallocated 2MB space.
So, we can see some bytes written beyond 2MB boundary which results in
pinning small chunks across the filesystem. This makes F2FS GC have to unset
the pinning blocks via GC loop. If this happens during checkpoint=disable
at booting time, we can see long delay to mount /data accordingly.

Bug: 136483670
Bug: 137180754
Bug: 149418646
Fixes: 5327d931ac ("logcatd: fallocate and fadvise to logcat files")
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I986221d6d1da9b8e46e63d1be98ddf0ce4cb099f
2020-04-23 20:52:11 +00:00
Maciej Żenczykowski
4fc9b99329 expected.h - fix bugprone-branch-clone warning
Fixes:
  system/core/base/include/android-base/expected.h:606:39: warning: repeated branch in conditional chain [bugprone-branch-clone]
    if (x.has_value() != y.has_value()) {
                                        ^
  system/core/base/include/android-base/expected.h:608:4: note: end of the original
    } else if (!x.has_value()) {
     ^
  system/core/base/include/android-base/expected.h:610:10: note: clone 1 starts here
    } else {
           ^

Test: builds
Bug: 153035880
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie67a8bb1bf622319adea15466c42077e0e9b1a18
2020-04-23 13:44:33 -07:00
Ytai Ben-Tsvi
7d6af00aca Control audio HAL services in start/stop
Some system services (e.g. SoundTriggerMiddleware) assume that
whenever they start, the audio HAL is in its default (reset) state.
init.rc scripts tie the lifetimes of the audio HAL and system
processes, but when using stop/start this is not the case, and this
may cause spurious crashes in this case.

stop/start is apparently being relied on in some test infrastructure,
so this change is needed to avoid causing problems for those systems
or false detection of problems, which are not actually present in
production.

Bug: 154029444
Test: Manually verify that the audio HAL is stopped on
      'adb shell stop', restarted on 'adb shell start' and that the
      system boots correctly after.
Change-Id: I39878b978b47a169c4fe446c43d7347809d15e06
Merged-In: I39878b978b47a169c4fe446c43d7347809d15e06
2020-04-23 12:01:46 -07:00
Elliott Hughes
dc6c706003 Add AOSP preupload hook.
Test: repo upload in internal master
Change-Id: I98d7e9e51ca2f2a03ea1223f6749007e5b3f9b9f
2020-04-23 11:02:00 -07:00
Tom Cherry
efe9defc65 Merge "Don't include log/log_read.h in log/log.h" 2020-04-23 14:58:44 +00:00
Treehugger Robot
ffadbc8bac Merge "[cleanup] Fix a clang-tidy warning" 2020-04-23 06:29:57 +00:00
Josh Gao
0e778dc794 adb: allow filtering by file in coverage/show.sh.
Test: ./coverage.sh transport.cpp
Change-Id: I5fd3b25d9b3edd7a9131dae902e1868ced0384cc
2020-04-22 23:15:06 -07:00
Josh Gao
d5d5ba1644 adbd: don't use libc++_static.
We have dependencies that use libc++_shared, which results in ODR
violation manifesting as host adbd crashing on launch in libc++ locale
initialization.

Test: adbd on host
Change-Id: I6c039b325308fb8c36dfe5c1d090ff4ebe9e3433
2020-04-22 23:15:06 -07:00
Josh Gao
8a9277a243 adb: split transport_local.cpp into client/daemon.
Improve coverage some more.

Test: ./coverage/gen_coverage.sh && ./coverage/report.sh
Change-Id: I014d7ad25b2793d5d836ce5e526d657d46687ea4
2020-04-22 23:15:02 -07:00
Treehugger Robot
7d503c5bc9 Merge changes I9f382dab,I97225d4b,Iad113f44
* changes:
  Fix doxygen links in log.h.
  Fix docs for __android_log_is_loggable.
  Fix doxygen comments for __android_log_message.
2020-04-23 04:00:22 +00:00
Dan Albert
1891b863f8 Fix doxygen links in log.h.
`@{link blah}` != `{@link blah}`. The latter defines a link to blah,
the former defines a custom group that is never closed. This was doing
really exciting things to devsite.

Most identifiers do not need to be explicitly linked. The two in the
struct do need to be for some reason (maybe typedef vs function, or
maybe because it's a struct, idk). I've left those two but removed all
the ones that work implicitly.

Test: staged to devsite
Bug: None
Change-Id: I9f382dab499abb27945d178e17ae8c810c619898
2020-04-22 17:09:21 -07:00
Dan Albert
6e0eead1df Fix docs for __android_log_is_loggable.
len is not a parameter for the function this comment was attached to.
It seems to be that the documentation was meant to apply to both
functions, so copy it and remove the incorrect parameter from the one
that does not take it.

Test: build_ndk_docs.py
Bug: None
Change-Id: I97225d4ba925a33c73b6c7f81bb7b18def363489
2020-04-22 17:09:21 -07:00
Dan Albert
9e9a35e066 Fix doxygen comments for __android_log_message.
There's a different syntax for putting the comments _after_ the
members, but IMO more readable to just move them before the member.

Test: development/tools/ndk/build_ndk_docs.py
Bug: None
Change-Id: Iad113f449f9cb0996efc4b9d184d8e5b0ed5da85
2020-04-22 17:09:17 -07:00
Yurii Zubrytskyi
f8987c393d [cleanup] Fix a clang-tidy warning
const parameters can't be moved but only get copied -
removed const

Bug: 153704006
Test: builds & boots
Change-Id: If7e2250325bf1bc498afd3539f60bcb075a1d43b
2020-04-22 16:20:29 -07:00
Tom Cherry
538bac2e97 Merge "Remove thread safety from libbase logging / liblog" 2020-04-22 23:17:57 +00:00
Tom Cherry
53d301c29b Remove thread safety from libbase logging / liblog
There are no libbase users that require thread safety for SetLogger,
SetAborter, or SetDefaultTag  and the equivalent liblog symbols are
unreleased, thus have effectively no users.

It is hard to imagine a scenario where a user would need to use these
functions in a multi-threaded program, and it is unreasonable for all
users to pay for thread safety for a vast minority of potential
scenarios. Thread safety implies less efficiency and necessarily means
that these functions are neither fork safe nor async-signal safe, and
we do have users who depend on those characteristics.

It is always possible for users of the non-thread safe versions of
these functions to build thread safe versions on top of them.  For
example, if a user needs a thread safe SetLogger(), they can use the
non-thread safe SetLogger at the start of their program to register a
logger that has its own lock and pointer to a logger function.

Bug: 119867234
Test: logging unit tests
Change-Id: I8afffec1a6957d3bda95502a4c59493e0c5049ce
2020-04-22 13:12:11 -07:00
Joshua Duong
8cab9b6b24 Merge changes from topic "adb-mdns-cmdline"
* changes:
  [adb client] Add "mdns services" command.
  [adb client] Add "adb mdns check" command.
2020-04-22 20:04:35 +00:00
Joshua Duong
13c639e0bb [adb client] Add "mdns services" command.
This command list all discovered mdns services, so we
can connect via service name later on.

Bug: 152521166

Test: 'adb mdns services'
Test: test_adb.py
Change-Id: I23d42a7933e67a65bd0c9924afd6abe5915c0a11
2020-04-22 08:43:15 -07:00
Joshua Duong
504d393176 [adb client] Add "adb mdns check" command.
This command will check if the mdns daemon is available on the host
machine.

Bug: 152510294

Test: pkill -9 mdnsd; adb mdns check; mdnsd; adb mdns check;
Test: test_adb.py
Change-Id: If644678a339763817a8a7adcbdc545626d161aba
2020-04-22 08:43:15 -07:00
Josh Gao
992f08e78d Merge changes I26f823e2,Iaff2b157,I82a0d54f,I7e4b6fda,I268367b8
* changes:
  adbd: improve coverage by compiling less code.
  adb: refactor and relocate coverage script.
  adbd: test TCP in coverage.
  adb: allow wait-for-disconnect to match offline for TCP devices.
  adbd: add unit tests to coverage report.
2020-04-22 03:27:47 +00:00
David Anderson
bca7d2c30a Merge "liblp: Fix tests for linear extent overlap." 2020-04-22 01:43:29 +00:00
Josh Gao
073c8d2394 adbd: improve coverage by compiling less code.
Test: ./coverage/gen_coverage.sh && ./coverage/report.sh
Change-Id: I26f823e2587435b7ec2c6ca05955adef5cfc23a0
2020-04-21 17:57:29 -07:00
Josh Gao
f099105f07 adb: refactor and relocate coverage script.
Test: ./coverage/gen_coverage.sh
Change-Id: Iaff2b1577e32ba4ec8647a418a2ff4a1e9a0835d
2020-04-21 17:57:19 -07:00
Josh Gao
79d4f148d6 adbd: test TCP in coverage.
Test: ./coverage.sh
Change-Id: I82a0d54fcc1e19585a27c2d049be40289bf15f60
2020-04-21 17:57:17 -07:00
Josh Gao
e3c62cc549 adb: allow wait-for-disconnect to match offline for TCP devices.
This fixes a bug in adb root/unroot where we always fail because we're
waiting for a TCP device to disappear.

Test: test_device.py over TCP
Change-Id: I7e4b6fdaa1070cee1f9b471de46ae00bf89b3089
2020-04-21 17:57:15 -07:00
Josh Gao
03bee48659 adbd: add unit tests to coverage report.
Test: ./coverage.sh
Change-Id: I268367b857efc2125c6714a1d0b0e874fa8d143d
2020-04-21 17:57:13 -07:00
Josh Gao
67095b28de Merge "adb: add helper binary to do a usb reset on a device." 2020-04-21 23:01:48 +00:00
David Anderson
9c66e53a82 liblp: Fix tests for linear extent overlap.
The "OwnsSector" tests did not work if one range fit completely inside
another range. The new OverlapsWith() methods address this case.

Bug: 154277287
Bug: 154646936
Test: liblp_test gtests
Change-Id: I1a59069db4ffe4f13c45963c4847cff7b3dd3dfc
2020-04-21 15:43:59 -07:00
Josh Gao
1b81360c9e Merge "adbd: add a script to generate coverage information." 2020-04-21 19:35:52 +00:00
Treehugger Robot
524bc1fdc6 Merge "adbd: add a log message on start." 2020-04-21 17:00:43 +00:00
Treehugger Robot
68a5b66b99 Merge "Add /mnt/androidwritable for MOUNT_EXTERNAL_ANDROID_WRITABLE apps" 2020-04-21 16:44:41 +00:00
Ricky Wai
a4c163d734 Add /mnt/androidwritable for MOUNT_EXTERNAL_ANDROID_WRITABLE apps
Bug: 153540919
Test: Able to boot without errors
Change-Id: If206e5e3d76a7919b7468bc2d9666b3aff296b3b
Merged-In: If206e5e3d76a7919b7468bc2d9666b3aff296b3b
2020-04-21 12:16:43 +01:00
Josh Gao
c0d8686053 adbd: add a script to generate coverage information.
Test: ./coverage.sh
Change-Id: I1a3608063e4c4e3af5ec01680f0255d8c69e7127
2020-04-20 17:37:50 -07:00