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

Commit 37efae84 authored by jasonwshsu's avatar jasonwshsu
Browse files

Set to accessibility floating menu mode when navigation mode is gestural

cherry picked from commit bc4516eb

Bug: 173938894
Test: manual test
Change-Id: I2cbe690040a7e4ad15c1340a5ee146eb315b1d27
Merged-In: I2cbe690040a7e4ad15c1340a5ee146eb315b1d27
parent f20f7a11
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.WindowType;
import static android.app.StatusBarManager.WindowVisibleState;
import static android.app.StatusBarManager.windowStateToString;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.InsetsState.containsType;
@@ -561,6 +562,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        mIsCurrentUserSetup = mDeviceProvisionedController.isCurrentUserSetup();
        mDeviceProvisionedController.addCallback(mUserSetupListener);

        setAccessibilityFloatingMenuModeIfNeeded();

        return barView;
    }

@@ -1405,6 +1408,13 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        updateSystemUiStateFlags(a11yFlags);
    }

    private void setAccessibilityFloatingMenuModeIfNeeded() {
        if (QuickStepContract.isGesturalMode(mNavBarMode)) {
            Settings.Secure.putInt(mContentResolver, Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
                    ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU);
        }
    }

    public void updateSystemUiStateFlags(int a11yFlags) {
        if (a11yFlags < 0) {
            a11yFlags = getA11yButtonState(null);
@@ -1462,7 +1472,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,

        // If accessibility button is floating menu mode, click and long click state should be
        // disabled.
        if (mA11yBtnMode == Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU) {
        if (mA11yBtnMode == ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU) {
            return 0;
        }

@@ -1550,6 +1560,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
            }
        }
        updateScreenPinningGestures();
        setAccessibilityFloatingMenuModeIfNeeded();

        if (!canShowSecondaryHandle()) {
            resetSecondaryHandle();