Loading services/core/java/com/android/server/pm/PackageInstallerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -589,7 +589,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements session = new PackageInstallerSession(mInternalCallback, mContext, mPm, this, mInstallThread.getLooper(), mStagingManager, sessionId, userId, installerPackageName, callingUid, params, createdMillis, stageDir, stageCid, false, false, null, SessionInfo.INVALID_ID, false, false, false, false, false, null, SessionInfo.INVALID_ID, false, false, false, SessionInfo.STAGED_SESSION_NO_ERROR, ""); synchronized (mSessions) { Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +8 −3 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { private static final String ATTR_SESSION_STAGE_DIR = "sessionStageDir"; private static final String ATTR_SESSION_STAGE_CID = "sessionStageCid"; private static final String ATTR_PREPARED = "prepared"; private static final String ATTR_COMMITTED = "committed"; private static final String ATTR_SEALED = "sealed"; private static final String ATTR_MULTI_PACKAGE = "multiPackage"; private static final String ATTR_PARENT_SESSION_ID = "parentSessionId"; Loading Loading @@ -401,7 +402,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { PackageSessionProvider sessionProvider, Looper looper, StagingManager stagingManager, int sessionId, int userId, String installerPackageName, int installerUid, SessionParams params, long createdMillis, File stageDir, String stageCid, boolean prepared, boolean sealed, File stageDir, String stageCid, boolean prepared, boolean committed, boolean sealed, @Nullable int[] childSessionIds, int parentSessionId, boolean isReady, boolean isFailed, boolean isApplied, int stagedSessionErrorCode, String stagedSessionErrorMessage) { Loading Loading @@ -434,6 +435,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } mPrepared = prepared; mCommitted = committed; mStagedSessionReady = isReady; mStagedSessionFailed = isFailed; mStagedSessionApplied = isApplied; Loading Loading @@ -2156,6 +2158,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { pw.printPair("mClientProgress", mClientProgress); pw.printPair("mProgress", mProgress); pw.printPair("mCommitted", mCommitted); pw.printPair("mSealed", mSealed); pw.printPair("mPermissionsManuallyAccepted", mPermissionsManuallyAccepted); pw.printPair("mRelinquished", mRelinquished); Loading Loading @@ -2214,6 +2217,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { writeStringAttribute(out, ATTR_SESSION_STAGE_CID, stageCid); } writeBooleanAttribute(out, ATTR_PREPARED, isPrepared()); writeBooleanAttribute(out, ATTR_COMMITTED, isCommitted()); writeBooleanAttribute(out, ATTR_SEALED, isSealed()); writeBooleanAttribute(out, ATTR_MULTI_PACKAGE, params.isMultiPackage); Loading Loading @@ -2311,6 +2315,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { final File stageDir = (stageDirRaw != null) ? new File(stageDirRaw) : null; final String stageCid = readStringAttribute(in, ATTR_SESSION_STAGE_CID); final boolean prepared = readBooleanAttribute(in, ATTR_PREPARED, true); final boolean committed = readBooleanAttribute(in, ATTR_COMMITTED); final boolean sealed = readBooleanAttribute(in, ATTR_SEALED); final int parentSessionId = readIntAttribute(in, ATTR_PARENT_SESSION_ID, SessionInfo.INVALID_ID); Loading Loading @@ -2387,8 +2392,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { return new PackageInstallerSession(callback, context, pm, sessionProvider, installerThread, stagingManager, sessionId, userId, installerPackageName, installerUid, params, createdMillis, stageDir, stageCid, prepared, sealed, childSessionIdsArray, parentSessionId, isReady, isFailed, isApplied, installerUid, params, createdMillis, stageDir, stageCid, prepared, committed, sealed, childSessionIdsArray, parentSessionId, isReady, isFailed, isApplied, stagedSessionErrorCode, stagedSessionErrorMessage); } Loading services/core/java/com/android/server/pm/StagingManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -603,6 +603,10 @@ public class StagingManager { } private void checkStateAndResume(@NonNull PackageInstallerSession session) { if (!session.isCommitted()) { // Session hasn't been committed yet, ignore. return; } // Check the state of the session and decide what to do next. if (session.isStagedSessionFailed() || session.isStagedSessionApplied()) { // Final states, nothing to do. Loading services/tests/servicestests/src/com/android/server/pm/PackageInstallerSessionTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ public class PackageInstallerSessionTest { /* stageDir */ mTmpDir, /* stageCid */ null, /* prepared */ true, /* committed */ true, /* sealed */ false, // Setting to true would trigger some PM logic. /* childSessionIds */ childSessionIds != null ? childSessionIds : new int[0], /* parentSessionId */ parentSessionId, Loading Loading @@ -300,6 +301,7 @@ public class PackageInstallerSessionTest { assertEquals(expected.getStagedSessionErrorMessage(), actual.getStagedSessionErrorMessage()); assertEquals(expected.isPrepared(), actual.isPrepared()); assertEquals(expected.isCommitted(), actual.isCommitted()); assertEquals(expected.isSealed(), actual.isSealed()); assertEquals(expected.isMultiPackage(), actual.isMultiPackage()); assertEquals(expected.hasParentSessionId(), actual.hasParentSessionId()); Loading Loading
services/core/java/com/android/server/pm/PackageInstallerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -589,7 +589,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements session = new PackageInstallerSession(mInternalCallback, mContext, mPm, this, mInstallThread.getLooper(), mStagingManager, sessionId, userId, installerPackageName, callingUid, params, createdMillis, stageDir, stageCid, false, false, null, SessionInfo.INVALID_ID, false, false, false, false, false, null, SessionInfo.INVALID_ID, false, false, false, SessionInfo.STAGED_SESSION_NO_ERROR, ""); synchronized (mSessions) { Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +8 −3 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { private static final String ATTR_SESSION_STAGE_DIR = "sessionStageDir"; private static final String ATTR_SESSION_STAGE_CID = "sessionStageCid"; private static final String ATTR_PREPARED = "prepared"; private static final String ATTR_COMMITTED = "committed"; private static final String ATTR_SEALED = "sealed"; private static final String ATTR_MULTI_PACKAGE = "multiPackage"; private static final String ATTR_PARENT_SESSION_ID = "parentSessionId"; Loading Loading @@ -401,7 +402,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { PackageSessionProvider sessionProvider, Looper looper, StagingManager stagingManager, int sessionId, int userId, String installerPackageName, int installerUid, SessionParams params, long createdMillis, File stageDir, String stageCid, boolean prepared, boolean sealed, File stageDir, String stageCid, boolean prepared, boolean committed, boolean sealed, @Nullable int[] childSessionIds, int parentSessionId, boolean isReady, boolean isFailed, boolean isApplied, int stagedSessionErrorCode, String stagedSessionErrorMessage) { Loading Loading @@ -434,6 +435,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } mPrepared = prepared; mCommitted = committed; mStagedSessionReady = isReady; mStagedSessionFailed = isFailed; mStagedSessionApplied = isApplied; Loading Loading @@ -2156,6 +2158,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { pw.printPair("mClientProgress", mClientProgress); pw.printPair("mProgress", mProgress); pw.printPair("mCommitted", mCommitted); pw.printPair("mSealed", mSealed); pw.printPair("mPermissionsManuallyAccepted", mPermissionsManuallyAccepted); pw.printPair("mRelinquished", mRelinquished); Loading Loading @@ -2214,6 +2217,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { writeStringAttribute(out, ATTR_SESSION_STAGE_CID, stageCid); } writeBooleanAttribute(out, ATTR_PREPARED, isPrepared()); writeBooleanAttribute(out, ATTR_COMMITTED, isCommitted()); writeBooleanAttribute(out, ATTR_SEALED, isSealed()); writeBooleanAttribute(out, ATTR_MULTI_PACKAGE, params.isMultiPackage); Loading Loading @@ -2311,6 +2315,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { final File stageDir = (stageDirRaw != null) ? new File(stageDirRaw) : null; final String stageCid = readStringAttribute(in, ATTR_SESSION_STAGE_CID); final boolean prepared = readBooleanAttribute(in, ATTR_PREPARED, true); final boolean committed = readBooleanAttribute(in, ATTR_COMMITTED); final boolean sealed = readBooleanAttribute(in, ATTR_SEALED); final int parentSessionId = readIntAttribute(in, ATTR_PARENT_SESSION_ID, SessionInfo.INVALID_ID); Loading Loading @@ -2387,8 +2392,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { return new PackageInstallerSession(callback, context, pm, sessionProvider, installerThread, stagingManager, sessionId, userId, installerPackageName, installerUid, params, createdMillis, stageDir, stageCid, prepared, sealed, childSessionIdsArray, parentSessionId, isReady, isFailed, isApplied, installerUid, params, createdMillis, stageDir, stageCid, prepared, committed, sealed, childSessionIdsArray, parentSessionId, isReady, isFailed, isApplied, stagedSessionErrorCode, stagedSessionErrorMessage); } Loading
services/core/java/com/android/server/pm/StagingManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -603,6 +603,10 @@ public class StagingManager { } private void checkStateAndResume(@NonNull PackageInstallerSession session) { if (!session.isCommitted()) { // Session hasn't been committed yet, ignore. return; } // Check the state of the session and decide what to do next. if (session.isStagedSessionFailed() || session.isStagedSessionApplied()) { // Final states, nothing to do. Loading
services/tests/servicestests/src/com/android/server/pm/PackageInstallerSessionTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ public class PackageInstallerSessionTest { /* stageDir */ mTmpDir, /* stageCid */ null, /* prepared */ true, /* committed */ true, /* sealed */ false, // Setting to true would trigger some PM logic. /* childSessionIds */ childSessionIds != null ? childSessionIds : new int[0], /* parentSessionId */ parentSessionId, Loading Loading @@ -300,6 +301,7 @@ public class PackageInstallerSessionTest { assertEquals(expected.getStagedSessionErrorMessage(), actual.getStagedSessionErrorMessage()); assertEquals(expected.isPrepared(), actual.isPrepared()); assertEquals(expected.isCommitted(), actual.isCommitted()); assertEquals(expected.isSealed(), actual.isSealed()); assertEquals(expected.isMultiPackage(), actual.isMultiPackage()); assertEquals(expected.hasParentSessionId(), actual.hasParentSessionId()); Loading