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

Commit 76d302a5 authored by Gina Ko's avatar Gina Ko Committed by Android (Google) Code Review
Browse files

Revert "Add flag to narrow the meaning of JANK_PERCEPTIBLE."

This reverts commit 6491a452.

Reason for revert: Breaks BD1A/CD4A release builds

Bug: 382176384
Bug: 382179432
Change-Id: I240128ffbdca447e9daf32495bf762f2e5ea67f1
parent 6491a452
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -1180,18 +1180,6 @@ public class ActivityManager {
        return procState == PROCESS_STATE_FOREGROUND_SERVICE;
    }

    /** @hide Should this process state be considered jank perceptible? */
    public static final boolean isProcStateJankPerceptible(int procState) {
        if (Flags.jankPerceptibleNarrow()) {
            return procState == PROCESS_STATE_PERSISTENT_UI
                || procState == PROCESS_STATE_TOP
                || procState == PROCESS_STATE_IMPORTANT_FOREGROUND
                || procState == PROCESS_STATE_TOP_SLEEPING;
        } else {
            return !isProcStateCached(procState);
        }
    }

    /** @hide requestType for assist context: only basic information. */
    public static final int ASSIST_CONTEXT_BASIC = 0;

+17 −15
Original line number Diff line number Diff line
@@ -3911,7 +3911,12 @@ public final class ActivityThread extends ClientTransactionHandler
            if (mLastProcessState == processState) {
                return;
            }
            updateVmProcessState(mLastProcessState, processState);
            // Do not issue a transitional GC if we are transitioning between 2 cached states.
            // Only update if the state flips between cached and uncached or vice versa
            if (ActivityManager.isProcStateCached(mLastProcessState)
                    != ActivityManager.isProcStateCached(processState)) {
                updateVmProcessState(processState);
            }
            mLastProcessState = processState;
            if (localLOGV) {
                Slog.i(TAG, "******************* PROCESS STATE CHANGED TO: " + processState
@@ -3920,22 +3925,19 @@ public final class ActivityThread extends ClientTransactionHandler
        }
    }

    /** Converts a process state to a VM process state. */
    private static int toVmProcessState(int processState) {
        final int state = ActivityManager.isProcStateJankPerceptible(processState)
                ? VM_PROCESS_STATE_JANK_PERCEPTIBLE
                : VM_PROCESS_STATE_JANK_IMPERCEPTIBLE;
        return state;
    }

    /** Update VM state based on ActivityManager.PROCESS_STATE_* constants. */
    private void updateVmProcessState(int lastProcessState, int newProcessState) {
        final int state = toVmProcessState(newProcessState);
        if (lastProcessState == PROCESS_STATE_UNKNOWN
                || state != toVmProcessState(lastProcessState)) {
    // Currently ART VM only uses state updates for Transitional GC, and thus
    // this function initiates a Transitional GC for transitions into Cached apps states.
    private void updateVmProcessState(int processState) {
        // Only a transition into Cached state should result in a Transitional GC request
        // to the ART runtime. Update VM state to JANK_IMPERCEPTIBLE in that case.
        // Note that there are 4 possible cached states currently, all of which are
        // JANK_IMPERCEPTIBLE from GC point of view.
        final int state = ActivityManager.isProcStateCached(processState)
                ? VM_PROCESS_STATE_JANK_IMPERCEPTIBLE
                : VM_PROCESS_STATE_JANK_PERCEPTIBLE;
        VMRuntime.getRuntime().updateProcessState(state);
    }
    }

    @Override
    public void countLaunchingActivities(int num) {
+0 −7
Original line number Diff line number Diff line
@@ -165,10 +165,3 @@ flag {
     description: "Control ApplicationStartInfo component field and API"
     bug: "362537357"
}

flag {
    name: "jank_perceptible_narrow"
    namespace: "system_performance"
    description: "Narrow the scope of Jank Perceptible"
    bug: "304837972"
}