Loading services/core/java/com/android/server/pm/ApexManager.java +22 −1 Original line number Diff line number Diff line Loading @@ -166,6 +166,27 @@ class ApexManager { } } /** * Marks a staged session as successful. * * <p>Only activated session can be marked as successful. * * @param sessionId the identifier of the {@link PackageInstallerSession} being marked as * successful. */ void markStagedSessionSuccessful(int sessionId) { try { mApexService.markStagedSessionSuccessful(sessionId); } catch (RemoteException re) { Slog.e(TAG, "Unable to contact apexservice", re); throw new RuntimeException(re); } catch (Exception e) { // It is fine to just log an exception in this case. APEXd will be able to recover in // case markStagedSessionSuccessful fails. Slog.e(TAG, "Failed to mark session " + sessionId + " as successful", e); } } /** * Dumps various state information to the provided {@link PrintWriter} object. * Loading Loading @@ -196,7 +217,7 @@ class ApexManager { ipw.increaseIndent(); final ApexSessionInfo[] sessions = mApexService.getSessions(); for (ApexSessionInfo si : sessions) { ipw.println("Session ID: " + Integer.toString(si.sessionId)); ipw.println("Session ID: " + si.sessionId); ipw.increaseIndent(); if (si.isUnknown) { ipw.println("State: UNKNOWN"); Loading services/core/java/com/android/server/pm/StagingManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -247,7 +247,8 @@ public class StagingManager { } private void resumeSession(@NonNull PackageInstallerSession session) { if (sessionContainsApex(session)) { boolean hasApex = sessionContainsApex(session); if (hasApex) { // Check with apexservice whether the apex packages have been activated. ApexSessionInfo apexSessionInfo = mApexManager.getStagedSessionInfo(session.sessionId); if (apexSessionInfo == null) { Loading @@ -271,7 +272,7 @@ public class StagingManager { mBgHandler.post(() -> preRebootVerification(session)); return; } if (!apexSessionInfo.isActivated) { if (!apexSessionInfo.isActivated && !apexSessionInfo.isSuccess) { // In all the remaining cases apexd will try to apply the session again at next // boot. Nothing to do here for now. Slog.w(TAG, "Staged session " + session.sessionId + " scheduled to be applied " Loading @@ -287,7 +288,11 @@ public class StagingManager { + "more information."); return; } session.setStagedSessionApplied(); if (hasApex) { mApexManager.markStagedSessionSuccessful(session.sessionId); } } private String findFirstAPKInDir(File stageDir) { Loading Loading
services/core/java/com/android/server/pm/ApexManager.java +22 −1 Original line number Diff line number Diff line Loading @@ -166,6 +166,27 @@ class ApexManager { } } /** * Marks a staged session as successful. * * <p>Only activated session can be marked as successful. * * @param sessionId the identifier of the {@link PackageInstallerSession} being marked as * successful. */ void markStagedSessionSuccessful(int sessionId) { try { mApexService.markStagedSessionSuccessful(sessionId); } catch (RemoteException re) { Slog.e(TAG, "Unable to contact apexservice", re); throw new RuntimeException(re); } catch (Exception e) { // It is fine to just log an exception in this case. APEXd will be able to recover in // case markStagedSessionSuccessful fails. Slog.e(TAG, "Failed to mark session " + sessionId + " as successful", e); } } /** * Dumps various state information to the provided {@link PrintWriter} object. * Loading Loading @@ -196,7 +217,7 @@ class ApexManager { ipw.increaseIndent(); final ApexSessionInfo[] sessions = mApexService.getSessions(); for (ApexSessionInfo si : sessions) { ipw.println("Session ID: " + Integer.toString(si.sessionId)); ipw.println("Session ID: " + si.sessionId); ipw.increaseIndent(); if (si.isUnknown) { ipw.println("State: UNKNOWN"); Loading
services/core/java/com/android/server/pm/StagingManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -247,7 +247,8 @@ public class StagingManager { } private void resumeSession(@NonNull PackageInstallerSession session) { if (sessionContainsApex(session)) { boolean hasApex = sessionContainsApex(session); if (hasApex) { // Check with apexservice whether the apex packages have been activated. ApexSessionInfo apexSessionInfo = mApexManager.getStagedSessionInfo(session.sessionId); if (apexSessionInfo == null) { Loading @@ -271,7 +272,7 @@ public class StagingManager { mBgHandler.post(() -> preRebootVerification(session)); return; } if (!apexSessionInfo.isActivated) { if (!apexSessionInfo.isActivated && !apexSessionInfo.isSuccess) { // In all the remaining cases apexd will try to apply the session again at next // boot. Nothing to do here for now. Slog.w(TAG, "Staged session " + session.sessionId + " scheduled to be applied " Loading @@ -287,7 +288,11 @@ public class StagingManager { + "more information."); return; } session.setStagedSessionApplied(); if (hasApex) { mApexManager.markStagedSessionSuccessful(session.sessionId); } } private String findFirstAPKInDir(File stageDir) { Loading