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

Commit b1a8bb46 authored by Jason Hsu's avatar Jason Hsu Committed by Android (Google) Code Review
Browse files

Merge "Set to accessibility floating menu mode when navigation mode is gestural"

parents eb83a62b bc4516eb
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();