Commit graph

58488 commits

Author SHA1 Message Date
Josh Gao
d1ee5085f3 adbd: make libadbd_services cc_library again.
For currently unknown reasons, sideloading is broken with
libadbd_services as a cc_library_static.

Partial revert of commit a9b62d5452.

Bug: http://b/151056300
Test: xunchang@ tested manually
Change-Id: Iaffad9c476ba0adcffc5db512ba4a7ee0fb5cb22
(cherry picked from commit 7f8a37c8c7)
2020-03-11 23:18:41 +00:00
Jaegeuk Kim
26471f7470 Merge "run ext4 tools in first_stage_ramdisk" into rvc-dev 2020-03-11 20:05:22 +00:00
Nikita Ioffe
ccb0608a32 Merge "fs_mgr_get_mounted_entry_for_userdata: handle logical partitions" into rvc-dev 2020-03-11 19:17:30 +00:00
Jaegeuk Kim
253b0729bc run ext4 tools in first_stage_ramdisk
Bug: 149039306
Change-Id: I646960baa3c0d5a0dedda82b1fdc3816321aaa2e
Merged-In: I646960baa3c0d5a0dedda82b1fdc3816321aaa2e
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-03-11 16:39:58 +00:00
Nikita Ioffe
f495fe798b fs_mgr_get_mounted_entry_for_userdata: handle logical partitions
In case of GSI on DSU, /data is mounted on the following stack:
userdata -> userdata_gsi -> actual block device, and fstab returned from
ReadDefaultFstab() function will say that /data should be
mounted onto userdata_gsi. This configuration wasn't supported.

To support it, fs_mgr_get_mounted_entry_for_userdata now unwinds the
dm-device stack /data is mounted onto, and for each entry in fstab
resolves corresponding block device (in case of logical partitions by
asking DeviceMapper to resolve name -> path, and for other cases by
reading a symlink), and then checking whenever resolved block device
belongs to the unwinded stack.

Test: on both normal boot & DSU
Test: atest CtsUserspaceRebootHostSideTestCases
Test: atest CtsFsMgrTestCases
Bug: 148612148
Change-Id: I1bb3e64ae92d56de905b4f7f1997b7499b101b0f
2020-03-11 15:10:20 +00:00
Jiyong Park
846d14799b Merge changes from topic "liblog" into rvc-dev
* changes:
  Whole static link libasync_safe to libbacktrace.a
  libbase uses liblog symbols via dlsym when it is built for APEX
2020-03-11 03:25:29 +00:00
Josh Gao
8c6d98af1c Merge "adb: defer acknowledgement of pushed files until the end." into rvc-dev 2020-03-10 22:33:22 +00:00
TreeHugger Robot
3ae89289bd Merge "liblog: add API level guard to NDK log.h header" into rvc-dev 2020-03-10 21:27:45 +00:00
Yifan Hong
77d51eb888 Merge changes from topic "no_snapshot_callstack" into rvc-dev
* changes:
  Revert "libsnapshot::RemoveAllUpdateState log stack"
  Revert "libsnapshot callstack files readable by dumpstate"
  libsnapshot: delete InitiateMergeAndWait.
2020-03-10 19:18:48 +00:00
Tom Cherry
060f58ad35 liblog: add API level guard to NDK log.h header
Bug: 119867234
Test: build
Merged-In: I6fdd7c070af06f04314b9bf7bbfede2a106e0d7c
Change-Id: I6fdd7c070af06f04314b9bf7bbfede2a106e0d7c
(cherry picked from commit 59e93a55fc)
2020-03-10 11:55:43 -07:00
Tom Cherry
1588e9b0c2 liblog: minimum_log_priority should be atomic
In case multiple threads try to reference this variable while it is
being set, it should be atomic so that all threads always see a valid
value.

Bug: 150898477
Test: liblog, libbase unit tests
Merged-In: If6c9e291f2471b96a752dc6e76e3e63458b71391
Change-Id: If6c9e291f2471b96a752dc6e76e3e63458b71391
(cherry picked from commit bbb16022c7)
2020-03-10 08:46:15 -07:00
Josh Gao
6519ad6355 adb: defer acknowledgement of pushed files until the end.
Previously, we were waiting for the other end to respond after every
file sent, which results in massive slowdown when there's any amount of
latency on the transport.

This improves performance on a cuttlefish instance with ~7ms RTT from:

    system/: 2037 files pushed, 0 skipped. 2.8 MB/s (762803979 bytes in 262.964s)

to:

    system/: 2037 files pushed, 0 skipped. 11.9 MB/s (762803979 bytes in 61.278s)

Bug: https://issuetracker.google.com/150827486
Test: ./test_device.py
Change-Id: I3a0c893faa5d455cc6ccbc86915a17e1b5abbfbe
(cherry picked from commit 64ff82ba68)
2020-03-09 18:57:15 -07:00
Jiyong Park
7c8e2b247d Whole static link libasync_safe to libbacktrace.a
When libbacktrace.a is statically lined to somewhere, that library had
to add libasync_safe.a to static_libs because libbacktrace.a has
references to libasync_safe.a. But libbacktace depending on
libasync_safe is an implementation detail of libbacktrace, and therefore
its client shouldn't be affected by it.

Fixing this by doing the whole static link to libasync_safe to
libbacktrace.a so that the former is included in libbacktrace.a

Bug: 149569129
Test: m
Change-Id: If7366a240bc945dda9944fe7c111e10d328165bb
2020-03-10 10:08:26 +09:00
Jiyong Park
5280b5c03e libbase uses liblog symbols via dlsym when it is built for APEX
libbase is a popular library that is used by many APEXes either directly
or transitively. It is being used by several Mainline modules that were
launched with Q, in which case everything in the APEX - including
libbase - shouldn't use new APIs that are added post Q, i.e. R.

libbase however is using a few new R symbols from liblog, and this is
preventing those Q-launching Mainline modules that are built in R source
tree from being installed to Q devices.

Fortunately, the dependencies to the new R symbols are guarded with a
flag; when the existence of the symbols are not guaranteed, it uses
dlsym. This change fixes the aforementioned problem by turning on the
flag also when libbase is built for an APEX.

Bug: 149569129
Test: TARGET_BUILD_APPS=com.android.media
vendor/google/build/build_mainline_modules.sh
adb install --staged out/dist/mainline_modules_arm64/com.android.media.apex
adb reboot
The APEX is installed and mediaextractor process doesn't crash

Change-Id: I44b5ec028850613cb45fc3e792f43cd8e87cfd00
2020-03-10 10:08:26 +09:00
Yifan Hong
21ab3adc73 Revert "libsnapshot::RemoveAllUpdateState log stack"
Revert submission snapshotctl_callstack

Reason for revert: Callstack should not be logged
Reverted Changes:
Ib80c74a9a:Temporarily add libutilscallstack dependency
I2dfb6b7f1:libsnapshot::RemoveAllUpdateState log stack

Test: none
Bug: 148818798

Change-Id: I34683e93f10971629737f6fe648b25c6066c702f
2020-03-09 16:16:33 -07:00
Yifan Hong
611c6f7d79 Revert "libsnapshot callstack files readable by dumpstate"
This reverts commit faa49d1d00.

Reason for revert: Callstack should not be logged.

Test: none
Bug: 148818798

Change-Id: Ie5506ae0c7408e255a464b2f403d0a47d272229e
2020-03-09 16:16:33 -07:00
Yifan Hong
ffd1f52c22 libsnapshot: delete InitiateMergeAndWait.
Now that update_engine is responsible for initiating the
merge, InitiateMergeAndWait function becomes useless.

Bug: 147696014
Test: libsnapshot_test
Change-Id: I5473dc543ca8ac2fd31f597720847b02d0e5e33d
2020-03-09 16:16:33 -07:00
Ruchir Rastogi
7a287d0751 Use dlsym to load libstatssocket API
Also fixes a bug in the tests where the platform version was being
checked by querying version.release instead of version.codename
(currently, version.release == 10, while version.codename == R).

Test: bit libstatspush_compat_test:* (on Q and R)
Test: libsstatssocket.so is not placed in resolv apex (on R)

1|bonito:/ $ ls apex/com.android.resolv/lib64
libclang_rt.ubsan_standalone-aarch64-android.so
libcrypto.so
libnetd_resolv.so
libssl.so

Test: NETWORK_DNS_EVENT_REPORTED atom is logged to statsd (on R)
    - adb shell cmd stats print-stats (atom 116 count > 0)

Bug: 148743333
Change-Id: Ib3eaa32835905bcf6e3b003054bf0f3c4e7ec0a4
Merged-In: Ib3eaa32835905bcf6e3b003054bf0f3c4e7ec0a4
(cherry picked from commit 9848eb4f1c)
2020-03-09 15:16:11 -07:00
TreeHugger Robot
19212e3212 Merge "Use libbase to get the elapsed time instead of libutils" into rvc-dev 2020-03-09 20:53:24 +00:00
David Anderson
114a86ebb4 Merge "libdm: Fix WaitForFile early-returning on failed accesses." into rvc-dev 2020-03-09 19:08:43 +00:00
Luke Huang
7452e46ae0 Use libbase to get the elapsed time instead of libutils
To minimize the external library dependencies

Bug: 149721367
Test: atest
Change-Id: I7b79223ad58c2af94d01a35ad39be6cdd1de7f47
Merged-In: I7b79223ad58c2af94d01a35ad39be6cdd1de7f47
(cherry picked from commit cab9854fa9)
2020-03-06 22:09:44 +00:00
Nikita Ioffe
bbbd1a8e41 Merge "Move GetMountedEntryForUserdata to fs_mgr.h" into rvc-dev 2020-03-06 19:45:54 +00:00
TreeHugger Robot
5f3afb215b Merge "debuggerd: add an opt-out for OEMs that would rather collect core dumps." into rvc-dev 2020-03-06 19:42:41 +00:00
Nikita Ioffe
8f50cfc28d Move GetMountedEntryForUserdata to fs_mgr.h
Logic of unwinding dm-device stack to figure out what entry was used to
mount userdata turned out to be a little bit more involved, and it
shouldn't be part of libfstab

This CL just moves code around and cleans API a little bit, actual fix
will be in the follow-up CL.

Test: atest CtsFsMgrTest
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 148612148
Change-Id: If0f8a765dba63adb0e6a711eb81fffdcabea3480
2020-03-06 18:31:38 +00:00
Yifan Hong
f9783dc18d Merge changes from topic "snapshot_rollback" into rvc-dev
* changes:
  init: restorecon libsnapshot rollback indicator
  init: Make sure ImageManager status files are labelled.
2020-03-06 18:01:06 +00:00
Elliott Hughes
76eb935bd4 debuggerd: add an opt-out for OEMs that would rather collect core dumps.
On userdebug/eng devices, check a system property to see whether we
should create tombstones or not. OEMs that would rather have core dumps
can set this property and configure /proc/sys/kernel/core_pattern
appropriately.

Bug: https://issuetracker.google.com/149663286
Test: set the property, cause a crash
Change-Id: If894b4582a1820b64bdae819cec593b7710cb6e3
(cherry picked from commit 530ab81e42)
2020-03-06 09:21:45 -08:00
Automerger Merge Worker
88b85abc6a [automerger skipped] Add cpu-set properties to serializer test am: 6ea9b8b580 -s ours
am skip reason: Change-Id I1232fec5f1d0be7e5fb6aa5c46f6c2c5529bfc6c with SHA-1 8e77b789f8 is in history

Change-Id: I0e13c779e06c07a648e4ac8ccbfeec437f4dbb7a
2020-03-06 16:19:26 +00:00
Yifan Hong
dd4e7ef6ce init: restorecon libsnapshot rollback indicator
The rollback indicator is created during first stage init and
is unlabeled. Need to restorecon it properly so that it can
be properly deleted by update_engine later.

Bug: 149956852
Bug: 150907679
Test: apply OTA, reboot, look at serial console
Change-Id: Ie954023b557865691fec2ae378145596bf1973a9
2020-03-05 21:56:03 -08:00
David Anderson
960a81f4a1 init: Make sure ImageManager status files are labelled.
adb remount and snapshot-based updates use ImageManager in first-stage
init. This creates status files, which need to be labelled.

Bug: 148834619
Test: manual test
Change-Id: I72949fca2889f9e5612049844a78bf9355b48797
Merged-In: I72949fca2889f9e5612049844a78bf9355b48797
2020-03-05 21:55:12 -08:00
TreeHugger Robot
ae86eb783a Merge "base: access all new liblog symbols through liblog_functions" into rvc-dev 2020-03-06 05:32:29 +00:00
Tom Cherry
b9a0e2ad60 base: access all new liblog symbols through liblog_functions
The original CL was missing these.

Bug: 149591522
Test: build
Merged-In: I99615b81cfe9166a00c812a8642ecf1244bf08b9
Change-Id: I99615b81cfe9166a00c812a8642ecf1244bf08b9
(cherry picked from commit d620ec7fb9)
2020-03-05 18:48:42 -08:00
PO HUNG CHEN
7fc6052fd3 Merge "Refine the exported DSU status" into rvc-dev 2020-03-06 02:25:21 +00:00
Yifan Hong
133c060693 Merge changes from topic "snapshotctl_cleanup" into rvc-dev
* changes:
  libsnapshot: SnapshotMergeStats::Start/Finish
  libsnapshot: Expose SnapshotMergeStats
  libsnapshot: delete WaitForMerge.
  libsnapshot: handle errors in RemoveAllUpdateState appropriately.
  libsnapshot: remove snapshots properly after flashing
  libsnapshot: RemoveUpdateState on rollback.
  libsnapshot: NeedSnapshotsInFirstStageMount don't test for IsRecovery
  Allow ProcessUpdateState to be paused.
  libsnapshot: Re-expose InitiateMerge and ProcessUpdateState
  libsnapshot: Add prolog to RemoveAllUpdateStates.
  snapshotctl don't auto-merge.
  snapshotctl: init reports merge statistics
  libsnapshot/test: Re-enable the failing tests
2020-03-05 22:57:08 +00:00
Yifan Hong
e53129819d libsnapshot: SnapshotMergeStats::Start/Finish
Change API for SnapshotMergeStats so that it is easier
for update_engine to use.

Test: apply OTA and look at stats
Bug: 147696014
Bug: 138817833
Change-Id: Ie4036ac7382102c00f0761f443d78e00b9e585d5
Merged-In: Ie4036ac7382102c00f0761f443d78e00b9e585d5
2020-03-05 08:41:46 -08:00
Yifan Hong
2cea7249a9 libsnapshot: Expose SnapshotMergeStats
Test: builds
Bug: 147696014
Change-Id: Ia59a3f9226628558bdd1fdb0966812c2f652190c
Merged-In: Ia59a3f9226628558bdd1fdb0966812c2f652190c
2020-03-05 08:41:45 -08:00
Yifan Hong
3634255e66 libsnapshot: delete WaitForMerge.
Now that update_engine is responsible for initiating the
merge, WaitForMerge function becomes useless.

Bug: 147696014
Test: compiles
Change-Id: I3779bdf9dd8d1716238e21d09acf0499e3fc90a3
Merged-In: I3779bdf9dd8d1716238e21d09acf0499e3fc90a3
2020-03-05 08:41:45 -08:00
Yifan Hong
d5675f6728 libsnapshot: handle errors in RemoveAllUpdateState appropriately.
In CheckMergeState / HandleCancelledUpdate, if removing update state
fails, just return the previous state. It used to return Cancelled,
and the error goes unnoticed.

Test: pass
Bug: 147696014
Change-Id: I9cb3d20c5c886afa1913740c903eaad08f0cc041
Merged-In: I9cb3d20c5c886afa1913740c903eaad08f0cc041
2020-03-05 08:41:45 -08:00
Yifan Hong
7c5ae0a12e libsnapshot: remove snapshots properly after flashing
If updated then immediately flashed target slot at unverified
stage, update_engine attempts to call RemoveAllSnapshots, but
it used to fail because unmapping fails. In reality, these devices
are dm-linear targets, so unmapping them is optional.

- Introduce a GetSnapshotFlashingStatus function that expose more
information than AreAllSnapshotsCancelled. We can use the returned
map<string, bool> to determine whether a partition is flashed or
not.
- Introduce ShouldUnmapDeleteSnapshot which determines whether
unmapping / deleteting a snapshot is needed in RemoveAllSnapshots.

Test: apply OTA, flash target slot, then inspect logs
Bug: 147696014
Change-Id: I0853d1e213566af2a3401e46fac7d9586cee7aaf
Merged-In: I0853d1e213566af2a3401e46fac7d9586cee7aaf
2020-03-05 08:41:44 -08:00
Yifan Hong
ae2558d900 libsnapshot: RemoveUpdateState on rollback.
If rollback is detected in ProcessUpdateState, call
RemoveUpdateState and return UpdateState::Cancelled. Now that
update_engine is reponsible for initiating the merge, it can react to
this state and clean up markers appropriately.

Test: libsnapshot_test
Test: apply OTA, manually rollback (by setting the active slot), then
  inspect /metadata/ota as well as /data/misc/update_engine/prefs.

Bug: 147696014

Change-Id: Ibfee11fb50e4f4fb7c6cf02b4921b35e77b8f5a5
Merged-In: Ibfee11fb50e4f4fb7c6cf02b4921b35e77b8f5a5
2020-03-05 08:41:44 -08:00
Yifan Hong
1d32aa1a37 libsnapshot: NeedSnapshotsInFirstStageMount don't test for IsRecovery
Init skips first stage mount entirely in recovery, so
the check is useless. Also, __ANDROID_RECOVERY__ is always
set for first stage init.

Also add logs if rollback indicator is set.

Fixes: 149956852
Test: apply OTA, manually rollback, reboot, see rollback indicator
Change-Id: Iac967baf4b51ea5ce9f6eb962a33cb7ee5819c1d
Merged-In: Iac967baf4b51ea5ce9f6eb962a33cb7ee5819c1d
2020-03-05 08:41:43 -08:00
Yifan Hong
ef9e44ae78 Allow ProcessUpdateState to be paused.
Change callback type of ProcessUpdateState to bool() so that, when callback
returns false, immediately returns Merging.

Test: libsnapshot_test
Bug: 147696014

Change-Id: I9dcb8e1658b95216c0f1991e2e4c1ea2e7e7b2e5
Merged-In: I9dcb8e1658b95216c0f1991e2e4c1ea2e7e7b2e5
2020-03-05 08:41:43 -08:00
Yifan Hong
f6d4e74bc6 libsnapshot: Re-expose InitiateMerge and ProcessUpdateState
These functions are used directly in update_engine now that
it is responsible for initiating the merge. update_engine has
its own message loop, so WaitForMerge / InitiateMergeAndWait
becomes useless and are deprecated.

Bug: 147696014
Test: compiles

Change-Id: Id8cb14f5f18b4893e2fc3d0d2b374a867a220e6f
Merged-In: Id8cb14f5f18b4893e2fc3d0d2b374a867a220e6f
2020-03-05 08:41:43 -08:00
Yifan Hong
83fe0a3572 libsnapshot: Add prolog to RemoveAllUpdateStates.
Add an optional prolog arg (function<bool()>) that is invoked
before snapshots are deleted and update state set to none.

This allows update_engine to delete markers before deleting snapshots
to avoid depending on the erroneous markers. Otherwise, if update_engine
delete markers after libsnapshot deletes update states, the device could
technically get into a state where update_engine thinks the update has
been applied, but snapshots are gone.

Bug: 147696014
Test: libsnapshot_test

Change-Id: I71bfc04a81ea4f94b3072558be50d2f80565113e
Merged-In: I71bfc04a81ea4f94b3072558be50d2f80565113e
2020-03-05 08:41:42 -08:00
Yifan Hong
91ffe19c4e snapshotctl don't auto-merge.
update_engine is now responsible for initiating the merge. snapshotctl
becomes a debugging tool for libsnapshot now.

Bug: 147696014
Test: libsnapshot_test

Change-Id: Ia2527a35e0c0f0789dbe5c477e174663ef406903
Merged-In: Ia2527a35e0c0f0789dbe5c477e174663ef406903
2020-03-05 08:41:42 -08:00
Alessio Balsini
c6411c2d37 snapshotctl: init reports merge statistics
Enable the --report flag in init rc script to collect and send snapshot
merge statistics after OTA.

Bug: 138817833
Test: statsd_testdrive
Change-Id: Ie32a2c6d7d1671ca2b1846c6a8d33cea2ab22a4c
Signed-off-by: Alessio Balsini <balsini@google.com>
Merged-In: Ie32a2c6d7d1671ca2b1846c6a8d33cea2ab22a4c
2020-03-05 08:41:42 -08:00
Alessio Balsini
65ceecfec6 libsnapshot/test: Re-enable the failing tests
Some tests were temporarily disabled due to errors in Cuttlefish.
Now that the issues were fixed, the tests can be put back in presubmit.

Bug: 148889015
Test: vts_libsnapshot_test (Cuttlefish + Pixel 4)
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: Idcb2b7831b2183b2d734bdf8821fd34746f2beee
Merged-In: Idcb2b7831b2183b2d734bdf8821fd34746f2beee
2020-03-05 08:41:41 -08:00
Automerger Merge Worker
70b6a95619 Fix /data_mirror permission
Test: Able to boot without error
Bug: 150671726

Merged-In: If366d284f4f01ebfa660e85bad57861c120ada7e
Change-Id: I9d85c00d191dcaa46c0182b5a15cd89dcdb9ea5e
(cherry picked from commit 1a5ae50943)
2020-03-05 11:41:34 +00:00
Orion Hodson
6ea9b8b580 Add cpu-set properties to serializer test
Bug: 141446571
Bug: 149395059
Test: atest propertyinfoserializer_tests
Change-Id: I1232fec5f1d0be7e5fb6aa5c46f6c2c5529bfc6c
Merged-In: I1232fec5f1d0be7e5fb6aa5c46f6c2c5529bfc6c
(cherry picked from commit 8e77b789f8)
2020-03-04 10:37:00 +00:00
Howard Chen
026adf0864 Refine the exported DSU status
The new exported DSU status removes the need to make blocking binder
calls out of system server during device boot.

Bug: 149790245
Bug: 149716497
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    -d file:///storage/emulated/0/Download/system.raw.gz \
    --el KEY_SYSTEM_SIZE $(du -b system.raw|cut -f1) \
    --el KEY_USERDATA_SIZE 8589934592
Change-Id: I27fae316214498407a73474ca8b93aec3518e4b5
Merged-In: I27fae316214498407a73474ca8b93aec3518e4b5
(cherry picked from commit 2e1c6b26a1)
2020-03-04 18:24:00 +08:00
TreeHugger Robot
694529d3ff Merge "Fixed a typo in the version name" into rvc-dev 2020-03-04 03:36:39 +00:00