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

Commit c43f2453 authored by Quarx2k's avatar Quarx2k Committed by Steve Kondik
Browse files

PackageManager: reduce boot time



Only attempt to unpack native libraries if dexopt was performed
+ fix spaces for Dobie Wollert

Signed-off-by: default avatarTanguy Pruvot <tanguy.pruvot@gmail.com>

Change-Id: I8078cd79221451b820d9fea1ebec3866f3770c7c
parent 5edc7529
Loading
Loading
Loading
Loading
+29 −8
Original line number Diff line number Diff line
@@ -3418,6 +3418,13 @@ class PackageManagerService extends IPackageManager.Stub {
                    if (NativeLibraryHelper.removeNativeBinariesFromDirLI(nativeLibraryDir)) {
                        Log.i(TAG, "removed obsolete native libraries for system package " + path);
                    }
                    pkg.mScanPath = path;
                    if ((scanMode & SCAN_NO_DEX) == 0) {
                        if (performDexOptLI(pkg, forceDex) == DEX_OPT_FAILED) {
                            mLastScanError = PackageManager.INSTALL_FAILED_DEXOPT;
                            return null;
                        }
                    }
                } else if (nativeLibraryDir.getParent().equals(dataPathString)) {
                    /*
                     * If this is an internal application or our
@@ -3427,9 +3434,23 @@ class PackageManagerService extends IPackageManager.Stub {
                     * can happen for older apps that existed before an OTA to
                     * Gingerbread.
                     */
                    pkg.mScanPath = path;
                    if ((scanMode & SCAN_NO_DEX) == 0) {
                        int DexStatus = performDexOptLI(pkg, forceDex);
                        if (DexStatus == DEX_OPT_FAILED) {
                            mLastScanError = PackageManager.INSTALL_FAILED_DEXOPT;
                            return null;
                        }
                        if (DexStatus == DEX_OPT_PERFORMED) {

                            // Only attempt to unpack native libraries if dexopt was performed
                            // TODO, fix this also for Odex

                            Slog.i(TAG, "Unpacking native libraries for " + path);
                            mInstaller.unlinkNativeLibraryDirectory(dataPathString);
                            NativeLibraryHelper.copyNativeBinariesLI(scanFile, nativeLibraryDir);
                        }
                    }
                } else {
                    Slog.i(TAG, "Linking native library dir for " + path);
                    mInstaller.linkNativeLibraryDirectory(dataPathString,