Commit Graph

8 Commits

Author SHA1 Message Date
Zimuzo
e77a3e1de2 Add network health check watchdog triggered rollback tests
This cl improves code coverage for the PackageWatchdog explicit health
checks.

Updating the NetworkStack triggers an explicit health check with
a time deadline. At the deadline, if network is unavailable on the device,
the update is rolled back, if network is available, nothing happens.

Bug: 132640467
Test: atest StagedRollbackTest

Change-Id: I16a40244de9345930a1c981188aa33546fe872fc
2019-05-30 13:30:26 +01:00
Dario Freni
27ef26c880 Remove tests already covered by CTS.
Bug: 132429173
Bug: 127933960
Test: atest --test-mapping
frameworks/base/services/core/java/com/android/server/rollback/
Change-Id: I88685044d046180866c3cb63538a700cec775fc5
2019-05-22 15:16:37 +01:00
Richard Uhler
2124d4b313 Ensure race between rollback and roll forward is properly handled
If rollback for a package is committed at the same time the package is
updated, it's possible we will incorrectly roll back the newly updated
version of the application.

Add a hidden API to the package installer that lets you set a required
existing version of a package to be updated. If the expected package
version is not installed at the time of commit, the update install
fails.

The RollbackManager uses this new API to ensure that rollback will fail
if the package in question was just updated.

Test: atest RollbackTest, with new test added and manual confirmation
      that the race condition was exercised by the new test.
Bug: 128831080

Change-Id: Ifa5627e257d2ef13e2b213ef0dbc93932797ce0d
2019-05-01 09:10:36 +00:00
Richard Uhler
1924d6dbb8 Expire rollback when apex is updated.
RollbackManager relies on package changed broadcasts to expire rollbacks
when an application is updated, but we don't receive package changed
broadcasts for apex.

This change adds an extra check when starting RollbackManager to see if
any apex versions have changed and expires rollbacks as appropriate.

Adds a test case to cover the scenario and refactors the test code
to properly set up the test apex in all cases with minimal reboots.

Bug: 126358044
Test: atest StagedRollbackTest, with new test added.
Change-Id: I7ea4953e4aff8d1c7560d6c61e6be5e4e8e1f194
2019-04-26 13:22:51 +01:00
Richard Uhler
8a9774550d Use test stubs for RollbackTests, not system stubs.
Adds @TestApi for all system apis needed for RollbackTests.

Removes @SystemApi for RollbackManager.expireRollbackForPackage and
RollbackManager.reloadPersistedData, which were always intended to be
used solely for testing.

Bug: 127282563
Test: atest RollbackTest StagedRollbackTest
Change-Id: I183b8a484b4a08f36fc19d64241ab408d28c64ca
2019-03-12 12:14:37 +00:00
Richard Uhler
a7291341e3 Avoid building RollbackTestApps into the device image.
The current approach for including built apks as java resources in
RollbackTest.apk appears to cause the RollbackTestApp apks to be
included in the device release image. Convert the Android.mk for
RollbackTest to Android.bp to work around this issue.

This breaks the split apk tests, but we can figure out how to address
that later. Marking the split apk tests @Ignore for now.

Bug: 123695037
Bug: 127520966
Test: make -j80 dist tests, verify no RollbackT*.apk is included in the
      built device image.
Test: atest RollbackTest; atest StagedRollbackTest, verify no
      RollbackT*.apk is included in the built system image.

Change-Id: Ib413785b0974faddf19ac8dd7387b2642dab37e4
2019-03-07 14:57:53 +00:00
Richard Uhler
4937fadf67 Revert "Convert RollbackTest Android.mk to an Android.bp."
This reverts commit 0145c883e0.

Reason for revert: Causes the RollbackTest apps to be installed to the system partition, which breaks the rollback tests.
Bug: 123695037

Change-Id: I3ee89ecb370144c67fe88bb389abafdda59dc502
2019-02-04 12:51:58 +00:00
Richard Uhler
0145c883e0 Convert RollbackTest Android.mk to an Android.bp.
Which is more convenient for building a dummy apex module to test
rollback of staged installs.

Bug: 112431924
Test: atest RollbackTest

Change-Id: I30c2fc7d37ca30e47b49012edc02a1fc637ba6f6
2019-01-29 16:14:36 +00:00