Mark boot completion via apexservice

Use the StagingManager lifecycle class to call into ApexManager
when the boot completed broadcast is received. ApexManager will
then call into apexservice to inform apexd of the boot completion,
instead of apexd relying on the sys.boot_completed property.

Test: atest StagedInstallTest
Test: atest ApexRollbackTests
Bug: 158467962
Change-Id: Ibcb4cb784243530eb2cf8c2633651342e8115d14
Merged-In: Ibcb4cb784243530eb2cf8c2633651342e8115d14
(cherry picked from commit 221f3ec59c)
This commit is contained in:
Gavin Corkery
2020-06-15 14:28:14 +01:00
parent 9a4505c4fb
commit 0037e9c816
2 changed files with 24 additions and 0 deletions

View File

@@ -351,6 +351,11 @@ public abstract class ApexManager {
*/
public abstract boolean destroyCeSnapshotsNotSpecified(int userId, int[] retainRollbackIds);
/**
* Inform apexd that the boot has completed.
*/
public abstract void markBootCompleted();
/**
* Dumps various state information to the provided {@link PrintWriter} object.
*
@@ -883,6 +888,15 @@ public abstract class ApexManager {
}
}
@Override
public void markBootCompleted() {
try {
waitForApexService().markBootCompleted();
} catch (RemoteException re) {
Slog.e(TAG, "Unable to contact apexservice", re);
}
}
/**
* Dump information about the packages contained in a particular cache
* @param packagesCache the cache to print information about.
@@ -1129,6 +1143,11 @@ public abstract class ApexManager {
return true;
}
@Override
public void markBootCompleted() {
// No-op
}
@Override
void dump(PrintWriter pw, String packageName) {
// No-op

View File

@@ -164,6 +164,7 @@ public class StagingManager {
public void onBootPhase(int phase) {
if (phase == SystemService.PHASE_BOOT_COMPLETED && sStagingManager != null) {
sStagingManager.markStagedSessionsAsSuccessful();
sStagingManager.markBootCompleted();
}
}
}
@@ -179,6 +180,10 @@ public class StagingManager {
}
}
private void markBootCompleted() {
mApexManager.markBootCompleted();
}
/**
* Validates the signature used to sign the container of the new apex package
*