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

Commit d82c58ab authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Disable PiP when VR mode starts." into oc-dev

parents e7ac324c f1bfee1c
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -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) {
+5 −0
Original line number Diff line number Diff line
@@ -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;