Merge "Don't call into VrManagerService with AM lock." into nyc-mr2-dev

This commit is contained in:
TreeHugger Robot
2016-12-16 08:53:54 +00:00
committed by Android (Google) Code Review

View File

@@ -1547,6 +1547,7 @@ public final class ActivityManagerService extends ActivityManagerNative
static final int NOTIFY_FORCED_RESIZABLE_MSG = 67;
static final int NOTIFY_ACTIVITY_DISMISSING_DOCKED_STACK_MSG = 68;
static final int SHOW_UNSUPPORTED_DISPLAY_SIZE_DIALOG_MSG = 69;
static final int NOTIFY_VR_SLEEPING_MSG = 70;
static final int FIRST_ACTIVITY_STACK_MSG = 100;
static final int FIRST_BROADCAST_QUEUE_MSG = 200;
@@ -2362,6 +2363,8 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
vrService.setVrMode(vrMode, requestedPackage, userId, callingPackage);
} case NOTIFY_VR_SLEEPING_MSG: {
notifyVrManagerOfSleepState(msg.arg1 != 0);
} break;
}
}
@@ -3164,6 +3167,11 @@ public final class ActivityManagerService extends ActivityManagerNative
mHandler.obtainMessage(VR_MODE_CHANGE_MSG, 0, 0, r));
}
private void sendNotifyVrManagerOfSleepState(boolean isSleeping) {
mHandler.sendMessage(
mHandler.obtainMessage(NOTIFY_VR_SLEEPING_MSG, isSleeping ? 1 : 0, 0));
}
private void notifyVrManagerOfSleepState(boolean isSleeping) {
final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
if (vrService == null) {
@@ -11690,7 +11698,7 @@ public final class ActivityManagerService extends ActivityManagerNative
startTimeTrackingFocusedActivityLocked();
mTopProcessState = ActivityManager.PROCESS_STATE_TOP;
mStackSupervisor.comeOutOfSleepIfNeededLocked();
notifyVrManagerOfSleepState(false);
sendNotifyVrManagerOfSleepState(false);
updateOomAdjLocked();
} else if (!mSleeping && shouldSleepLocked()) {
mSleeping = true;
@@ -11699,7 +11707,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
mTopProcessState = ActivityManager.PROCESS_STATE_TOP_SLEEPING;
mStackSupervisor.goingToSleepLocked();
notifyVrManagerOfSleepState(true);
sendNotifyVrManagerOfSleepState(true);
updateOomAdjLocked();
// Initialize the wake times of all processes.