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

Commit f1bfee1c authored by Winson Chung's avatar Winson Chung
Browse files

Disable PiP when VR mode starts.

Bug: 36214284
Test: Ensure that PiP is stopped when VR is enabled.
Change-Id: Ib537e1f360be7b47199d230e5691f6fece0f925f
parent 279d34af
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;