Loading services/core/java/com/android/server/pm/ApexManager.java +27 −0 Original line number Diff line number Diff line Loading @@ -208,6 +208,13 @@ abstract class ApexManager { */ abstract boolean abortActiveSession(); /** * Abandons the staged session with the given sessionId. * * @return {@code true} upon success, {@code false} if any remote exception occurs */ abstract boolean abortStagedSession(int sessionId) throws PackageManagerException; /** * Uninstalls given {@code apexPackage}. * Loading Loading @@ -495,6 +502,21 @@ abstract class ApexManager { } } @Override boolean abortStagedSession(int sessionId) throws PackageManagerException { try { mApexService.abortStagedSession(sessionId); return true; } catch (RemoteException re) { Slog.e(TAG, "Unable to contact apexservice", re); return false; } catch (Exception e) { throw new PackageManagerException( PackageInstaller.SessionInfo.STAGED_SESSION_VERIFICATION_FAILED, "Failed to abort staged session : " + e.getMessage()); } } @Override boolean uninstallApex(String apexPackagePath) { try { Loading Loading @@ -682,6 +704,11 @@ abstract class ApexManager { throw new UnsupportedOperationException(); } @Override boolean abortStagedSession(int sessionId) throws PackageManagerException { throw new UnsupportedOperationException(); } @Override boolean uninstallApex(String apexPackagePath) { throw new UnsupportedOperationException(); Loading services/core/java/com/android/server/pm/StagingManager.java +6 −3 Original line number Diff line number Diff line Loading @@ -215,7 +215,7 @@ public class StagingManager { } final long activeVersion = activePackage.applicationInfo.longVersionCode; if (activeVersion != session.params.requiredInstalledVersionCode) { if (!mApexManager.abortActiveSession()) { if (!mApexManager.abortStagedSession(session.sessionId)) { Slog.e(TAG, "Failed to abort apex session " + session.sessionId); } throw new PackageManagerException( Loading @@ -234,7 +234,7 @@ public class StagingManager { final boolean allowsDowngrade = PackageManagerServiceUtils.isDowngradePermitted( session.params.installFlags, activePackage.applicationInfo.flags); if (activeVersion > newVersionCode && !allowsDowngrade) { if (!mApexManager.abortActiveSession()) { if (!mApexManager.abortStagedSession(session.sessionId)) { Slog.e(TAG, "Failed to abort apex session " + session.sessionId); } throw new PackageManagerException( Loading Loading @@ -678,7 +678,10 @@ public class StagingManager { + " because it is not active or APEXD is not reachable"); return; } mApexManager.abortActiveSession(); try { mApexManager.abortStagedSession(session.sessionId); } catch (Exception ignore) { } } } Loading Loading
services/core/java/com/android/server/pm/ApexManager.java +27 −0 Original line number Diff line number Diff line Loading @@ -208,6 +208,13 @@ abstract class ApexManager { */ abstract boolean abortActiveSession(); /** * Abandons the staged session with the given sessionId. * * @return {@code true} upon success, {@code false} if any remote exception occurs */ abstract boolean abortStagedSession(int sessionId) throws PackageManagerException; /** * Uninstalls given {@code apexPackage}. * Loading Loading @@ -495,6 +502,21 @@ abstract class ApexManager { } } @Override boolean abortStagedSession(int sessionId) throws PackageManagerException { try { mApexService.abortStagedSession(sessionId); return true; } catch (RemoteException re) { Slog.e(TAG, "Unable to contact apexservice", re); return false; } catch (Exception e) { throw new PackageManagerException( PackageInstaller.SessionInfo.STAGED_SESSION_VERIFICATION_FAILED, "Failed to abort staged session : " + e.getMessage()); } } @Override boolean uninstallApex(String apexPackagePath) { try { Loading Loading @@ -682,6 +704,11 @@ abstract class ApexManager { throw new UnsupportedOperationException(); } @Override boolean abortStagedSession(int sessionId) throws PackageManagerException { throw new UnsupportedOperationException(); } @Override boolean uninstallApex(String apexPackagePath) { throw new UnsupportedOperationException(); Loading
services/core/java/com/android/server/pm/StagingManager.java +6 −3 Original line number Diff line number Diff line Loading @@ -215,7 +215,7 @@ public class StagingManager { } final long activeVersion = activePackage.applicationInfo.longVersionCode; if (activeVersion != session.params.requiredInstalledVersionCode) { if (!mApexManager.abortActiveSession()) { if (!mApexManager.abortStagedSession(session.sessionId)) { Slog.e(TAG, "Failed to abort apex session " + session.sessionId); } throw new PackageManagerException( Loading @@ -234,7 +234,7 @@ public class StagingManager { final boolean allowsDowngrade = PackageManagerServiceUtils.isDowngradePermitted( session.params.installFlags, activePackage.applicationInfo.flags); if (activeVersion > newVersionCode && !allowsDowngrade) { if (!mApexManager.abortActiveSession()) { if (!mApexManager.abortStagedSession(session.sessionId)) { Slog.e(TAG, "Failed to abort apex session " + session.sessionId); } throw new PackageManagerException( Loading Loading @@ -678,7 +678,10 @@ public class StagingManager { + " because it is not active or APEXD is not reachable"); return; } mApexManager.abortActiveSession(); try { mApexManager.abortStagedSession(session.sessionId); } catch (Exception ignore) { } } } Loading