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
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
Checkstyle wants all public methods to have javadocs. Rather than add
javadocs for this method, mark it private, which is more appropriate.
Bug: 112431924
Test: atest RollbackTest
Change-Id: I438d16b0e4164482ba5f6527aecd50c65ce41418
1. RollbackManager was instantiated by Context#getSystemService in
RollbackHealthObserver. At this time, RollbackManager has not yet
been published as a service to the system, so RollbackManager was null.
We now #getSystemService lazily so RollbackManager is never null.
2. Pass causePackages from RollbackHealthObserver to RollbackManager
3. Also fixed flaky ignored test exercising PackageWatchdog auto rollback
Test: atest RollbackTest
Bug: 123615508 112431924
Change-Id: I8f15c257b1efd96a96656405d3d7f74576a32c8e
With the help of PackageWatchdog, RollbackPackageHealthObserver will
monitor packages after enabling rollbacks and will execute the rollback
automatically if it detects frequent crashes.
Test: atest RollbackTest
Bug: 112431924
Change-Id: Ic85464583f7c6b0778d853a87670d250a42c33de
RollbackManagerService incorrectly ignores the package name passed to
getAvailableRollback and executeRollback.
This CL fixes the bug and adds a regression test. The infrastructure for
having multiple test apps in RollbackTest will also be useful for
testing rollback of multi-package installs.
Test: atest RollbackTest (with selinux disabled)
Bug: 112431924
Change-Id: I84c8fdeb97aba557a1f8fd2e71a2bb0d87b10636
The test is currently marked @Ignore because we haven't implemented
support for user data rollback yet.
Test: atest RollbackTest (selinux disabled)
Test: atest RollbackTest fails without the @Ignore.
Bug: 112431924
Change-Id: I3f7906001c932969bdf2125d198f379bf35a99fb
This change adds RollbackManagerService as a new system service for
managing apk level rollbacks.
To work properly this requires additional selinux policy changes. Fails
gracefully in case of selinux denials, until we have a chance to sort
out the proper selinux policy.
Bug: 112431924
Bug: 116512606
Test: atest RollbackTest, with selinux enforcement off.
Test: atest CtsPermission2TestCases:PermissionPolicyTest
Change-Id: Id72aae9c4d8da9aaab3922ec9233ba335bc0198f