Loading core/java/android/content/pm/IPackageManager.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -543,9 +543,10 @@ interface IPackageManager { void forceDexOpt(String packageName); /** * Execute the background dexopt job immediately. * Execute the background dexopt job immediately on packages in packageNames. * If null, then execute on all packages. */ boolean runBackgroundDexoptJob(); boolean runBackgroundDexoptJob(in List<String> packageNames); /** * Reconcile the information we have about the secondary dex files belonging to Loading services/core/java/com/android/server/pm/BackgroundDexOptService.java +13 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.pm; import static com.android.server.pm.PackageManagerService.DEBUG_DEXOPT; import android.annotation.Nullable; import android.app.job.JobInfo; import android.app.job.JobParameters; import android.app.job.JobScheduler; Loading @@ -40,6 +41,7 @@ import com.android.server.PinnerService; import com.android.server.pm.dex.DexoptOptions; import java.io.File; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.TimeUnit; Loading Loading @@ -402,14 +404,22 @@ public class BackgroundDexOptService extends JobService { } /** * Execute the idle optimizations immediately. * Execute idle optimizations immediately on packages in packageNames. If packageNames is null, * then execute on all packages. */ public static boolean runIdleOptimizationsNow(PackageManagerService pm, Context context) { public static boolean runIdleOptimizationsNow(PackageManagerService pm, Context context, @Nullable List<String> packageNames) { // Create a new object to make sure we don't interfere with the scheduled jobs. // Note that this may still run at the same time with the job scheduled by the // JobScheduler but the scheduler will not be able to cancel it. BackgroundDexOptService bdos = new BackgroundDexOptService(); int result = bdos.idleOptimization(pm, pm.getOptimizablePackages(), context); ArraySet<String> packagesToOptimize; if (packageNames == null) { packagesToOptimize = pm.getOptimizablePackages(); } else { packagesToOptimize = new ArraySet<>(packageNames); } int result = bdos.idleOptimization(pm, packagesToOptimize, context); return result == OPTIMIZE_PROCESSED; } Loading services/core/java/com/android/server/pm/PackageManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -8985,11 +8985,11 @@ public class PackageManagerService extends IPackageManager.Stub * Execute the background dexopt job immediately. */ @Override public boolean runBackgroundDexoptJob() { public boolean runBackgroundDexoptJob(@Nullable List<String> packageNames) { if (getInstantAppPackageName(Binder.getCallingUid()) != null) { return false; } return BackgroundDexOptService.runIdleOptimizationsNow(this, mContext); return BackgroundDexOptService.runIdleOptimizationsNow(this, mContext, packageNames); } List<PackageParser.Package> findSharedNonSystemLibraries(PackageParser.Package p) { services/core/java/com/android/server/pm/PackageManagerShellCommand.java +7 −1 Original line number Diff line number Diff line Loading @@ -1219,7 +1219,13 @@ class PackageManagerShellCommand extends ShellCommand { } private int runDexoptJob() throws RemoteException { boolean result = mInterface.runBackgroundDexoptJob(); String arg; List<String> packageNames = new ArrayList<>(); while ((arg = getNextArg()) != null) { packageNames.add(arg); } boolean result = mInterface.runBackgroundDexoptJob(packageNames.isEmpty() ? null : packageNames); return result ? 0 : -1; } Loading Loading
core/java/android/content/pm/IPackageManager.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -543,9 +543,10 @@ interface IPackageManager { void forceDexOpt(String packageName); /** * Execute the background dexopt job immediately. * Execute the background dexopt job immediately on packages in packageNames. * If null, then execute on all packages. */ boolean runBackgroundDexoptJob(); boolean runBackgroundDexoptJob(in List<String> packageNames); /** * Reconcile the information we have about the secondary dex files belonging to Loading
services/core/java/com/android/server/pm/BackgroundDexOptService.java +13 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.pm; import static com.android.server.pm.PackageManagerService.DEBUG_DEXOPT; import android.annotation.Nullable; import android.app.job.JobInfo; import android.app.job.JobParameters; import android.app.job.JobScheduler; Loading @@ -40,6 +41,7 @@ import com.android.server.PinnerService; import com.android.server.pm.dex.DexoptOptions; import java.io.File; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.TimeUnit; Loading Loading @@ -402,14 +404,22 @@ public class BackgroundDexOptService extends JobService { } /** * Execute the idle optimizations immediately. * Execute idle optimizations immediately on packages in packageNames. If packageNames is null, * then execute on all packages. */ public static boolean runIdleOptimizationsNow(PackageManagerService pm, Context context) { public static boolean runIdleOptimizationsNow(PackageManagerService pm, Context context, @Nullable List<String> packageNames) { // Create a new object to make sure we don't interfere with the scheduled jobs. // Note that this may still run at the same time with the job scheduled by the // JobScheduler but the scheduler will not be able to cancel it. BackgroundDexOptService bdos = new BackgroundDexOptService(); int result = bdos.idleOptimization(pm, pm.getOptimizablePackages(), context); ArraySet<String> packagesToOptimize; if (packageNames == null) { packagesToOptimize = pm.getOptimizablePackages(); } else { packagesToOptimize = new ArraySet<>(packageNames); } int result = bdos.idleOptimization(pm, packagesToOptimize, context); return result == OPTIMIZE_PROCESSED; } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -8985,11 +8985,11 @@ public class PackageManagerService extends IPackageManager.Stub * Execute the background dexopt job immediately. */ @Override public boolean runBackgroundDexoptJob() { public boolean runBackgroundDexoptJob(@Nullable List<String> packageNames) { if (getInstantAppPackageName(Binder.getCallingUid()) != null) { return false; } return BackgroundDexOptService.runIdleOptimizationsNow(this, mContext); return BackgroundDexOptService.runIdleOptimizationsNow(this, mContext, packageNames); } List<PackageParser.Package> findSharedNonSystemLibraries(PackageParser.Package p) {
services/core/java/com/android/server/pm/PackageManagerShellCommand.java +7 −1 Original line number Diff line number Diff line Loading @@ -1219,7 +1219,13 @@ class PackageManagerShellCommand extends ShellCommand { } private int runDexoptJob() throws RemoteException { boolean result = mInterface.runBackgroundDexoptJob(); String arg; List<String> packageNames = new ArrayList<>(); while ((arg = getNextArg()) != null) { packageNames.add(arg); } boolean result = mInterface.runBackgroundDexoptJob(packageNames.isEmpty() ? null : packageNames); return result ? 0 : -1; } Loading