Run RollbackTest#testBasic only under a secondary user.
The host-driven test adds a new user and then installs the TEST (not the
test app) for that new user.
Note: this was the missing step in the previous attempt to test
RollbackTest under a secondary user.
Test: atest SecondaryUserRollbackTest
Test: test failed when multiuser support was removed from rollback
manager
Test: adb shell pm list packages --user 11 | grep rollback while running
the test in order to make sure the test is installing packages for the right user
Bug: 133852817
Bug: 129747710
Change-Id: Id1e54769cc2a9631d1464c07bad2b685f78689bc
testEnableRollbackTimeoutFailsRollback works by setting the enable
rollback timeout to 1 millisecond so that we will always time out, but
the test is failing some times because apparently we enable rollback
within the 1 millisecond limit. Reduce the timeout to 0 milliseconds to
try and reduce test flakiness.
Before lowering the timeout, the test failure was easy to reproduce
locally. After lowering the timeout I have not once been able to
reproduce the test failure locally.
Bug: 134373106
Test: atest RollbackTest:com.android.tests.rollback.RollbackTest#testEnableRollbackTimeoutFailsRollback
Change-Id: Ia25561831616dd2f2644743a399b49e35d5d4ea4
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
Make PackageManager send a ACTION_CANCEL_ENABLE_ROLLBACK intent to
RollbackManager. RollbackManager marks the relevant rollback as invalid.
Allow enable rollback to continue as usual, before making the rollback
available, RollbackManager checks whether it's valid. If it's not, the
rollback data is deleted.
Add a test case for expired rollback enabling attempt in RollbackTest.
Test: atest RollbackTest#testEnableRollbackTimeoutFailsRollback
Test: manual -
* Set ENABLE_ROLLBACK_TIMEOUT_MILLIS to 1 ms using DeviceConfig
* Install a mainline module with rollback enabled
* adb shell dumpsys rollback
* observe that no rollback was made available
Fixes: 131679409
Change-Id: Iaa4dbff002b820aff1fc3e1b985f129cf5ebe2e6
Failure to enable rollback for one of the packages in a multi-package
install should fail to enable rollback for all packages in the
multi-package install. That was not the case prior to this CL, which
could lead to partial rollbacks.
Keep track of how many child sessions we expect to enable rollback for
and double check that we succeeded before making the rollback available.
This involves some cleanup of how we track parent vs child sessions when
enabling rollback.
Bug: 128656191
Test: atest RollbackTest, with new test added.
Change-Id: I737896cdc1915396748c5c1959b5397af793258a
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
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
The test is marked @Ignore because of a bug in RollbackManager that
fails to expire a rollback when there is a new update of an apk to its
same version code:
STACKTRACE:
java.lang.AssertionError: expected null, but was:<android.content.rollback.RollbackInfo@28c0495>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotNull(Assert.java:755)
at org.junit.Assert.assertNull(Assert.java:737)
at org.junit.Assert.assertNull(Assert.java:747)
at com.android.tests.rollback.RollbackTestUtils.getUniqueRollbackInfoForPackage(RollbackTestUtils.java:321)
at com.android.tests.rollback.RollbackTest.testSameVersionUpdate(RollbackTest.java:795)
Bug: 120200473
Test: atest RollbackTest
Change-Id: Ib03692c170ee689fcf667689dad25647e55f984f
To reduce flakiness in the CTS test, which checks for an available
rollback immediately after an app update is committed.
Remove sleeps from the RollbackTest that should no longer be needed.
Test: atest RollbackTest CtsRollbackManagerTestCases
Bug: 127933960
Change-Id: I60adb0f58eaba02d08ecd44b44866a8505c58238
* Add missing permission needed in testBadUpdateRollback test.
* Re-enable testRollbackWithSplits test now that the build issues have
been sorted out.
Bug: 127920549
Test: atest RollbackTest
Change-Id: I5bd70aea4f1ad0345d7a37e78c0f3b5ef0615ed1
Silence qualified user warning by using sendBroadcastAsUser.
The user is UserHandle.SYSTEM.
Limit recievers to those holding MANAGE_ROLLBACKS permission.
Test: warning does not appear in logcat when running atest RollbackTest
Fixes: 128280826
Change-Id: I85b905d2b20f3993859ec87948f309c1934a4a26
Added wait for ACTION_ROLLBACK_COMMITTED and also
minor RollbackTestUtils refactoring.
Test: atest RollbackTest
Bug: 126497394
Change-Id: Ia31b98974733ea19cd73c2688971ea853834e195
Per API council feedback, we are making changes to include only the
namespace in the system API defined in DeviceConfig.java. Strings which
define property names should be defined in code local to the feature
instead.
Bug: 126411407
Test: atest FrameworksCoreTests:DeviceConfigTest
atest FrameworksServicesTests:PackageManagerServiceTest
Change-Id: Ie3b0539f51a582fb7583ece88e5d3bde0cc1efd7
Only allow rollback to be enabled on the modules included in a mainline
update. We don't want to support rollbacks for all apks in general yet.
Enforce that only installers granted the MANAGE_ROLLBACKS permission can
enable rollback for a package.
Introduce a new TEST_MANAGE_ROLLBACKS permission that can be used to
enable rollback on packages that are not modules. This allows us to
continue testing rollbacks, given we can't do a mainline update as part
of the rollback tests.
Test: atest RollbackTest, with new tests for permissions added.
Bug: 128277794
Change-Id: I29ab9a750a1283592b8a855322ece516e42260ca
In addition, add some methods to RollbackTestUtils to make old code
reusable for the new test.
Bug: 124043688
Test: atest StagedRollbackTest
Change-Id: I2b259671861c4081f13922f03ea2e251568e06bc
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
Mark PackageInstaller.SessionParams#setEnableRollback() as @removed and
@deprecated.
Add PackageInstaller.SessionParams#setEnableRollback(enable).
Replace old API usages in RollbackTestUtils with the new API.
Also, add PackageInstaller.SessionInfo#getEnableRollback().
Fixes: 127282838
Test: atest RollbackTest
Change-Id: I696680207be5ac06560d2abb525f91a100301b4c
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
Test flow:
* Install app A with rollback enabled
* Wait half of the expiration time
* Install app B with rollback enabled
* Move time forward by expiration time
* Wait half of the expiration time
- At this point, an expiration check should run and expire app A
but not app B
* Assert app A rollback is expired
* Assert app B rollback is not expired
* Wait half of the expiration time
* Assert app B rollback is expired
Note: installing app A before app B is done solely to schedule an
expiration check before app B rollback has expired
Test: atest RollbackTest#testTimeChangeDoesNotAffectLifetime
Test: run the same test without the registering the time change handler
in RollbackManagerServiceImpl - test fails
Bug: 124095332
Change-Id: I4bc2d449e4195e059fa43e7568783683a60e2197
Add a test that checks whether the rollback data is expired after the
lifetime duration expires.
Since the default expiration time is 48 hours, the test first changes
the expiration time to a more reasonable (and testable) amount.
Flow:
* Change rollback lifetime duration to 30s
* Install v1 of an app
* Install v2 of an app (with rollback enabled)
* Check that package rollback is available
* Wait for the lifetime duration
* Check that package is not available for rollback
Test: atest RollbackTest
Test: atest RollbackTest#testRollbackExpiresAfterLifetime
Bug: 124096729
Change-Id: I4c6b3df14ed7b98b72d3c8a49a0dd5b2e864e2b2
Previously RollbackManager would only backup and restore the base apk
for a package. This change fixes it to backup and restore split apks as
well.
Adds a new test for rollback of packages built with splits.
Also, switch to using resources to distinguish between v1 and v2 of an
application instead of meta-data, given we use resources anyway now to
distinguish between split versions.
Bug: 124848643
Test: atest RollbackTest, with new test for splits added.
Change-Id: Id1f32db7b728bdeda6c7223bc69a7e80ba569dda
Also, throw an IllegalArgumentException is these APIs are called on
sessions that are not marked as staged.
Test: tested new apis with an ad-hoc app. atest RollbackTest
StagedRollbackTest
Fix: 124507718
Change-Id: I3529aaff404d644ab6dad98f29411141e8df865d
- snapshotAppData gets PackageRollbackInfo and updates pending backups
and inodes of CE user data snapshots;
- computePendingBackups/Restores is now merged into
commitPendingBackupAndRestoreForUser;
- essentially commitPendingBackupAndRestoreForUser now gets lists of
pending and recently executed rollbacks, computs what backups and
restores are pending and commits them.
Bug: 124029909
Test: RollbackTest, AppDataRollbackHelperTest
Change-Id: I5aecdfd47b535492165614ee7cf9676778e292ad
The new test tests rollback of a staged install involving a single apk.
Test: atest StagedRollbackTest
Bug: 124043688
Bug: 124221060
Bug: 124284714
Change-Id: Ie125d44c4d30d142ee32beac4c42e735a47ec71e
The test doesn't test anything meaningful yet, but it builds and runs.
Bug: 124043688
Test: atest StagedRollbackTest
Change-Id: If9b5d57e28846b0ba28a580b74a486bbedb8f8d5
In preparation for adding another subdirectory for a host-driven test of
staged rollbacks.
Bug: 124043688
Test: atest RollbackTest
Change-Id: I001427c7a659c2c934345e1dba1c421209accb6c
It appears that the device can be under high broadcast pressure and 5
seconds may not be a long enough wait to receive broadcast from test
app in instrumented app. We now remove the 5 seconds wait and rely on
test runner timeout to not wait forever.
Test: atest RollbackTest
Bug: 123886893 120598832
Change-Id: Ic686da15cfb64e5a84fb9f7c2795b94ef481d3bd
If3aaf8f2c454f45b9d79c9dae5a21d356e4cf029 prevented rolling back
packages that were not part of a mainline update. This made it
difficult to test and the auto PackageWatchdog test was ignored in the
meantime. We are now allowing non-mainling package rollbacks and
re-enabling the test.
I8dd7e6d1e144251830108c58f4a752c411d7295b introduced a refactoring bug
when rolling back packages, the module metadata provider was rolled
back instead. This was not caught because the test was ignored.
Test: atest RollbackTest
Bug: 120598832
Change-Id: I8fcc9492a05f0b3788ba4762ad3e3e5ac086d43b
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