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

Commit 448e72d7 authored by hyemin.hwang's avatar hyemin.hwang Committed by Steve Kondik
Browse files

Prevent copyNativeLib of package scanning to reduce booting time.



Packagemanager do copyNativeBinariesForSupportedAbi for data apps(include updated system apps) every time.
And this takes a large percent of scanning time.
So, I added skip routine by check two confitions(isDexOptNeededInternal() and isUpdatedSystemApp()).

Change-Id: I46b3a4d9302456772012a176c89b5c878a712ef5
Signed-off-by: default avatarHyemin Hwang <hyemin.hwang@lge.com>
parent b87d3868
Loading
Loading
Loading
Loading
+27 −2
Original line number Diff line number Diff line
@@ -5953,9 +5953,34 @@ public class PackageManagerService extends IPackageManager.Stub {
                    if (isAsec) {
                        copyRet = NativeLibraryHelper.findSupportedAbi(handle, abiList);
                    } else {
                        final int preCopyRet = NativeLibraryHelper.findSupportedAbi(handle, abiList);
                        if (preCopyRet < 0 && preCopyRet != PackageManager.NO_NATIVE_LIBRARIES) {
                            throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
                                    "Error unpackaging native libs for app, errorCode=" + preCopyRet);
                        }
                        String primaryCpuAbi;
                        if (preCopyRet >= 0) {
                            primaryCpuAbi = abiList[preCopyRet];
                        } else {
                            primaryCpuAbi = abiList[0];
                        }
                        final String instructionSet = VMRuntime.getInstructionSet(primaryCpuAbi);
                        final String dexCodeInstructionSet = getDexCodeInstructionSet(instructionSet);
                        final byte dexoptRequired = DexFile.isDexOptNeededInternal(pkg.baseCodePath, pkg.packageName, dexCodeInstructionSet, false);
                        final boolean isDexOptNeeded =  dexoptRequired != DexFile.UP_TO_DATE;
                        boolean isCopyNativeBinariesNeeded = isDexOptNeeded || isUpdatedSystemApp(pkg);
                        if (isCopyNativeBinariesNeeded) {
                            copyRet = NativeLibraryHelper.copyNativeBinariesForSupportedAbi(handle,
                                    nativeLibraryRoot, abiList, useIsaSpecificSubdirs);
                        }
                        else {
                            copyRet = preCopyRet;
                        }
                    }
                    if (copyRet < 0 && copyRet != PackageManager.NO_NATIVE_LIBRARIES) {
                        throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,