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

Commit 236ab83a authored by Song Chun Fan's avatar Song Chun Fan
Browse files

[pm] refactor extractNativeLibraries in PackageInstallerSession

This is a no-op that prepares to unlock mLock before the actual native lib extraction.

BUG: 393698598
Test: builds
FLAG: EXEMPT refactoring
Change-Id: I260c47c4b9c8e60ff8c073b6d913eccb8abad338
parent a7a31224
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -3107,8 +3107,17 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                        mInternalProgress = 0.5f;
                        computeProgressLocked(true);
                    }
                    final File libDir = new File(stageDir, NativeLibraryHelper.LIB_DIR_NAME);
                    if (!mayInheritNativeLibs()) {
                        // Start from a clean slate
                        NativeLibraryHelper.removeNativeBinariesFromDirLI(libDir, true);
                    }
                    // Skip native libraries processing for archival installation.
                    if (isArchivedInstallation()) {
                        return;
                    }
                    extractNativeLibraries(
                            mPackageLite, stageDir, params.abiOverride, mayInheritNativeLibs());
                            mPackageLite, libDir, params.abiOverride);
                }
            }
        }
@@ -4505,21 +4514,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        Slog.d(TAG, "Copied " + fromFiles.size() + " files into " + toDir);
    }

    private void extractNativeLibraries(PackageLite packageLite, File packageDir,
            String abiOverride, boolean inherit)
    private void extractNativeLibraries(PackageLite packageLite, File libDir,
            String abiOverride)
            throws PackageManagerException {
        Objects.requireNonNull(packageLite);
        final File libDir = new File(packageDir, NativeLibraryHelper.LIB_DIR_NAME);
        if (!inherit) {
            // Start from a clean slate
            NativeLibraryHelper.removeNativeBinariesFromDirLI(libDir, true);
        }

        // Skip native libraries processing for archival installation.
        if (isArchivedInstallation()) {
            return;
        }

        NativeLibraryHelper.Handle handle = null;
        try {
            handle = NativeLibraryHelper.Handle.create(packageLite);