Loading core/java/com/android/internal/os/InstallerConnection.java +9 −11 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.os; import android.net.LocalSocket; import android.net.LocalSocketAddress; import android.util.Slog; import libcore.io.IoUtils; import libcore.io.Streams; Loading Loading @@ -90,32 +91,29 @@ public class InstallerConnection { } } public int dexopt(String apkPath, int uid, boolean isPublic, String instructionSet, int dexoptNeeded, boolean bootComplete) { return dexopt(apkPath, uid, isPublic, "*", instructionSet, dexoptNeeded, false, false, null, bootComplete); public int dexopt(String apkPath, int uid, String instructionSet, int dexoptNeeded, int dexFlags) { return dexopt(apkPath, uid, "*", instructionSet, dexoptNeeded, null /*outputPath*/, dexFlags); } public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName, String instructionSet, int dexoptNeeded, boolean vmSafeMode, boolean debuggable, String outputPath, boolean bootComplete) { public int dexopt(String apkPath, int uid, String pkgName, String instructionSet, int dexoptNeeded, String outputPath, int dexFlags) { StringBuilder builder = new StringBuilder("dexopt"); builder.append(' '); builder.append(apkPath); builder.append(' '); builder.append(uid); builder.append(isPublic ? " 1" : " 0"); builder.append(' '); builder.append(pkgName); builder.append(' '); builder.append(instructionSet); builder.append(' '); builder.append(dexoptNeeded); builder.append(vmSafeMode ? " 1" : " 0"); builder.append(debuggable ? " 1" : " 0"); builder.append(' '); builder.append(outputPath != null ? outputPath : "!"); builder.append(bootComplete ? " 1" : " 0"); builder.append(' '); builder.append(dexFlags); return execute(builder.toString()); } Loading core/java/com/android/internal/os/ZygoteInit.java +2 −2 Original line number Diff line number Diff line Loading @@ -483,8 +483,8 @@ public class ZygoteInit { final int dexoptNeeded = DexFile.getDexOptNeeded( classPathElement, "*", instructionSet, false /* defer */); if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) { installer.dexopt(classPathElement, Process.SYSTEM_UID, false, instructionSet, dexoptNeeded, false /* boot complete */); installer.dexopt(classPathElement, Process.SYSTEM_UID, instructionSet, dexoptNeeded, 0 /*dexFlags*/); } } } catch (IOException ioe) { Loading services/core/java/com/android/server/pm/Installer.java +20 −22 Original line number Diff line number Diff line Loading @@ -31,6 +31,19 @@ import com.android.server.SystemService; public final class Installer extends SystemService { private static final String TAG = "Installer"; /* *************************************************************************** * IMPORTANT: These values are passed to native code. Keep them in sync with * frameworks/native/cmds/installd/installd.h * **************************************************************************/ /** Application should be visible to everyone */ public static final int DEXOPT_PUBLIC = 1 << 1; /** Application wants to run in VM safe mode */ public static final int DEXOPT_SAFEMODE = 1 << 2; /** Application wants to allow debugging of its code */ public static final int DEXOPT_DEBUGGABLE = 1 << 3; /** The system boot has finished */ public static final int DEXOPT_BOOTCOMPLETE = 1 << 4; private final InstallerConnection mInstaller; public Installer(Context context) { Loading Loading @@ -72,39 +85,24 @@ public final class Installer extends SystemService { return mInstaller.execute(builder.toString()); } public int dexopt(String apkPath, int uid, boolean isPublic, String instructionSet, int dexoptNeeded) { return dexopt(apkPath, uid, isPublic, instructionSet, dexoptNeeded, true); } public int dexopt(String apkPath, int uid, boolean isPublic, String instructionSet, int dexoptNeeded, boolean bootComplete) { public int dexopt(String apkPath, int uid, String instructionSet, int dexoptNeeded, int dexFlags) { if (!isValidInstructionSet(instructionSet)) { Slog.e(TAG, "Invalid instruction set: " + instructionSet); return -1; } return mInstaller.dexopt(apkPath, uid, isPublic, instructionSet, dexoptNeeded, bootComplete); } public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName, String instructionSet, int dexoptNeeded, boolean vmSafeMode, boolean debuggable, @Nullable String outputPath) { return dexopt(apkPath, uid, isPublic, pkgName, instructionSet, dexoptNeeded, vmSafeMode, debuggable, outputPath, true); return mInstaller.dexopt(apkPath, uid, instructionSet, dexoptNeeded, dexFlags); } public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName, String instructionSet, int dexoptNeeded, boolean vmSafeMode, boolean debuggable, @Nullable String outputPath, boolean bootComplete) { public int dexopt(String apkPath, int uid, String pkgName, String instructionSet, int dexoptNeeded, @Nullable String outputPath, int dexFlags) { if (!isValidInstructionSet(instructionSet)) { Slog.e(TAG, "Invalid instruction set: " + instructionSet); return -1; } return mInstaller.dexopt(apkPath, uid, isPublic, pkgName, instructionSet, dexoptNeeded, vmSafeMode, debuggable, outputPath, bootComplete); return mInstaller.dexopt(apkPath, uid, pkgName, instructionSet, dexoptNeeded, outputPath, dexFlags); } public int idmap(String targetApkPath, String overlayApkPath, int uid) { Loading services/core/java/com/android/server/pm/PackageDexOptimizer.java +10 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,10 @@ import java.util.List; import dalvik.system.DexFile; import dalvik.system.StaleDexCacheError; import static com.android.server.pm.Installer.DEXOPT_BOOTCOMPLETE; import static com.android.server.pm.Installer.DEXOPT_DEBUGGABLE; import static com.android.server.pm.Installer.DEXOPT_PUBLIC; import static com.android.server.pm.Installer.DEXOPT_SAFEMODE; import static com.android.server.pm.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; Loading Loading @@ -148,9 +152,13 @@ final class PackageDexOptimizer { + " vmSafeMode=" + vmSafeMode + " debuggable=" + debuggable + " oatDir = " + oatDir + " bootComplete=" + bootComplete); final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid); final int dexFlags = (!pkg.isForwardLocked() ? DEXOPT_PUBLIC : 0) | (vmSafeMode ? DEXOPT_SAFEMODE : 0) | (debuggable ? DEXOPT_DEBUGGABLE : 0) | (bootComplete ? DEXOPT_BOOTCOMPLETE : 0); final int ret = mPackageManagerService.mInstaller.dexopt(path, sharedGid, !pkg.isForwardLocked(), pkg.packageName, dexCodeInstructionSet, dexoptNeeded, vmSafeMode, debuggable, oatDir, bootComplete); pkg.packageName, dexCodeInstructionSet, dexoptNeeded, oatDir, dexFlags); if (ret < 0) { return DEX_OPT_FAILED; } Loading services/core/java/com/android/server/pm/PackageManagerService.java +7 −4 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import static com.android.internal.content.NativeLibraryHelper.LIB64_DIR_NAME; import static com.android.internal.content.NativeLibraryHelper.LIB_DIR_NAME; import static com.android.internal.util.ArrayUtils.appendInt; import static com.android.internal.util.ArrayUtils.removeInt; import static com.android.server.pm.Installer.DEXOPT_PUBLIC; import static com.android.server.pm.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSet; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; Loading Loading @@ -1460,7 +1461,8 @@ public class PackageManagerService extends IPackageManager.Stub { int dexoptNeeded = DexFile.getDexOptNeeded(lib, null, dexCodeInstructionSet, false); if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) { alreadyDexOpted.add(lib); mInstaller.dexopt(lib, Process.SYSTEM_UID, true, dexCodeInstructionSet, dexoptNeeded, false); mInstaller.dexopt(lib, Process.SYSTEM_UID, dexCodeInstructionSet, dexoptNeeded, DEXOPT_PUBLIC /*dexFlags*/); } } catch (FileNotFoundException e) { Slog.w(TAG, "Library not found: " + lib); Loading Loading @@ -1508,7 +1510,8 @@ public class PackageManagerService extends IPackageManager.Stub { try { int dexoptNeeded = DexFile.getDexOptNeeded(path, null, dexCodeInstructionSet, false); if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) { mInstaller.dexopt(path, Process.SYSTEM_UID, true, dexCodeInstructionSet, dexoptNeeded, false); mInstaller.dexopt(path, Process.SYSTEM_UID, dexCodeInstructionSet, dexoptNeeded, DEXOPT_PUBLIC /*dexFlags*/); } } catch (FileNotFoundException e) { Slog.w(TAG, "Jar not found: " + path); Loading Loading @@ -10451,9 +10454,9 @@ public class PackageManagerService extends IPackageManager.Stub { // Run dexopt before old package gets removed, to minimize time when app is unavailable int result = mPackageDexOptimizer .performDexOpt(pkg, null /* instruction sets */, true /* forceDex */, .performDexOpt(pkg, null /* instruction sets */, false /* forceDex */, false /* defer */, false /* inclDependencies */, true /* boot complete */); true /*bootComplete*/); if (result == PackageDexOptimizer.DEX_OPT_FAILED) { res.setError(INSTALL_FAILED_DEXOPT, "Dexopt failed for " + pkg.codePath); return; Loading Loading
core/java/com/android/internal/os/InstallerConnection.java +9 −11 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.os; import android.net.LocalSocket; import android.net.LocalSocketAddress; import android.util.Slog; import libcore.io.IoUtils; import libcore.io.Streams; Loading Loading @@ -90,32 +91,29 @@ public class InstallerConnection { } } public int dexopt(String apkPath, int uid, boolean isPublic, String instructionSet, int dexoptNeeded, boolean bootComplete) { return dexopt(apkPath, uid, isPublic, "*", instructionSet, dexoptNeeded, false, false, null, bootComplete); public int dexopt(String apkPath, int uid, String instructionSet, int dexoptNeeded, int dexFlags) { return dexopt(apkPath, uid, "*", instructionSet, dexoptNeeded, null /*outputPath*/, dexFlags); } public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName, String instructionSet, int dexoptNeeded, boolean vmSafeMode, boolean debuggable, String outputPath, boolean bootComplete) { public int dexopt(String apkPath, int uid, String pkgName, String instructionSet, int dexoptNeeded, String outputPath, int dexFlags) { StringBuilder builder = new StringBuilder("dexopt"); builder.append(' '); builder.append(apkPath); builder.append(' '); builder.append(uid); builder.append(isPublic ? " 1" : " 0"); builder.append(' '); builder.append(pkgName); builder.append(' '); builder.append(instructionSet); builder.append(' '); builder.append(dexoptNeeded); builder.append(vmSafeMode ? " 1" : " 0"); builder.append(debuggable ? " 1" : " 0"); builder.append(' '); builder.append(outputPath != null ? outputPath : "!"); builder.append(bootComplete ? " 1" : " 0"); builder.append(' '); builder.append(dexFlags); return execute(builder.toString()); } Loading
core/java/com/android/internal/os/ZygoteInit.java +2 −2 Original line number Diff line number Diff line Loading @@ -483,8 +483,8 @@ public class ZygoteInit { final int dexoptNeeded = DexFile.getDexOptNeeded( classPathElement, "*", instructionSet, false /* defer */); if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) { installer.dexopt(classPathElement, Process.SYSTEM_UID, false, instructionSet, dexoptNeeded, false /* boot complete */); installer.dexopt(classPathElement, Process.SYSTEM_UID, instructionSet, dexoptNeeded, 0 /*dexFlags*/); } } } catch (IOException ioe) { Loading
services/core/java/com/android/server/pm/Installer.java +20 −22 Original line number Diff line number Diff line Loading @@ -31,6 +31,19 @@ import com.android.server.SystemService; public final class Installer extends SystemService { private static final String TAG = "Installer"; /* *************************************************************************** * IMPORTANT: These values are passed to native code. Keep them in sync with * frameworks/native/cmds/installd/installd.h * **************************************************************************/ /** Application should be visible to everyone */ public static final int DEXOPT_PUBLIC = 1 << 1; /** Application wants to run in VM safe mode */ public static final int DEXOPT_SAFEMODE = 1 << 2; /** Application wants to allow debugging of its code */ public static final int DEXOPT_DEBUGGABLE = 1 << 3; /** The system boot has finished */ public static final int DEXOPT_BOOTCOMPLETE = 1 << 4; private final InstallerConnection mInstaller; public Installer(Context context) { Loading Loading @@ -72,39 +85,24 @@ public final class Installer extends SystemService { return mInstaller.execute(builder.toString()); } public int dexopt(String apkPath, int uid, boolean isPublic, String instructionSet, int dexoptNeeded) { return dexopt(apkPath, uid, isPublic, instructionSet, dexoptNeeded, true); } public int dexopt(String apkPath, int uid, boolean isPublic, String instructionSet, int dexoptNeeded, boolean bootComplete) { public int dexopt(String apkPath, int uid, String instructionSet, int dexoptNeeded, int dexFlags) { if (!isValidInstructionSet(instructionSet)) { Slog.e(TAG, "Invalid instruction set: " + instructionSet); return -1; } return mInstaller.dexopt(apkPath, uid, isPublic, instructionSet, dexoptNeeded, bootComplete); } public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName, String instructionSet, int dexoptNeeded, boolean vmSafeMode, boolean debuggable, @Nullable String outputPath) { return dexopt(apkPath, uid, isPublic, pkgName, instructionSet, dexoptNeeded, vmSafeMode, debuggable, outputPath, true); return mInstaller.dexopt(apkPath, uid, instructionSet, dexoptNeeded, dexFlags); } public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName, String instructionSet, int dexoptNeeded, boolean vmSafeMode, boolean debuggable, @Nullable String outputPath, boolean bootComplete) { public int dexopt(String apkPath, int uid, String pkgName, String instructionSet, int dexoptNeeded, @Nullable String outputPath, int dexFlags) { if (!isValidInstructionSet(instructionSet)) { Slog.e(TAG, "Invalid instruction set: " + instructionSet); return -1; } return mInstaller.dexopt(apkPath, uid, isPublic, pkgName, instructionSet, dexoptNeeded, vmSafeMode, debuggable, outputPath, bootComplete); return mInstaller.dexopt(apkPath, uid, pkgName, instructionSet, dexoptNeeded, outputPath, dexFlags); } public int idmap(String targetApkPath, String overlayApkPath, int uid) { Loading
services/core/java/com/android/server/pm/PackageDexOptimizer.java +10 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,10 @@ import java.util.List; import dalvik.system.DexFile; import dalvik.system.StaleDexCacheError; import static com.android.server.pm.Installer.DEXOPT_BOOTCOMPLETE; import static com.android.server.pm.Installer.DEXOPT_DEBUGGABLE; import static com.android.server.pm.Installer.DEXOPT_PUBLIC; import static com.android.server.pm.Installer.DEXOPT_SAFEMODE; import static com.android.server.pm.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; Loading Loading @@ -148,9 +152,13 @@ final class PackageDexOptimizer { + " vmSafeMode=" + vmSafeMode + " debuggable=" + debuggable + " oatDir = " + oatDir + " bootComplete=" + bootComplete); final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid); final int dexFlags = (!pkg.isForwardLocked() ? DEXOPT_PUBLIC : 0) | (vmSafeMode ? DEXOPT_SAFEMODE : 0) | (debuggable ? DEXOPT_DEBUGGABLE : 0) | (bootComplete ? DEXOPT_BOOTCOMPLETE : 0); final int ret = mPackageManagerService.mInstaller.dexopt(path, sharedGid, !pkg.isForwardLocked(), pkg.packageName, dexCodeInstructionSet, dexoptNeeded, vmSafeMode, debuggable, oatDir, bootComplete); pkg.packageName, dexCodeInstructionSet, dexoptNeeded, oatDir, dexFlags); if (ret < 0) { return DEX_OPT_FAILED; } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +7 −4 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import static com.android.internal.content.NativeLibraryHelper.LIB64_DIR_NAME; import static com.android.internal.content.NativeLibraryHelper.LIB_DIR_NAME; import static com.android.internal.util.ArrayUtils.appendInt; import static com.android.internal.util.ArrayUtils.removeInt; import static com.android.server.pm.Installer.DEXOPT_PUBLIC; import static com.android.server.pm.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSet; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; Loading Loading @@ -1460,7 +1461,8 @@ public class PackageManagerService extends IPackageManager.Stub { int dexoptNeeded = DexFile.getDexOptNeeded(lib, null, dexCodeInstructionSet, false); if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) { alreadyDexOpted.add(lib); mInstaller.dexopt(lib, Process.SYSTEM_UID, true, dexCodeInstructionSet, dexoptNeeded, false); mInstaller.dexopt(lib, Process.SYSTEM_UID, dexCodeInstructionSet, dexoptNeeded, DEXOPT_PUBLIC /*dexFlags*/); } } catch (FileNotFoundException e) { Slog.w(TAG, "Library not found: " + lib); Loading Loading @@ -1508,7 +1510,8 @@ public class PackageManagerService extends IPackageManager.Stub { try { int dexoptNeeded = DexFile.getDexOptNeeded(path, null, dexCodeInstructionSet, false); if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) { mInstaller.dexopt(path, Process.SYSTEM_UID, true, dexCodeInstructionSet, dexoptNeeded, false); mInstaller.dexopt(path, Process.SYSTEM_UID, dexCodeInstructionSet, dexoptNeeded, DEXOPT_PUBLIC /*dexFlags*/); } } catch (FileNotFoundException e) { Slog.w(TAG, "Jar not found: " + path); Loading Loading @@ -10451,9 +10454,9 @@ public class PackageManagerService extends IPackageManager.Stub { // Run dexopt before old package gets removed, to minimize time when app is unavailable int result = mPackageDexOptimizer .performDexOpt(pkg, null /* instruction sets */, true /* forceDex */, .performDexOpt(pkg, null /* instruction sets */, false /* forceDex */, false /* defer */, false /* inclDependencies */, true /* boot complete */); true /*bootComplete*/); if (result == PackageDexOptimizer.DEX_OPT_FAILED) { res.setError(INSTALL_FAILED_DEXOPT, "Dexopt failed for " + pkg.codePath); return; Loading