summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mohammad Samiul Islam <samiul@google.com> 2019-09-18 20:32:35 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-09-18 20:32:35 +0000
commitcfe7b31c5b72f26ae145f471caf6ecad54c59478 (patch)
tree868945bc857578f50cc29ac3307b649e01707fa2
parent4c4650cb1bf0bfbef562ba75f052f3dbd7761fc0 (diff)
parent6dc9889f7e8ff8228c151663680dd2b4d8e639e5 (diff)
Merge "Pass sessionId instead of whole object during pre-reboot verification"
-rw-r--r--services/core/java/com/android/server/pm/StagingManager.java41
1 files changed, 25 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index 3482e92a6fbd..1cea4ca1b945 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -301,7 +301,7 @@ public class StagingManager {
// Greedily re-trigger the pre-reboot verification.
Slog.d(TAG, "Found pending staged session " + session.sessionId + " still to be "
+ "verified, resuming pre-reboot verification");
- mPreRebootVerificationHandler.startPreRebootVerification(session);
+ mPreRebootVerificationHandler.startPreRebootVerification(session.sessionId);
return;
}
if (!apexSessionInfo.isActivated && !apexSessionInfo.isSuccess) {
@@ -429,7 +429,7 @@ public class StagingManager {
return;
}
mPreRebootVerificationHandler.notifyPreRebootVerification_Apk_Complete(
- originalSession);
+ originalSession.sessionId);
});
apkSession.commit(receiver.getIntentSender(), false);
return;
@@ -526,7 +526,7 @@ public class StagingManager {
void commitSession(@NonNull PackageInstallerSession session) {
updateStoredSession(session);
- mPreRebootVerificationHandler.startPreRebootVerification(session);
+ mPreRebootVerificationHandler.startPreRebootVerification(session.sessionId);
}
@Nullable
@@ -653,7 +653,7 @@ public class StagingManager {
if (!session.isStagedSessionReady()) {
// The framework got restarted before the pre-reboot verification could complete,
// restart the verification.
- mPreRebootVerificationHandler.startPreRebootVerification(session);
+ mPreRebootVerificationHandler.startPreRebootVerification(session.sessionId);
} else {
// Session had already being marked ready. Start the checks to verify if there is any
// follow-up work.
@@ -737,7 +737,16 @@ public class StagingManager {
@Override
public void handleMessage(Message msg) {
- PackageInstallerSession session = (PackageInstallerSession) msg.obj;
+ final int sessionId = msg.arg1;
+ final PackageInstallerSession session;
+ synchronized (mStagedSessions) {
+ session = mStagedSessions.get(sessionId);
+ }
+ // Maybe session was aborted before pre-reboot verification was complete
+ if (session == null) {
+ Slog.d(TAG, "Stopping pre-reboot verification for sessionId: " + sessionId);
+ return;
+ }
switch (msg.what) {
case MSG_PRE_REBOOT_VERIFICATION_START:
handlePreRebootVerification_Start(session);
@@ -755,20 +764,20 @@ public class StagingManager {
}
// Method for starting the pre-reboot verification
- private void startPreRebootVerification(PackageInstallerSession session) {
- obtainMessage(MSG_PRE_REBOOT_VERIFICATION_START, session).sendToTarget();
+ private void startPreRebootVerification(int sessionId) {
+ obtainMessage(MSG_PRE_REBOOT_VERIFICATION_START, sessionId, 0).sendToTarget();
}
- private void notifyPreRebootVerification_Start_Complete(PackageInstallerSession session) {
- obtainMessage(MSG_PRE_REBOOT_VERIFICATION_APEX, session).sendToTarget();
+ private void notifyPreRebootVerification_Start_Complete(int sessionId) {
+ obtainMessage(MSG_PRE_REBOOT_VERIFICATION_APEX, sessionId, 0).sendToTarget();
}
- private void notifyPreRebootVerification_Apex_Complete(PackageInstallerSession session) {
- obtainMessage(MSG_PRE_REBOOT_VERIFICATION_APK, session).sendToTarget();
+ private void notifyPreRebootVerification_Apex_Complete(int sessionId) {
+ obtainMessage(MSG_PRE_REBOOT_VERIFICATION_APK, sessionId, 0).sendToTarget();
}
- private void notifyPreRebootVerification_Apk_Complete(PackageInstallerSession session) {
- obtainMessage(MSG_PRE_REBOOT_VERIFICATION_END, session).sendToTarget();
+ private void notifyPreRebootVerification_Apk_Complete(int sessionId) {
+ obtainMessage(MSG_PRE_REBOOT_VERIFICATION_END, sessionId, 0).sendToTarget();
}
/**
@@ -778,7 +787,7 @@ public class StagingManager {
*/
private void handlePreRebootVerification_Start(@NonNull PackageInstallerSession session) {
Slog.d(TAG, "Starting preRebootVerification for session " + session.sessionId);
- notifyPreRebootVerification_Start_Complete(session);
+ notifyPreRebootVerification_Start_Complete(session.sessionId);
}
/**
@@ -808,7 +817,7 @@ public class StagingManager {
}
}
- notifyPreRebootVerification_Apex_Complete(session);
+ notifyPreRebootVerification_Apex_Complete(session.sessionId);
}
/**
@@ -819,7 +828,7 @@ public class StagingManager {
*/
private void handlePreRebootVerification_Apk(@NonNull PackageInstallerSession session) {
if (!sessionContainsApk(session)) {
- notifyPreRebootVerification_Apk_Complete(session);
+ notifyPreRebootVerification_Apk_Complete(session.sessionId);
return;
}