Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c05291dc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Bypass most session work for APEX packages"

parents 0e693bf2 a77a677c
Loading
Loading
Loading
Loading
+92 −87
Original line number Diff line number Diff line
@@ -1126,6 +1126,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
            throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR, "Session not sealed");
        }

        final IPackageInstallObserver2 localObserver;
        if ((params.installFlags & PackageManager.INSTALL_APEX) != 0) {
            localObserver = null;
        } else {
            if (!params.isMultiPackage) {
                Preconditions.checkNotNull(mPackageName);
                Preconditions.checkNotNull(mSigningDetails);
@@ -1173,8 +1177,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                                    final int splitIndex = libPath.lastIndexOf('/');
                                    if (splitIndex < 0 || splitIndex >= libPath.length() - 1) {
                                        Slog.e(TAG,
                                            "Skipping native library creation for linking due to "
                                                    + "invalid path: " + libPath);
                                                "Skipping native library creation for linking due"
                                                        + " to invalid path: " + libPath);
                                        continue;
                                    }
                                    final String libDirPath = libPath.substring(1, splitIndex);
@@ -1204,11 +1208,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                computeProgressLocked(true);

                // Unpack native libraries
            extractNativeLibraries(mResolvedStageDir, params.abiOverride, mayInheritNativeLibs());
                extractNativeLibraries(mResolvedStageDir, params.abiOverride,
                        mayInheritNativeLibs());
            }

            // We've reached point of no return; call into PMS to install the stage.
            // Regardless of success or failure we always destroy session.
        final IPackageInstallObserver2 localObserver = new IPackageInstallObserver2.Stub() {
            localObserver = new IPackageInstallObserver2.Stub() {
                @Override
                public void onUserActionRequired(Intent intent) {
                    throw new IllegalStateException();
@@ -1221,6 +1227,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                    dispatchSessionFinished(returnCode, msg, extras);
                }
            };
        }

        final UserHandle user;
        if ((params.installFlags & PackageManager.INSTALL_ALL_USERS) != 0) {
@@ -1230,11 +1237,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        }

        mRelinquished = true;
        final PackageManagerService.ActiveInstallSession activeInstallSession =
                new PackageManagerService.ActiveInstallSession(mPackageName, stageDir,
        return new PackageManagerService.ActiveInstallSession(mPackageName, stageDir,
                localObserver, params, mInstallerPackageName, mInstallerUid, user,
                mSigningDetails);
        return activeInstallSession;
    }

    private static void maybeRenameFile(File from, File to) throws PackageManagerException {