Loading services/core/java/com/android/server/pm/BackgroundDexOptService.java +2 −1 Original line number Diff line number Diff line Loading @@ -340,7 +340,8 @@ public class BackgroundDexOptService extends JobService { int dexoptFlags = DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES | DexoptOptions.DEXOPT_BOOT_COMPLETE | (downgrade ? DexoptOptions.DEXOPT_DOWNGRADE : 0); (downgrade ? DexoptOptions.DEXOPT_DOWNGRADE : 0) | DexoptOptions.DEXOPT_IDLE_BACKGROUND_JOB; if (is_for_primary_dex) { int result = pm.performDexOptWithStatus(new DexoptOptions(pkg, reason, dexoptFlags)); Loading services/core/java/com/android/server/pm/Installer.java +2 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,8 @@ public class Installer extends SystemService { public static final int DEXOPT_STORAGE_CE = 1 << 7; /** Indicates that the dex file passed to dexopt in on DE storage. */ public static final int DEXOPT_STORAGE_DE = 1 << 8; /** Indicates that dexopt is invoked from the background service. */ public static final int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9; // NOTE: keep in sync with installd public static final int FLAG_CLEAR_CACHE_ONLY = 1 << 8; Loading services/core/java/com/android/server/pm/PackageDexOptimizer.java +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import static com.android.server.pm.Installer.DEXOPT_SECONDARY_DEX; import static com.android.server.pm.Installer.DEXOPT_FORCE; import static com.android.server.pm.Installer.DEXOPT_STORAGE_CE; import static com.android.server.pm.Installer.DEXOPT_STORAGE_DE; import static com.android.server.pm.Installer.DEXOPT_IDLE_BACKGROUND_JOB; import static com.android.server.pm.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; Loading Loading @@ -612,6 +613,9 @@ public class PackageDexOptimizer { if ((flags & DEXOPT_STORAGE_DE) == DEXOPT_STORAGE_DE) { flagsList.add("storage_de"); } if ((flags & DEXOPT_IDLE_BACKGROUND_JOB) == DEXOPT_IDLE_BACKGROUND_JOB) { flagsList.add("idle_background_job"); } return String.join(",", flagsList); } Loading services/core/java/com/android/server/pm/dex/DexoptOptions.java +9 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,9 @@ public final class DexoptOptions { // actually shared at runtime. public static final int DEXOPT_AS_SHARED_LIBRARY = 1 << 6; // When set, indicates that dexopt is invoked from the background service. public static final int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9; // The name of package to optimize. private final String mPackageName; Loading Loading @@ -86,7 +89,8 @@ public final class DexoptOptions { DEXOPT_ONLY_SECONDARY_DEX | DEXOPT_ONLY_SHARED_DEX | DEXOPT_DOWNGRADE | DEXOPT_AS_SHARED_LIBRARY; DEXOPT_AS_SHARED_LIBRARY | DEXOPT_IDLE_BACKGROUND_JOB; if ((flags & (~validityMask)) != 0) { throw new IllegalArgumentException("Invalid flags : " + Integer.toHexString(flags)); } Loading Loading @@ -133,6 +137,10 @@ public final class DexoptOptions { return (mFlags & DEXOPT_AS_SHARED_LIBRARY) != 0; } public boolean isDexoptIdleBackgroundJob() { return (mFlags & DEXOPT_IDLE_BACKGROUND_JOB) != 0; } public String getSplitName() { return mSplitName; } Loading services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java +5 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class DexoptOptionsTests { assertFalse(opt.isDexoptOnlySharedDex()); assertFalse(opt.isDowngrade()); assertFalse(opt.isForce()); assertFalse(opt.isDexoptIdleBackgroundJob()); } @Test Loading @@ -63,7 +64,8 @@ public class DexoptOptionsTests { DexoptOptions.DEXOPT_ONLY_SECONDARY_DEX | DexoptOptions.DEXOPT_ONLY_SHARED_DEX | DexoptOptions.DEXOPT_DOWNGRADE | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY; DexoptOptions.DEXOPT_AS_SHARED_LIBRARY | DexoptOptions.DEXOPT_IDLE_BACKGROUND_JOB; DexoptOptions opt = new DexoptOptions(mPackageName, mCompilerFilter, flags); assertEquals(mPackageName, opt.getPackageName()); Loading @@ -76,6 +78,7 @@ public class DexoptOptionsTests { assertTrue(opt.isDowngrade()); assertTrue(opt.isForce()); assertTrue(opt.isDexoptAsSharedLibrary()); assertTrue(opt.isDexoptIdleBackgroundJob()); } @Test Loading Loading
services/core/java/com/android/server/pm/BackgroundDexOptService.java +2 −1 Original line number Diff line number Diff line Loading @@ -340,7 +340,8 @@ public class BackgroundDexOptService extends JobService { int dexoptFlags = DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES | DexoptOptions.DEXOPT_BOOT_COMPLETE | (downgrade ? DexoptOptions.DEXOPT_DOWNGRADE : 0); (downgrade ? DexoptOptions.DEXOPT_DOWNGRADE : 0) | DexoptOptions.DEXOPT_IDLE_BACKGROUND_JOB; if (is_for_primary_dex) { int result = pm.performDexOptWithStatus(new DexoptOptions(pkg, reason, dexoptFlags)); Loading
services/core/java/com/android/server/pm/Installer.java +2 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,8 @@ public class Installer extends SystemService { public static final int DEXOPT_STORAGE_CE = 1 << 7; /** Indicates that the dex file passed to dexopt in on DE storage. */ public static final int DEXOPT_STORAGE_DE = 1 << 8; /** Indicates that dexopt is invoked from the background service. */ public static final int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9; // NOTE: keep in sync with installd public static final int FLAG_CLEAR_CACHE_ONLY = 1 << 8; Loading
services/core/java/com/android/server/pm/PackageDexOptimizer.java +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import static com.android.server.pm.Installer.DEXOPT_SECONDARY_DEX; import static com.android.server.pm.Installer.DEXOPT_FORCE; import static com.android.server.pm.Installer.DEXOPT_STORAGE_CE; import static com.android.server.pm.Installer.DEXOPT_STORAGE_DE; import static com.android.server.pm.Installer.DEXOPT_IDLE_BACKGROUND_JOB; import static com.android.server.pm.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; Loading Loading @@ -612,6 +613,9 @@ public class PackageDexOptimizer { if ((flags & DEXOPT_STORAGE_DE) == DEXOPT_STORAGE_DE) { flagsList.add("storage_de"); } if ((flags & DEXOPT_IDLE_BACKGROUND_JOB) == DEXOPT_IDLE_BACKGROUND_JOB) { flagsList.add("idle_background_job"); } return String.join(",", flagsList); } Loading
services/core/java/com/android/server/pm/dex/DexoptOptions.java +9 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,9 @@ public final class DexoptOptions { // actually shared at runtime. public static final int DEXOPT_AS_SHARED_LIBRARY = 1 << 6; // When set, indicates that dexopt is invoked from the background service. public static final int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9; // The name of package to optimize. private final String mPackageName; Loading Loading @@ -86,7 +89,8 @@ public final class DexoptOptions { DEXOPT_ONLY_SECONDARY_DEX | DEXOPT_ONLY_SHARED_DEX | DEXOPT_DOWNGRADE | DEXOPT_AS_SHARED_LIBRARY; DEXOPT_AS_SHARED_LIBRARY | DEXOPT_IDLE_BACKGROUND_JOB; if ((flags & (~validityMask)) != 0) { throw new IllegalArgumentException("Invalid flags : " + Integer.toHexString(flags)); } Loading Loading @@ -133,6 +137,10 @@ public final class DexoptOptions { return (mFlags & DEXOPT_AS_SHARED_LIBRARY) != 0; } public boolean isDexoptIdleBackgroundJob() { return (mFlags & DEXOPT_IDLE_BACKGROUND_JOB) != 0; } public String getSplitName() { return mSplitName; } Loading
services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java +5 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class DexoptOptionsTests { assertFalse(opt.isDexoptOnlySharedDex()); assertFalse(opt.isDowngrade()); assertFalse(opt.isForce()); assertFalse(opt.isDexoptIdleBackgroundJob()); } @Test Loading @@ -63,7 +64,8 @@ public class DexoptOptionsTests { DexoptOptions.DEXOPT_ONLY_SECONDARY_DEX | DexoptOptions.DEXOPT_ONLY_SHARED_DEX | DexoptOptions.DEXOPT_DOWNGRADE | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY; DexoptOptions.DEXOPT_AS_SHARED_LIBRARY | DexoptOptions.DEXOPT_IDLE_BACKGROUND_JOB; DexoptOptions opt = new DexoptOptions(mPackageName, mCompilerFilter, flags); assertEquals(mPackageName, opt.getPackageName()); Loading @@ -76,6 +78,7 @@ public class DexoptOptionsTests { assertTrue(opt.isDowngrade()); assertTrue(opt.isForce()); assertTrue(opt.isDexoptAsSharedLibrary()); assertTrue(opt.isDexoptIdleBackgroundJob()); } @Test Loading