Disable PiP when VR mode starts.

Bug: 36214284
Test: Ensure that PiP is stopped when VR is enabled.
Change-Id: Ib537e1f360be7b47199d230e5691f6fece0f925f
This commit is contained in:
Winson Chung
2017-03-24 17:11:33 -07:00
parent 279d34af31
commit f1bfee1ca2
2 changed files with 25 additions and 1 deletions

View File

@@ -2384,7 +2384,19 @@ public class ActivityManagerService extends IActivityManager.Stub
idleUids();
} break;
case VR_MODE_CHANGE_MSG: {
mVrController.onVrModeChanged((ActivityRecord) msg.obj);
if (mVrController.onVrModeChanged((ActivityRecord) msg.obj)) {
synchronized (ActivityManagerService.this) {
if (mVrController.shouldDisableNonVrUiLocked()) {
// If we are in a VR mode where Picture-in-Picture mode is unsupported,
// then remove the pinned stack.
final PinnedActivityStack pinnedStack = mStackSupervisor.getStack(
PINNED_STACK_ID);
if (pinnedStack != null) {
mStackSupervisor.removeStackLocked(PINNED_STACK_ID);
}
}
}
}
} break;
case NOTIFY_VR_SLEEPING_MSG: {
notifyVrManagerOfSleepState(msg.arg1 != 0);
@@ -13329,6 +13341,13 @@ public class ActivityManagerService extends IActivityManager.Stub
}
}
/**
* @return whether the system should disable UI modes incompatible with VR mode.
*/
boolean shouldDisableNonVrUiLocked() {
return mVrController.shouldDisableNonVrUiLocked();
}
@Override
public boolean isTopOfTask(IBinder token) {
synchronized (this) {

View File

@@ -1164,6 +1164,11 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
return false;
}
// Check to see if we are in VR mode, and disallow PiP if so
if (service.shouldDisableNonVrUiLocked()) {
return false;
}
boolean isCurrentAppLocked = mStackSupervisor.getLockTaskModeState() != LOCK_TASK_MODE_NONE;
boolean isKeyguardLocked = service.isKeyguardLocked();
boolean hasPinnedStack = mStackSupervisor.getStack(PINNED_STACK_ID) != null;