Allow overriding compat config prior to install time.

If the user tries to apply an override for a package that is not yet
installed, the override is put into a 'deferred' bucket, to be validated
upon installation.
Overrides are rechecked every time an app is installed, updated or
deleted.
If a deferred override is valid at install or update time, it gets
promoted to a regular override.
If a deferred override cannot be applied upon app installation or
update, it remains deferred.
If an app is deleted, all its overrides become deferred.
When any of the reset commands are called for a given package, that
removes both regular and deferred overrides.

Bug: 158696818
Test: atest CompatConfigTest
Test: atest OverrideValidatorImplTest
Change-Id: I50eab62214d1325ec6185ddcfe9e8f425e11c98b
This commit is contained in:
Andrei Onea
2020-11-24 23:54:04 +00:00
parent 771aa062b9
commit 224f8c01d7
8 changed files with 286 additions and 46 deletions

View File

@@ -910,6 +910,9 @@ public final class SystemServer {
mActivityManagerService.setSystemProcess();
t.traceEnd();
// The package receiver depends on the activity service in order to get registered.
platformCompat.registerPackageReceiver(mSystemContext);
// Complete the watchdog setup with an ActivityManager instance and listen for reboots
// Do this only after the ActivityManagerService is properly started as a system process
t.traceBegin("InitWatchdog");