Loading services/core/java/com/android/server/pm/ApexManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,21 @@ class ApexManager { return !mActivePackagesCache.isEmpty(); } /** * Abandons the (only) active session previously submitted. * * @return {@code true} upon success, {@code false} if any remote exception occurs */ boolean abortActiveSession() { try { mApexService.abortActiveSession(); return true; } catch (RemoteException re) { Slog.e(TAG, "Unable to contact apexservice", re); return false; } } /** * Dumps various state information to the provided {@link PrintWriter} object. * Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +9 −0 Original line number Diff line number Diff line Loading @@ -1867,6 +1867,15 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { synchronized (mLock) { assertCallerIsOwnerOrRootLocked(); if (mCommitted && params.isStaged) { synchronized (mLock) { mDestroyed = true; } mStagingManager.abortCommittedSession(this); //TODO(b/123624108): delete staging dir } if (mRelinquished) { Slog.d(TAG, "Ignoring abandon after commit relinquished control"); return; Loading services/core/java/com/android/server/pm/StagingManager.java +22 −1 Original line number Diff line number Diff line Loading @@ -445,11 +445,32 @@ public class StagingManager { void abortSession(@NonNull PackageInstallerSession session) { synchronized (mStagedSessions) { updateStoredSession(session); mStagedSessions.remove(session.sessionId); } } void abortCommittedSession(@NonNull PackageInstallerSession session) { if (session.isStagedSessionApplied()) { Slog.w(TAG, "Cannot abort applied session!"); return; } if (isStagedSessionFinalized(session.sessionId)) { Slog.w(TAG, "Cannot abort session because it is not active or APEXD is not reachable"); return; } mApexManager.abortActiveSession(); abortSession(session); } private boolean isStagedSessionFinalized(int sessionId) { ApexSessionInfo session = mApexManager.getStagedSessionInfo(sessionId); /* checking if the session is in a final state, i.e., not active anymore */ return session.isUnknown || session.isActivationFailed || session.isSuccess; } @GuardedBy("mStagedSessions") private boolean isMultiPackageSessionComplete(@NonNull PackageInstallerSession session) { // This method assumes that the argument is either a parent session of a multi-package Loading Loading
services/core/java/com/android/server/pm/ApexManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,21 @@ class ApexManager { return !mActivePackagesCache.isEmpty(); } /** * Abandons the (only) active session previously submitted. * * @return {@code true} upon success, {@code false} if any remote exception occurs */ boolean abortActiveSession() { try { mApexService.abortActiveSession(); return true; } catch (RemoteException re) { Slog.e(TAG, "Unable to contact apexservice", re); return false; } } /** * Dumps various state information to the provided {@link PrintWriter} object. * Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +9 −0 Original line number Diff line number Diff line Loading @@ -1867,6 +1867,15 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { synchronized (mLock) { assertCallerIsOwnerOrRootLocked(); if (mCommitted && params.isStaged) { synchronized (mLock) { mDestroyed = true; } mStagingManager.abortCommittedSession(this); //TODO(b/123624108): delete staging dir } if (mRelinquished) { Slog.d(TAG, "Ignoring abandon after commit relinquished control"); return; Loading
services/core/java/com/android/server/pm/StagingManager.java +22 −1 Original line number Diff line number Diff line Loading @@ -445,11 +445,32 @@ public class StagingManager { void abortSession(@NonNull PackageInstallerSession session) { synchronized (mStagedSessions) { updateStoredSession(session); mStagedSessions.remove(session.sessionId); } } void abortCommittedSession(@NonNull PackageInstallerSession session) { if (session.isStagedSessionApplied()) { Slog.w(TAG, "Cannot abort applied session!"); return; } if (isStagedSessionFinalized(session.sessionId)) { Slog.w(TAG, "Cannot abort session because it is not active or APEXD is not reachable"); return; } mApexManager.abortActiveSession(); abortSession(session); } private boolean isStagedSessionFinalized(int sessionId) { ApexSessionInfo session = mApexManager.getStagedSessionInfo(sessionId); /* checking if the session is in a final state, i.e., not active anymore */ return session.isUnknown || session.isActivationFailed || session.isSuccess; } @GuardedBy("mStagedSessions") private boolean isMultiPackageSessionComplete(@NonNull PackageInstallerSession session) { // This method assumes that the argument is either a parent session of a multi-package Loading