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

Commit de379a5a authored by Orion Hodson's avatar Orion Hodson Committed by Automerger Merge Worker
Browse files

Merge "Ignore System Server dynamic dex files during A/B preopt" into rvc-dev...

Merge "Ignore System Server dynamic dex files during A/B preopt" into rvc-dev am: 1c2a704f am: cfe811b2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12113615

Change-Id: I638bb83e3d31e02f344cf4f4c7b425da7a9f66e3
parents 32fe6cf1 cfe811b2
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.pm;


import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;


import android.annotation.Nullable;
import android.annotation.Nullable;
import android.content.Context;
import android.content.Context;
@@ -42,10 +43,9 @@ import java.io.FileDescriptor;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collection;
import java.util.Collections;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;


/**
/**
 * A service for A/B OTA dexopting.
 * A service for A/B OTA dexopting.
@@ -123,15 +123,20 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
        }
        }
        final List<PackageSetting> important;
        final List<PackageSetting> important;
        final List<PackageSetting> others;
        final List<PackageSetting> others;
        Predicate<PackageSetting> isPlatformPackage = pkgSetting ->
                PLATFORM_PACKAGE_NAME.equals(pkgSetting.pkg.getPackageName());
        synchronized (mPackageManagerService.mLock) {
        synchronized (mPackageManagerService.mLock) {
            // Important: the packages we need to run with ab-ota compiler-reason.
            // Important: the packages we need to run with ab-ota compiler-reason.
            important = PackageManagerServiceUtils.getPackagesForDexopt(
            important = PackageManagerServiceUtils.getPackagesForDexopt(
                    mPackageManagerService.mSettings.mPackages.values(), mPackageManagerService,
                    mPackageManagerService.mSettings.mPackages.values(), mPackageManagerService,
                    DEBUG_DEXOPT);
                    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: we should optimize this with the (first-)boot compiler-reason.
            others = new ArrayList<>(mPackageManagerService.mSettings.mPackages.values());
            others = new ArrayList<>(mPackageManagerService.mSettings.mPackages.values());
            others.removeAll(important);
            others.removeAll(important);
            others.removeIf(PackageManagerServiceUtils.REMOVE_IF_NULL_PKG);
            others.removeIf(PackageManagerServiceUtils.REMOVE_IF_NULL_PKG);
            others.removeIf(isPlatformPackage);


            // Pre-size the array list by over-allocating by a factor of 1.5.
            // Pre-size the array list by over-allocating by a factor of 1.5.
            mDexoptCommands = new ArrayList<>(3 * mPackageManagerService.mPackages.size() / 2);
            mDexoptCommands = new ArrayList<>(3 * mPackageManagerService.mPackages.size() / 2);