Commit graph

58672 commits

Author SHA1 Message Date
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
David Anderson
44ae546061 libdm: Fix WaitForFile early-returning on failed accesses.
WaitForFile/WaitForDeletedFile both early return true if an error like
EPERM occurs. This was intentional because the code was modeled off
earlier fs_mgr code, but it makes libdm inherently racy if sepolicy is
not configured correctly. It's better to have these result in explicit
and consistent failures.

Bug: 148103327
Test: fastboot flashall
Change-Id: I0c78818962e1db91b556e523c418db28f7d78fae
Merged-In: I0c78818962e1db91b556e523c418db28f7d78fae
2020-03-03 18:59:10 -08:00
Josh Gao
2da5520aab Merge changes Ic2af40b8,I9c8cfebe into rvc-dev
* changes:
  Reland "adb: turn CHECKs into an error + transport restart."
  Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
2020-03-04 00:07:46 +00:00
Hridya Valsaraju
6c889bb9cb fastbootd: use FastbootDevice::GetCurrentSlot to get current slot suffix
Using FastbootDevice::GetCurrentSlot to get the current slot suffix
instead of reading the same from the device's boot control HAL
is required to account for the prior set_active commands issued via
fastbootd in the same boot.

Test: fuzzy_fastboot
--gtest_filter=Conformance.Slots:Conformance.SetActive --gtest_repeat=10
Bug: 146589281

Change-Id: I2edb0f024d93c2483659623423ef5c69c717c7af
Merged-In: I2edb0f024d93c2483659623423ef5c69c717c7af
2020-03-03 17:38:19 +00:00
Tom Cherry
2c005614f5 Merge changes from topic "libinit_test_utils-build-error" into rvc-dev
* changes:
  Stop & Resume property service when switching to bootstrap namespace
  init: handle property service callbacks asynchronously
  Refactor libinit_test_utils to not use libinit and expose its libraries
2020-03-03 16:22:28 +00:00
Tom Cherry
1c6f44b0d1 Merge "logd: don't coalesce identical log messages in the security buffer" into rvc-dev 2020-03-03 16:06:20 +00:00
Jiyong Park
3d79b37a41 Fixed a typo in the version name
Bug: 149569129
Test: m
Change-Id: I7401e8c092d4ee329fb1b5f23b7797f706b58faa
2020-03-03 16:19:07 +09:00
Josh Gao
1e18ac38da Reland "adb: turn CHECKs into an error + transport restart."
This reverts commit 2547f740ea.

Bug: http://b/134695864
Bug: http://b/133872605
Test: manually unplugged/replugged
Change-Id: Ic2af40b81354138a7842eb93aacc303885ac952e
(cherry picked from commit 7b3048446d)
2020-03-02 22:59:54 -08:00
Josh Gao
d9684d5943 Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
This reverts commit ba4684c2b2.

Bug: http://b/129283234
Test: manually unplugged/replugged
Change-Id: I9c8cfebe09b2855cab986068273a835a13247b77
(cherry picked from commit bfe3dac36d)
2020-03-02 22:59:54 -08:00
Jaegeuk Kim
9e1bcc25f9 Merge "fs_mgr: remain elapsed time of fsck in prop" into rvc-dev 2020-03-03 00:37:17 +00:00
Jaegeuk Kim
34da2061d4 fs_mgr: remain elapsed time of fsck in prop
Bug: 149595111
Bug: 149844577
Bug: 138909685
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I8f11ca2680558dc54efd6788ee0dd56e5d65a356
Merged-In: I8f11ca2680558dc54efd6788ee0dd56e5d65a356
2020-03-03 00:35:04 +00:00
TreeHugger Robot
552729b9d6 Merge "fsck.f2fs: enable cache" into rvc-dev 2020-03-03 00:21:32 +00:00
Automerger Merge Worker
0f52deaf32 [automerger skipped] Allowing R and S developer GSI for DSU am: 99651b012b -s ours
am skip reason: Change-Id I6bc1e068368e64cb0bbf6ef63805444b35a1fdfb with SHA-1 a2ac846ff3 is in history

Change-Id: Ib423d80893de7cf45e231221764b1e1d99ea21bb
2020-03-02 21:30:48 +00:00
Automerger Merge Worker
c4f86ac7a6 [automerger skipped] Adding new GSI public keys am: 14b8c451c4 -s ours
am skip reason: Change-Id Iaa7521ef40b94f13fe3c9c61d276678f47c60b98 with SHA-1 b697d47eb3 is in history

Change-Id: Ib97982ceb61dc853f2080ec8205e7cff7ced2b65
2020-03-02 21:30:46 +00:00
Josh Gao
9978c36754 Merge changes Ib97acc6d,I8f14004a,Id5bbfd6d,I4dfc3f52 into rvc-dev
* changes:
  adbd: add runtime-configurable logging.
  adb: don't hardcode ports in test_adb.
  adbd: add usb thread spawn logging.
  base: add CachedProperty.
2020-03-02 20:46:15 +00:00
Josh Gao
bbe3385097 adbd: add runtime-configurable logging.
Add some requested logging options that can be turned on at runtime
without having to restart adbd.

Bug: http://b/141959374
Test: manual
Change-Id: Ib97acc6d199e0b91238a6758e18b7cb75f8688d9
(cherry picked from commit 52d0b67f19)
2020-03-02 12:44:54 -08:00
Josh Gao
9ddc42aa93 adb: don't hardcode ports in test_adb.
If we get unlucky and something else (or ourselves, in another thread)
beats us to listening on our hardcoded ports, we can deadlock.

Bug: http://b/149829737
Test: ./test_adb.py
Change-Id: I8f14004a6b2e77366abad6e88786ea8941629020
(cherry picked from commit e8829c6bfc)
2020-03-02 12:44:50 -08:00