Commit Graph

47762 Commits

Author SHA1 Message Date
Elliott Hughes fdde7ee1f2 liblog: fix benchmark build after google-benchmark upgrade.
Test: treehugger
Change-Id: Id5a67680c23c22355d7ff2eb5cf66a8ef799b83e
2019-06-07 08:38:37 -07:00
Treehugger Robot 44cabca1ef Merge "base: fix out of date documentation with PropertySet()" 2019-06-05 21:24:23 +00:00
Tao Bao 8eea2cae86 Merge "adb: Allow `adb rescue getprop`." 2019-06-05 20:43:55 +00:00
Mark Salyzyn 291b5caa46 Merge "fs_mgr: overlayfs: test: spelling mistake" 2019-06-05 20:29:53 +00:00
Mark Salyzyn bc79fea7a1 fs_mgr: overlayfs: test: spelling mistake
Test: adb-remount-test.sh
Bug: 132070014
Change-Id: I7bc68c15f53f94d1c14e2da91157ade362bc72f8
2019-06-05 11:12:05 -07:00
Tom Cherry ef2469e547 base: fix out of date documentation with PropertySet()
As of Android-P, __system_property_set() is synchronous and only will
return '0' if the property was successfully set.

Test: n/a
Change-Id: Icbc0a6d8be1ae683565f378c534ea8e5c5f25357
2019-06-05 10:31:33 -07:00
Christopher Ferris 659f61e0f2 Merge "Display offsets for dex frames." 2019-06-04 22:28:56 +00:00
Tao Bao 599eee1f37 adb: Allow `adb rescue getprop`.
Which will dump all the allowed properties, similar to `adb shell
getprop`.

Bug: 134027350
Test: Run the command under rescue mode.
Change-Id: Id668224098006d71ee192c8c2bea5d791d2423c1
2019-06-04 14:59:58 -07:00
Josh Gao 2683d0a2ca Merge changes I2d005e17,If2eec162,Icfd642e6
* changes:
  adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
  adbd: respond to device-to-host control transfers.
  adbd: read, print, and ignore USB control transfers.
2019-06-04 19:22:08 +00:00
Josh Gao a891ffddd3 Merge "adbd: provide MS OS descriptors for WinUSB." 2019-06-04 19:22:00 +00:00
Christopher Ferris a4bdb984f9 Display offsets for dex frames.
When adding a dex frame, no offset is ever printed even if the dex data
is coming from a non-zero offset map. Fixed so an offset is printed
in this case.

Previous the line looked like this:

  #17 pc 0000000000500d7a  /product/app/GoogleCamera/GoogleCamera.apk (com.google.android.libraries.camera.async.AndroidPriorityThread.run+10)

Now looks like:

  #17 pc 0000000000500d7a  /product/app/GoogleCamera/GoogleCamera.apk (offset 0x11d0000) (com.google.android.libraries.camera.async.AndroidPriorityThread.run+10)

Add new unit test for this case.

Bug: 134420076

Test: Wrote new unit test, and verified a non-zero offset for dex file
Test: data results in a frame with a non-zero offset.
Change-Id: I58c134fda4fad5456ca0f1723192667a1ca5d509
2019-06-04 12:07:05 -07:00
Treehugger Robot 41f690ba2a Merge "Fix leak of mapped zip central directories" 2019-06-04 12:36:52 +00:00
Treehugger Robot f74ff74475 Merge "fastboot: windows: Minor printf format fixes" 2019-06-04 00:20:24 +00:00
Treehugger Robot d877a96656 Merge "Allow adb to handle single paramter with install-multi-package flag" 2019-06-03 22:49:48 +00:00
Mark Salyzyn b5db741383 Merge "fs_mgr: overlayfs: test: triage data missing after failure flash scratch" 2019-06-03 21:22:28 +00:00
Greg Kaiser 8acf8c2da7 fastboot: windows: Minor printf format fixes
We recently changed 'xfer' to a size_t, so update the DBG format
accordingly.  We also fix a long standing issue with format for
the unsigned 'read'.

Test: TreeHugger
Change-Id: I3dc5f26a033fea64119016802bc9cdb54bbb7b52
2019-06-03 14:12:42 -07:00
Mark Salyzyn 4d702e8dea fs_mgr: overlayfs: test: triage data missing after failure flash scratch
After flashing empty image to scratch device, the device did not
return after 3 minutes.  It also did not collect any triage data
reporting only:

[  FAILED  ] did not reboot after flash

Add triage data, increase timeout to 4 minutes.

Test: adb-remount-test.sh
Bug: 132070014
Change-Id: Ic607abb5b2575d630bf6c27817a38a90820d24e1
2019-06-03 12:53:07 -07:00
Treehugger Robot 0c615194f4 Merge "fs_mgr: overlayfs: pre-emptive filesystem setup" 2019-06-03 14:18:45 +00:00
Treehugger Robot 90ca86ba22 Merge "Close /dev/fuse FD before calling onClosed" 2019-06-03 11:26:25 +00:00
Mark Salyzyn e0c581fec3 fs_mgr: overlayfs: pre-emptive filesystem setup
If we just disabled verity, take the step to setup the backing
storage for overlayfs.

Test: adb-remount-test.sh
Bug: 130131892
Change-Id: Ic56569eaf363e4417a0ce5df11ee5480a07b8b03
2019-05-31 11:23:01 -07:00
Anton Hansson 03e31332a3 Close /dev/fuse FD before calling onClosed
This works around a deadlock when a bridge that is about to be closed
is reused for a new call to openFile. The call to open() ends up holding
the vold lock, waiting for appfuse to respond. The appfuse event loop
calls onClosed(), which ends up calling vold.unmountAppFuse(), which
cannot get the lock.

Closing this file descriptor causes any current calls to open() on its
mount path to fail with either ECONNABORTED or ENOTCONN, allowing the
event loop to make progress, call onClosed() and unmount the path.

Note that the failed call to open() will result in a retry, which
will create a new appfuse bridge. This is not ideal but not a new
problem -- the common case here is that that each call to
openProxyFileDescriptor creates a new bridge. This should ideally
be improved.

Bug: 132344997
Test: flick through info of photos with location info attached
Change-Id: I878e5cf86f18c5233f8505f52eb9db076bd72d01
Merged-In: I878e5cf86f18c5233f8505f52eb9db076bd72d01
2019-05-31 17:06:52 +01:00
Treehugger Robot fac0bb7a92 Merge "fastboot: windows: fix Read function" 2019-05-31 15:45:21 +00:00
Fernando Lugo b7eac2d084 fastboot: windows: fix Read function
Read function exits before reading all requested bytes. Fix that by
looping until the len requested is completed.

This will fix the issue execting get_staged command for a staged image
bigger than 1MB

Test: fastboot get_staged file.txt
Change-Id: Ic70ab48f3a8c8d78c225db638892501d4dc20b13
Signed-off-by: Fernando Lugo <flugo@google.com>
2019-05-30 17:47:49 -07:00
Treehugger Robot 3cb66ad34f Merge "init: Refactor service.h/cpp" 2019-05-31 00:32:34 +00:00
Vic Yang e01ca4da2d init: Refactor service.h/cpp
Factors out utility functions into service_utils.h/cpp, so that they
can be reused by the upcoming native zygote.

Bug: 133443795
Test: Build and boot cuttlefish.
Change-Id: I0531b6f17561119c8cc33dd9ba375b351747fcfe
2019-05-30 14:24:03 -07:00
Tom Cherry c76078e4b6 Merge "init: Refactor selinux.h/cpp" 2019-05-30 15:30:49 +00:00
Mark Salyzyn 370aac75ea Merge changes I55d0e1a8,I4d9a8776
* changes:
  adb-remount-test: do not brick devices that support overlayfs but do not use it
  adb-remount-test: provide additional mount details
2019-05-30 00:19:55 +00:00
Treehugger Robot 842cac88e4 Merge "fs_mgr: remount reboot if overlayfs got setup" 2019-05-30 00:07:48 +00:00
Mark Salyzyn d9b60303a0 fs_mgr: remount reboot if overlayfs got setup
Cosmetic fix.

If overlayfs gets setup by the remount command, ask user to reboot
since the device is not 100% in a state to run, and is merely only
in a state to take push and sync operations.

overlayfs is only truly ready for developing and running if the
overly mounts had occurred in first stage init, this happens when
the device is rebooted.

We did not completely remove overlapping dead ext4 dedupe code in a
previous change, complete the process.

Simplification for adb remount, the message:

    Now reboot your device for settings to take effect

will only occur on the pass that causes the overlays to be populated,
in the same boot session. If subsequent, and ineffectual in any case,
remount command occurs again, it will not request a reboot.

Test: adb-remount-test.sh
Bug: 130131892
Change-Id: I7c4f408546687c49249883e2641b9bc63f68afd0
2019-05-29 16:44:52 -07:00
Treehugger Robot 719790f560 Merge "Minor fixes on android::base::expected" 2019-05-29 23:36:51 +00:00
Treehugger Robot f777694081 Merge "Fix non-aio USB read issue for fastbootd" 2019-05-29 23:12:42 +00:00
chihhao.chen 8c544b6fd8 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
Merged-In: I6690324840d78f3f1e04235040301520329976db
2019-05-29 23:10:50 +00:00
Vic Yang 92c236e41b init: Refactor selinux.h/cpp
This change factors out functions that handle selabels from
selinux.h/cpp into selabel.h/cpp.  This allows util.cpp to be used by
the upcoming native zygote without a bunch of define flags that are
required for selinux.cpp.

Bug: 133443795
Test: Build and boot cuttlefish.
Change-Id: Ie238a96c6407c6698a605dd8803c1727abfaae7b
2019-05-29 15:09:39 -07:00
Tom Cherry e20f357f4f Merge changes I16ea9e32,Ib53b5d3e
* changes:
  init: make fatal reboot target configurable
  init: dump stack when aborting
2019-05-29 21:40:12 +00:00
Tom Cherry 75e13baf32 init: make fatal reboot target configurable
Currently, if init encounters a fatal issues it reboots to fastboot
but this may be not desirable in all cases, especially the case of
critical services crashing.  Therefore this change adds the ability
for vendors to customize the reboot target via the
androidboot.init_fatal_reboot_target= kernel command line.

This applies to all LOG(FATAL) messages as well as fatal signals in
userdebug/eng builds, except for signals before logging is enabled in
first stage init.

Bug: 121006328
Test: device reboots to configurable target with LOG(FATAL)
Test: device reboots to configurable target after a segfault in the
      various stages of init
Test: device reboots to fastboot without a configured target
Change-Id: I16ea9e32e2fee08dece3d33b697d7a08191d607b
2019-05-29 09:14:17 -07:00
Jiyong Park 68f5fb2971 Merge "Don't use apexd when TARGET_FLATTEN_APEX == true" 2019-05-29 16:12:05 +00:00
Tom Cherry 59656fb377 init: dump stack when aborting
Dump init stacks when aborting either due to LOG(FATAL) or in
userdebug/eng builds due to signals, including signals from
sanitizers.

Doesn't work for static first stage init yet, b/133450393 tracks
that.

Also, ensure that LOG(FATAL) in child processes calls abort() in all
stages of init, not just 2nd stage init.

Bug: 131747478
Test: abort init in various ways and see stacks
Test: hang or crash in backtrace handler and see child reboot
Change-Id: Ib53b5d3e7e814244203f875de016ada9900dfce8
2019-05-29 08:58:29 -07:00
Mark Salyzyn b1d78402f9 Merge changes I89826fc2,Ica0c14da,Icfbb799f,I233bbc7b,I30569a7c, ...
* changes:
  adb-remount-test: check devt and inode
  adb-remount-test: add an avc check
  adb-remount-test: parameterize fastboot_wait & adb_wait, increase timeout
  adb-remount-test: report wait duration
  adb-remount-test: check vendor image signature before using
  adb-remount-test: report usb user on unexpected connection
  adb-remount-test: wait-for-screen
2019-05-29 14:25:15 +00:00
Mohammad Samiul Islam b581ce93bb Allow adb to handle single paramter with install-multi-package flag
Bug: 130164367
Test: $adb install-multi-package dummy.apk
      It installs successfully.

Change-Id: I5775813d10b7a8d865518ce5480a401e8f41e876
2019-05-29 15:00:00 +01:00
Hemant Kumar 1cbe5edbc3 adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
Bug: http://b/129283234
Test: treehugger
Change-Id: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
2019-05-28 17:53:24 -07:00
Josh Gao 43a0a9a5bf adbd: respond to device-to-host control transfers.
Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
Merged-In: If2eec162ca4b31a9974c7bd5802be51cee9e2708
(cherry-picked from internal commit af086e9a95)
2019-05-28 17:52:11 -07:00
Josh Gao fc2e2003dd adbd: read, print, and ignore USB control transfers.
It seems like we're blowing up when receiving a control transfer that's
intended for Android Auto, because we're not expecting to get the data
for the control transfer in a subsequent read.

Bug: http://b/131867920
Test: none
Change-Id: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
Merged-In: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
(cherry-picked from internal commit 12807c7012)
2019-05-28 17:51:05 -07:00
Jiyong Park 5c06e6e17b Minor fixes on android::base::expected
This is a follow-up change of 7d89fb164b.

- Some of the missing conditions for SFNAIE were added
- Fixed indentation
- The assignment operator became "= default"

Bug: 132145659
Test: libbase_test

Change-Id: Ib5232a6e5e1d3df67e185d6e8c03374105c1ce94
2019-05-29 08:37:32 +09:00
Ryan Mitchell ce1c49da6f Fix leak of mapped zip central directories
Memory mapping the central directory of specific APKs caused memory
mappings to build up over time because they were never unmapped
correctly. This is because MappedFile is not calling munmap with the
size of the data after aligning the mmap offset to a page boundary.

Bug: 133463863
Test: install APKs and verify that the entire mapped CD is unmaped
Test: ran aapt2 as daemon and confirmed that mapped CD is unmapped
Change-Id: I26bda27c83615d1a166d92e43a2327909c453b89
2019-05-28 22:59:53 +00:00
Tom Cherry 79b0682ec9 Merge "Logcatd: Add new properties control logcat file size and file count." 2019-05-28 22:26:43 +00:00
Jiyong Park d7f7c208da Don't use apexd when TARGET_FLATTEN_APEX == true
When TARGET_FLATTEN_APEX is true (= ro.apex.updatable is unset or set to
false), apexd is not used to activate the built-in flattened APEXes.
Init simply bind-mounts /system/apex to /apex.

However, there is a special case here. The runtime APEX is installed as
either /system/apex/com.android.runtime.debug or
/system/apex/com.android.runtime.release, whereas it should be activated
on /apex/com.android.runtime - without the .debug or .release suffix.
To handle that case, the build system creates an empty directory
/system/apex/com.android.runtime and the .debug or .release directory
is bind-mounted to the empty directory by init at runtime.

This change also fixes a minor bug that native watchdog is triggered
for all post-apexd processes regardless of whether ro.apex.updatable
is true or not. Since apexd is expected to shutdown itself when ro.apex
.updatable is false, we don't trigger the watchdog in that case.

Bug: 132413565
Bug: 133305381
Test: marlin and sdk_gphone are bootable
Merged-In: I219465b8b81decb960e2c5f46bab6e0768b31317
Change-Id: I219465b8b81decb960e2c5f46bab6e0768b31317
(cherry picked from commit f93088ba2b)
2019-05-29 07:04:27 +09:00
Treehugger Robot 2dca188503 Merge "adb-remount-test: adb_reboot stdin issue" 2019-05-28 21:10:01 +00:00
Treehugger Robot 5f7314b7e1 Merge "recovery: report compliant reboot reason (Part Deux)" 2019-05-28 15:57:24 +00:00
Mark Salyzyn cfe658a04e adb-remount-test: do not brick devices that support overlayfs but do not use it
restore() should not run adb enable-verity if device does not
use overlayfs even though it supports it.

Test: adb-remount-test
Bug: 132070014
Change-Id: I55d0e1a87eca9c5f258a1587c844f2a6e4b13b29
2019-05-28 08:11:54 -07:00
Mark Salyzyn 67788ef8a1 adb-remount-test: check devt and inode
Check to make sure st_dev and st_ino for the uploaded content
is as expected.

Test: adb-remount-test
Bug: 129319403
Bug: 132395411
Change-Id: I89826fc2740dfd2ead4bcd8988cfbbc315b77b09
2019-05-28 08:08:49 -07:00