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

Commit 3254260b authored by Mathieu Chartier's avatar Mathieu Chartier Committed by Gerrit Code Review
Browse files

Merge "Update Dalvik process state through VMRuntime."

parents 25fd0c9e 1e37090c
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ import libcore.io.EventLogger;
import libcore.io.IoUtils;

import dalvik.system.CloseGuard;
import dalvik.system.VMRuntime;

final class RemoteServiceException extends AndroidRuntimeException {
    public RemoteServiceException(String msg) {
@@ -1068,8 +1069,15 @@ public final class ActivityThread {
            synchronized (this) {
                if (mLastProcessState != processState) {
                    mLastProcessState = processState;

                    // Update Dalvik state here based on ActivityManager.PROCESS_STATE_* constants.
                    // Update Dalvik state based on ActivityManager.PROCESS_STATE_* constants.
                    final int DALVIK_PROCESS_STATE_JANK_PERCEPTIBLE = 0;
                    final int DALVIK_PROCESS_STATE_JANK_IMPERCEPTIBLE = 1;
                    int dalvikProcessState = DALVIK_PROCESS_STATE_JANK_IMPERCEPTIBLE;
                    // TODO: Tune this since things like gmail sync are important background but not jank perceptible.
                    if (processState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND) {
                        dalvikProcessState = DALVIK_PROCESS_STATE_JANK_PERCEPTIBLE;
                    }
                    VMRuntime.getRuntime().updateProcessState(dalvikProcessState);
                    if (false) {
                        Slog.i(TAG, "******************* PROCESS STATE CHANGED TO: " + processState
                                + (fromIpc ? " (from ipc": ""));