Loading services/core/java/com/android/server/pm/OtaDexoptService.java +8 −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.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME; import android.annotation.Nullable; import android.content.Context; Loading @@ -42,10 +43,9 @@ import java.io.FileDescriptor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.function.Predicate; /** * A service for A/B OTA dexopting. Loading Loading @@ -123,15 +123,20 @@ public class OtaDexoptService extends IOtaDexopt.Stub { } final List<PackageSetting> important; final List<PackageSetting> others; Predicate<PackageSetting> isPlatformPackage = pkgSetting -> PLATFORM_PACKAGE_NAME.equals(pkgSetting.pkg.getPackageName()); synchronized (mPackageManagerService.mLock) { // Important: the packages we need to run with ab-ota compiler-reason. important = PackageManagerServiceUtils.getPackagesForDexopt( mPackageManagerService.mSettings.mPackages.values(), mPackageManagerService, DEBUG_DEXOPT); // Remove Platform Package from A/B OTA b/160735835. important.removeIf(isPlatformPackage); // Others: we should optimize this with the (first-)boot compiler-reason. others = new ArrayList<>(mPackageManagerService.mSettings.mPackages.values()); others.removeAll(important); others.removeIf(PackageManagerServiceUtils.REMOVE_IF_NULL_PKG); others.removeIf(isPlatformPackage); // Pre-size the array list by over-allocating by a factor of 1.5. mDexoptCommands = new ArrayList<>(3 * mPackageManagerService.mPackages.size() / 2); Loading Loading
services/core/java/com/android/server/pm/OtaDexoptService.java +8 −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.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME; import android.annotation.Nullable; import android.content.Context; Loading @@ -42,10 +43,9 @@ import java.io.FileDescriptor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.function.Predicate; /** * A service for A/B OTA dexopting. Loading Loading @@ -123,15 +123,20 @@ public class OtaDexoptService extends IOtaDexopt.Stub { } final List<PackageSetting> important; final List<PackageSetting> others; Predicate<PackageSetting> isPlatformPackage = pkgSetting -> PLATFORM_PACKAGE_NAME.equals(pkgSetting.pkg.getPackageName()); synchronized (mPackageManagerService.mLock) { // Important: the packages we need to run with ab-ota compiler-reason. important = PackageManagerServiceUtils.getPackagesForDexopt( mPackageManagerService.mSettings.mPackages.values(), mPackageManagerService, DEBUG_DEXOPT); // Remove Platform Package from A/B OTA b/160735835. important.removeIf(isPlatformPackage); // Others: we should optimize this with the (first-)boot compiler-reason. others = new ArrayList<>(mPackageManagerService.mSettings.mPackages.values()); others.removeAll(important); others.removeIf(PackageManagerServiceUtils.REMOVE_IF_NULL_PKG); others.removeIf(isPlatformPackage); // Pre-size the array list by over-allocating by a factor of 1.5. mDexoptCommands = new ArrayList<>(3 * mPackageManagerService.mPackages.size() / 2); Loading