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

Commit e7a21386 authored by Brian Carlstrom's avatar Brian Carlstrom Committed by Android (Google) Code Review
Browse files

Merge "Restrict lazy dexopt to eng builds only" into lmp-dev

parents baaa4ef6 230561ee
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -317,6 +317,7 @@ public class PackageManagerService extends IPackageManager.Stub {
    final Context mContext;
    final Context mContext;
    final boolean mFactoryTest;
    final boolean mFactoryTest;
    final boolean mOnlyCore;
    final boolean mOnlyCore;
    final boolean mLazyDexOpt;
    final DisplayMetrics mMetrics;
    final DisplayMetrics mMetrics;
    final int mDefParseFlags;
    final int mDefParseFlags;
    final String[] mSeparateProcesses;
    final String[] mSeparateProcesses;
@@ -1266,6 +1267,7 @@ public class PackageManagerService extends IPackageManager.Stub {
        mContext = context;
        mContext = context;
        mFactoryTest = factoryTest;
        mFactoryTest = factoryTest;
        mOnlyCore = onlyCore;
        mOnlyCore = onlyCore;
        mLazyDexOpt = "eng".equals(SystemProperties.get("ro.build.type"));
        mMetrics = new DisplayMetrics();
        mMetrics = new DisplayMetrics();
        mSettings = new Settings(context);
        mSettings = new Settings(context);
        mSettings.addSharedUserLPw("android.uid.system", Process.SYSTEM_UID,
        mSettings.addSharedUserLPw("android.uid.system", Process.SYSTEM_UID,
@@ -4451,13 +4453,12 @@ public class PackageManagerService extends IPackageManager.Stub {
        if (pkgs != null) {
        if (pkgs != null) {
            // Filter out packages that aren't recently used.
            // Filter out packages that aren't recently used.
            //
            //
            // The exception is first boot of a non-eng device, which
            // The exception is first boot of a non-eng device (aka !mLazyDexOpt), which
            // should do a full dexopt.
            // should do a full dexopt.
            boolean eng = "eng".equals(SystemProperties.get("ro.build.type"));
            if (mLazyDexOpt || (!isFirstBoot() && mPackageUsage.isHistoricalPackageUsageAvailable())) {
            if (eng || (!isFirstBoot() && mPackageUsage.isHistoricalPackageUsageAvailable())) {
                // TODO: add a property to control this?
                // TODO: add a property to control this?
                long dexOptLRUThresholdInMinutes;
                long dexOptLRUThresholdInMinutes;
                if (eng) {
                if (mLazyDexOpt) {
                    dexOptLRUThresholdInMinutes = 30; // only last 30 minutes of apps for eng builds.
                    dexOptLRUThresholdInMinutes = 30; // only last 30 minutes of apps for eng builds.
                } else {
                } else {
                    dexOptLRUThresholdInMinutes = 7 * 24 * 60; // apps used in the 7 days for users.
                    dexOptLRUThresholdInMinutes = 7 * 24 * 60; // apps used in the 7 days for users.
@@ -4523,6 +4524,9 @@ public class PackageManagerService extends IPackageManager.Stub {
    }
    }
    public boolean performDexOpt(String packageName, String instructionSet, boolean updateUsage) {
    public boolean performDexOpt(String packageName, String instructionSet, boolean updateUsage) {
        if (!mLazyDexOpt) {
            return false;
        }
        PackageParser.Package p;
        PackageParser.Package p;
        final String targetInstructionSet;
        final String targetInstructionSet;
        synchronized (mPackages) {
        synchronized (mPackages) {