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

Commit b4b484f3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ifbe01549,Ie9252725 into main

* changes:
  Implement ablation study for removing odex and vdex pins for home app
  Add skip_home_art_pins trunk stable flag
parents 0bb98dec 683efe13
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.ActivityManager.UID_OBSERVER_GONE;
import static android.os.Process.SYSTEM_UID;
import static android.os.Process.SYSTEM_UID;


import static com.android.server.flags.Flags.pinWebview;
import static com.android.server.flags.Flags.pinWebview;
import static com.android.server.flags.Flags.skipHomeArtPins;


import android.annotation.EnforcePermission;
import android.annotation.EnforcePermission;
import android.annotation.IntDef;
import android.annotation.IntDef;
@@ -851,6 +852,9 @@ public final class PinnerService extends SystemService {
        }
        }


        int apkPinSizeLimit = pinSizeLimit;
        int apkPinSizeLimit = pinSizeLimit;

        boolean shouldSkipArtPins = key == KEY_HOME && skipHomeArtPins();

        for (String apk: apks) {
        for (String apk: apks) {
            if (apkPinSizeLimit <= 0) {
            if (apkPinSizeLimit <= 0) {
                Slog.w(TAG, "Reached to the pin size limit. Skipping: " + apk);
                Slog.w(TAG, "Reached to the pin size limit. Skipping: " + apk);
@@ -874,8 +878,8 @@ public final class PinnerService extends SystemService {
            }
            }


            apkPinSizeLimit -= pf.bytesPinned;
            apkPinSizeLimit -= pf.bytesPinned;
            if (apk.equals(appInfo.sourceDir)) {
            if (apk.equals(appInfo.sourceDir) && !shouldSkipArtPins) {
                pinOptimizedDexDependencies(pf, apkPinSizeLimit, appInfo);
                pinOptimizedDexDependencies(pf, Integer.MAX_VALUE, appInfo);
            }
            }
        }
        }
    }
    }
@@ -921,8 +925,8 @@ public final class PinnerService extends SystemService {
        }
        }
        pf.groupName = groupName != null ? groupName : "";
        pf.groupName = groupName != null ? groupName : "";


        maxBytesToPin -= bytesPinned;
        bytesPinned += pf.bytesPinned;
        bytesPinned += pf.bytesPinned;
        maxBytesToPin -= bytesPinned;


        synchronized (this) {
        synchronized (this) {
            mPinnedFiles.put(pf.fileName, pf);
            mPinnedFiles.put(pf.fileName, pf);
@@ -970,7 +974,7 @@ public final class PinnerService extends SystemService {
                // Unpin if it was already pinned prior to re-pinning.
                // Unpin if it was already pinned prior to re-pinning.
                unpinFile(file);
                unpinFile(file);


                PinnedFile df = mInjector.pinFileInternal(file, Integer.MAX_VALUE,
                PinnedFile df = mInjector.pinFileInternal(file, maxBytesToPin,
                        /*attemptPinIntrospection=*/false);
                        /*attemptPinIntrospection=*/false);
                if (df == null) {
                if (df == null) {
                    Slog.i(TAG, "Failed to pin ART file = " + file);
                    Slog.i(TAG, "Failed to pin ART file = " + file);
+7 −0
Original line number Original line Diff line number Diff line
@@ -7,3 +7,10 @@ flag {
    description: "This flag controls if webview should be pinned in memory."
    description: "This flag controls if webview should be pinned in memory."
    bug: "307594624"
    bug: "307594624"
}
}

flag {
    name: "skip_home_art_pins"
    namespace: "system_performance"
    description: "Ablation study flag that controls if home app odex/vdex files should be pinned in memory."
    bug: "340935152"
}
 No newline at end of file