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

Commit 520dd4a8 authored by Stephen Kiazyk's avatar Stephen Kiazyk
Browse files

Remove swipe to exit persistent Vr mode behavior

This behavior is somewhat redundant now
* It is currently already possible to exit Vr mode in normal
circumstances by pressing the X in the top left of the screen.
* If a 'safety hatch' is needed, one can just press the power button,
which will require going through the Don flow again, which can then be
cancelled by pressing the X button.

As it is, the swipe behavior is likely just to cause confusion (and
currently, it puts the device in a bad state where the vr app is still
running, but the screen is blank except for the overlay). My proposition
is just to remove it and use the power button as the safe/guaranteed way
to exit vr mode.

Bug: 36965697
Test: Swiping no longer drops the screen to the overlay when in a
vrflinger application.

Change-Id: I461828f5dce67361a5f4d60c47ac7d6371a4efb3
parent e4b64411
Loading
Loading
Loading
Loading
+0 −33
Original line number Diff line number Diff line
@@ -184,7 +184,6 @@ import android.provider.Settings;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
import android.service.vr.IPersistentVrStateCallbacks;
import android.speech.RecognizerIntent;
import android.telecom.TelecomManager;
import android.util.DisplayMetrics;
@@ -513,8 +512,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    volatile boolean mGoingToSleep;
    volatile boolean mRecentsVisible;
    volatile boolean mPictureInPictureVisible;
    // Written by vr manager thread, only read in this class
    volatile boolean mPersistentVrModeEnabled;
    volatile private boolean mDismissImeOnBackKeyPressed;

    // Used to hold the last user key used to wake the device.  This helps us prevent up events
@@ -1005,14 +1002,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }
    MyOrientationListener mOrientationListener;

    final IPersistentVrStateCallbacks mPersistentVrModeListener =
            new IPersistentVrStateCallbacks.Stub() {
        @Override
        public void onPersistentVrStateChanged(boolean enabled) {
            mPersistentVrModeEnabled = enabled;
        }
    };

    private final StatusBarController mStatusBarController = new StatusBarController();

    private final BarController mNavigationBarController = new BarController("NavigationBar",
@@ -1965,36 +1954,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        if (mStatusBar != null) {
                            requestTransientBars(mStatusBar);
                        }
                        if (mPersistentVrModeEnabled) {
                            exitPersistentVrMode();
                        }
                    }
                    @Override
                    public void onSwipeFromBottom() {
                        if (mNavigationBar != null && mNavigationBarPosition == NAV_BAR_BOTTOM) {
                            requestTransientBars(mNavigationBar);
                        }
                        if (mPersistentVrModeEnabled) {
                            exitPersistentVrMode();
                        }
                    }
                    @Override
                    public void onSwipeFromRight() {
                        if (mNavigationBar != null && mNavigationBarPosition == NAV_BAR_RIGHT) {
                            requestTransientBars(mNavigationBar);
                        }
                        if (mPersistentVrModeEnabled) {
                            exitPersistentVrMode();
                        }
                    }
                    @Override
                    public void onSwipeFromLeft() {
                        if (mNavigationBar != null && mNavigationBarPosition == NAV_BAR_LEFT) {
                            requestTransientBars(mNavigationBar);
                        }
                        if (mPersistentVrModeEnabled) {
                            exitPersistentVrMode();
                        }
                    }
                    @Override
                    public void onFling(int duration) {
@@ -6618,13 +6595,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        mVrManagerInternal.onScreenStateChanged(isScreenOn);
    }

    private void exitPersistentVrMode() {
        if (mVrManagerInternal == null) {
            return;
        }
        mVrManagerInternal.setPersistentVrModeEnabled(false);
    }

    private void finishWindowsDrawn() {
        synchronized (mLock) {
            if (!mScreenOnEarly || mWindowManagerDrawComplete) {
@@ -7112,9 +7082,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        mKeyguardDelegate.onSystemReady();

        mVrManagerInternal = LocalServices.getService(VrManagerInternal.class);
        if (mVrManagerInternal != null) {
            mVrManagerInternal.addPersistentVrModeStateListener(mPersistentVrModeListener);
        }

        readCameraLensCoverState();
        updateUiMode();