Commit Graph

20 Commits

Author SHA1 Message Date
Richard Uhler
2a48c29cb6 Specify status results for RollbackManager.commitRollback.
Rather than implicitly reusing the PackageInstaller status codes.

Bug: 112431924
Test: atest RollbackTest
Change-Id: I86929c0c1a5153c7f58e255e104b30fe96ddeca8
2019-01-29 13:35:56 +00:00
Richard Uhler
bf5b5c4461 Add a way to record causePackages for rollbacks.
By passing a new causePackages list of VersionedPackage to
commitRollback and adding a RollbackInfo.getCausePackages() method to
retrieve the cause packages for committed rollbacks.

Bug: 112431924
Test: atest RollbackTest
Change-Id: I3b52511fd7e31b6304e7a7c34180dbb4d20f6dbf
2019-01-29 09:20:19 +00:00
Richard Uhler
e87368e1fd Commit rollbacks by ID, not by RollbackInfo.
To make it clear that the system only pays attention to the provided
rollback ID when committing a rollback.

Also, rename executeRollback to commitRollback in IRollbackManager.aidl,
now that we are touching the code anyway.

Bug: 112431924
Test: atest RollbackTest
Change-Id: I315e75c39019536fb2f090a0c84ed4cf7c03ce8c
2019-01-28 12:39:05 +00:00
Richard Uhler
4b092ef6f7 Use "commit" instead of "execute" for rollbacks.
Which makes more sense for rollback of staged installs, where the caller
will have to reboot the device before the rollback takes effect.

Internal references to "execute" in IRollbackManager.aidl and the
rollback manager service implementation will be renamed in a follow up
CL.

Bug: 112431924
Test: atest RollbackTest
Change-Id: Ic2bb479873b309fc145e4eda3b347849ac219ac9
2019-01-25 14:56:02 +00:00
Richard Uhler
dca7beb740 Rename PACKAGE_ROLLBACK_EXECUTED to ROLLBACK_COMMITTED.
Because there's no need to distinguish between package and other kinds
of rollbacks, and for rollback of staged installs, committed is a more
appropriate name than executed.

Bug: 112431924
Test: atest RollbackTest
Change-Id: I2a409de29ba82a7a3df2fd0b17f939795caa61d5
2019-01-25 14:23:27 +00:00
Richard Uhler
beb7e38f39 Use RollbackManager.getAvailableRollbacks in RollbackTest
Instead of getAvailableRollback and getPackagesWithAvailableRollbacks,
which are soon to be removed.

Bug: 112431924
Test: atest RollbackTest
Change-Id: Ia69342a41bebb91a9fa8044ef8d8b495aba7187f
2019-01-25 14:23:26 +00:00
Richard Uhler
0a79b32332 Include all relevant packages in RollbackInfo.
Instead of a single target package. Needed for rollback of multiPackage
installs.

Additionally, expose this information by a public method rather than a
public field.

Bug: 112431924
Test: atest RollbackTest
Change-Id: I6e3ce87385abd37c48047db27bc443d3719ee023
2019-01-25 10:19:31 +00:00
Zimuzo
c4073cc206 Add RollbackPackageHealthObserver
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
2019-01-24 15:07:35 +00:00
Richard Uhler
f8f1b38fd1 Remove package name from ROLLBACK_EXECUTED broadcast.
The receiver of the broadcast would likely want to query the rolled back
packages via RollbackManager regardless, and it's not clear which
package to put when an atomic set of packages is rolled back.

Bug: 112431924
Test: atest RollbackTest
Change-Id: Ic8db00b62d8993e00a0dd2cb79ae68c430b45bb8
2019-01-23 13:22:44 +00:00
Richard Uhler
a7e9b2db4b Use VersionedPackage in PackageRollbackInfo.
Rather than defining a new custom PackageRollbackInfo.PackageVersion
type.

Also clean up PackageRollbackInfo API by replacing public fields with
methods and picking better names.

Bug: 112431924
Test: atest RollbackTest
Change-Id: I68a91e07b8745df9c5ecb22fdccbfcd76385814a
2019-01-23 11:02:56 +00:00
Narayan Kamath
869f706d86 RollbackManager: Support userdata snapshot / restore.
The only significant missing piece of functionality is the
handling of credential encrypted data in the case where one
or more users haven't unlocked their device. This will be handled
in a follow-up change.

Bug: 112431924
Test: atest RollbackTest
Change-Id: I4582018337ce0344379f6f73d6fd6c9ce31c58a0
2019-01-22 17:00:13 +00:00
Richard Uhler
31bc9606dd Improve test coverage of rollback data persistence.
Tests that we properly persist data about multiple available rollbacks
and available multi-package rollbacks.

Test: atest RollbackTest
Bug: 112431924
Change-Id: Ib31a0388e6420a942fac00f27fef33c0a866ea0b
2019-01-17 09:30:50 +00:00
Richard Uhler
f1910c5aa5 Add support for rollback of multiPackage installs.
The RollbackManager APIs still need to be updated to expose information
about dependant rollbacks.

Test: atest RollbackTest, with multiPackage test now enabled.
Bug: 112431924
Change-Id: Ib05902aa2bc8b8e228ad6faf3d9418190c5bc946
2019-01-11 10:43:18 +00:00
Richard Uhler
2d7c7f0d68 Make rollbacks available only after session commit.
In preparation for supporting rollback of multi-package installs, where
we need to use the SessionInfo to determine what the multi-package
install sets are.

Expire rollbacks relative to when they were committed, not when they
were first enabled.

Test: atest RollbackTest
Bug: 112431924

Change-Id: Ia8795813157ede3c1c5c5429d7b711db88c3e91a
2019-01-11 09:41:15 +00:00
Richard Uhler
95bfe2f94b Add TEST_MAPPING for RollbackManagerService.
Test: atest, run from the rollback and RollbackTest directories.
Bug: 112431924
Change-Id: Ia57536a84461fcdabe6ff9a7ff3ba6f8c14be238
2019-01-07 10:35:35 +00:00
Richard Uhler
de7907a505 Add test for multi-package rollback.
The test is marked @Ignore for now because we don't yet properly support
rollback of multi-package installs.

Test: atest RollbackTest (with selinux disabled).
Test: atest RollbackTest fails without the @Ignore.
Bug: 112431924

Change-Id: Ia76d48756bc1078344dcf1f2c5696ab79eb0c40c
2019-01-03 09:16:54 +00:00
Richard Uhler
04e84e0ee9 Fix bug where RollbackManagerService ignores package name.
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
2019-01-03 09:16:44 +00:00
Richard Uhler
1f67242cd9 Add test for user data rollback.
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
2019-01-03 09:14:52 +00:00
Richard Uhler
c739c8c3f9 Make RollbackManager @SystemApi.
Require callers hold a new MANAGE_ROLLBACKS permission to interact with
the RollbackManager.

Bug: 112431924
Test: atest RollbackTest, with new test for permissions added,
      and with selinux in permissive mode.
Test: atest CtsPermission2TestCases:PermissionPolicyTest
Change-Id: I73f4f3457d85be580670cd69c89066d2cc348186
2019-01-02 09:19:45 +00:00
Richard Uhler
b29f145505 Add RollbackManagerService
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
2018-12-31 12:38:07 +00:00