Update Dalvik process state through VMRuntime.
We now update Dalvik's process state through VMRuntime when the process state changes in ActivityThread. This is used to determine when to do trimming and will be used to determine when to do compaction in the near future. Bug: 8981901 Change-Id: I5eea272ba4ec2d1ed789b058d6457cb3c1fcf777
This commit is contained in:
@@ -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) {
|
||||
@@ -1269,8 +1270,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": ""));
|
||||
|
||||
Reference in New Issue
Block a user