Loading core/java/android/content/pm/PackageInstaller.java +5 −2 Original line number Diff line number Diff line Loading @@ -1356,7 +1356,9 @@ public class PackageInstaller { * Completely abandon this session, destroying all staged data and * rendering it invalid. Abandoned sessions will be reported to * {@link SessionCallback} listeners as failures. This is equivalent to * opening the session and calling {@link Session#abandon()}. * {@link #abandonSession(int)}. * <p>If the parent is abandoned, all children will also be abandoned. Any written data * would be destroyed and the created {@link Session} information will be discarded.</p> */ public void abandon() { try { Loading Loading @@ -1419,7 +1421,8 @@ public class PackageInstaller { * when this session is committed. * * <p>If the parent is staged or has rollback enabled, all children must have * the same properties. * the same properties.</p> * <p>If the parent is abandoned, all children will also be abandoned.</p> * * @param sessionId the session ID to add to this multi-package session. */ Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +27 −0 Original line number Diff line number Diff line Loading @@ -3058,6 +3058,31 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } } /** * Cleans up the relevant stored files and information of all child sessions. * <p>Cleaning up the stored files and session information is necessary for * preventing the orphan children sessions. * <ol> * <li>To call {@link #destroyInternal()} cleans up the stored files.</li> * <li>To call {@link #dispatchSessionFinished(int, String, Bundle)} to trigger the * procedure to clean up the information in PackageInstallerService.</li> * </ol></p> */ private void maybeCleanUpChildSessions() { if (!isMultiPackage()) { return; } final List<PackageInstallerSession> childSessions = getChildSessions(); final int size = childSessions.size(); for (int i = 0; i < size; ++i) { final PackageInstallerSession session = childSessions.get(i); session.destroyInternal(); session.dispatchSessionFinished(INSTALL_FAILED_ABORTED, "Session was abandoned" + " because the parent session is abandoned", null); } } private void abandonNonStaged() { synchronized (mLock) { assertCallerIsOwnerOrRootLocked(); Loading @@ -3068,6 +3093,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { destroyInternal(); } dispatchSessionFinished(INSTALL_FAILED_ABORTED, "Session was abandoned", null); maybeCleanUpChildSessions(); } private void abandonStaged() { Loading @@ -3092,6 +3118,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { cleanStageDir(childSessions); destroyInternal(); dispatchSessionFinished(INSTALL_FAILED_ABORTED, "Session was abandoned", null); maybeCleanUpChildSessions(); }; if (mInPreRebootVerification) { // Pre-reboot verification is ongoing. It is not safe to clean up the session yet. Loading Loading
core/java/android/content/pm/PackageInstaller.java +5 −2 Original line number Diff line number Diff line Loading @@ -1356,7 +1356,9 @@ public class PackageInstaller { * Completely abandon this session, destroying all staged data and * rendering it invalid. Abandoned sessions will be reported to * {@link SessionCallback} listeners as failures. This is equivalent to * opening the session and calling {@link Session#abandon()}. * {@link #abandonSession(int)}. * <p>If the parent is abandoned, all children will also be abandoned. Any written data * would be destroyed and the created {@link Session} information will be discarded.</p> */ public void abandon() { try { Loading Loading @@ -1419,7 +1421,8 @@ public class PackageInstaller { * when this session is committed. * * <p>If the parent is staged or has rollback enabled, all children must have * the same properties. * the same properties.</p> * <p>If the parent is abandoned, all children will also be abandoned.</p> * * @param sessionId the session ID to add to this multi-package session. */ Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +27 −0 Original line number Diff line number Diff line Loading @@ -3058,6 +3058,31 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } } /** * Cleans up the relevant stored files and information of all child sessions. * <p>Cleaning up the stored files and session information is necessary for * preventing the orphan children sessions. * <ol> * <li>To call {@link #destroyInternal()} cleans up the stored files.</li> * <li>To call {@link #dispatchSessionFinished(int, String, Bundle)} to trigger the * procedure to clean up the information in PackageInstallerService.</li> * </ol></p> */ private void maybeCleanUpChildSessions() { if (!isMultiPackage()) { return; } final List<PackageInstallerSession> childSessions = getChildSessions(); final int size = childSessions.size(); for (int i = 0; i < size; ++i) { final PackageInstallerSession session = childSessions.get(i); session.destroyInternal(); session.dispatchSessionFinished(INSTALL_FAILED_ABORTED, "Session was abandoned" + " because the parent session is abandoned", null); } } private void abandonNonStaged() { synchronized (mLock) { assertCallerIsOwnerOrRootLocked(); Loading @@ -3068,6 +3093,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { destroyInternal(); } dispatchSessionFinished(INSTALL_FAILED_ABORTED, "Session was abandoned", null); maybeCleanUpChildSessions(); } private void abandonStaged() { Loading @@ -3092,6 +3118,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { cleanStageDir(childSessions); destroyInternal(); dispatchSessionFinished(INSTALL_FAILED_ABORTED, "Session was abandoned", null); maybeCleanUpChildSessions(); }; if (mInPreRebootVerification) { // Pre-reboot verification is ongoing. It is not safe to clean up the session yet. Loading