Merge "Improve Transition GC initiation by improving the Frameworks triggering signal" am: 9c6a8eb60a am: 832afca2df
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2477849 Change-Id: Iea43fc9fae7e39e4c6efca6df244f7f4bd653a41 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -3430,8 +3430,13 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
if (mLastProcessState == processState) {
|
if (mLastProcessState == processState) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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);
|
updateVmProcessState(processState);
|
||||||
|
}
|
||||||
|
mLastProcessState = processState;
|
||||||
if (localLOGV) {
|
if (localLOGV) {
|
||||||
Slog.i(TAG, "******************* PROCESS STATE CHANGED TO: " + processState
|
Slog.i(TAG, "******************* PROCESS STATE CHANGED TO: " + processState
|
||||||
+ (fromIpc ? " (from ipc" : ""));
|
+ (fromIpc ? " (from ipc" : ""));
|
||||||
@@ -3440,12 +3445,16 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Update VM state based on ActivityManager.PROCESS_STATE_* constants. */
|
/** Update VM state based on ActivityManager.PROCESS_STATE_* constants. */
|
||||||
|
// 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) {
|
private void updateVmProcessState(int processState) {
|
||||||
// TODO: Tune this since things like gmail sync are important background but not jank
|
// Only a transition into Cached state should result in a Transitional GC request
|
||||||
// perceptible.
|
// to the ART runtime. Update VM state to JANK_IMPERCEPTIBLE in that case.
|
||||||
final int state = processState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
|
// Note that there are 4 possible cached states currently, all of which are
|
||||||
? VM_PROCESS_STATE_JANK_PERCEPTIBLE
|
// JANK_IMPERCEPTIBLE from GC point of view.
|
||||||
: VM_PROCESS_STATE_JANK_IMPERCEPTIBLE;
|
final int state = ActivityManager.isProcStateCached(processState)
|
||||||
|
? VM_PROCESS_STATE_JANK_IMPERCEPTIBLE
|
||||||
|
: VM_PROCESS_STATE_JANK_PERCEPTIBLE;
|
||||||
VMRuntime.getRuntime().updateProcessState(state);
|
VMRuntime.getRuntime().updateProcessState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user