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

Commit cbe35e2d authored by jasonwshsu's avatar jasonwshsu Committed by Automerger Merge Worker
Browse files

Update the supported type in ACCESSIBILITY_BUTTON_MODE according to navigation...

Update the supported type in ACCESSIBILITY_BUTTON_MODE according to navigation gestural mode or button mode am: 58a8eaa2 am: f1f78339

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15124971

Change-Id: I1445654edede525743584fc858ad8fb14edb8b9b
parents 88dff85e f1f78339
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.accessibility;

import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR;

import android.annotation.IntDef;
@@ -49,7 +50,8 @@ public class AccessibilityButtonModeObserver extends
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({
            ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR,
            ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU
            ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU,
            ACCESSIBILITY_BUTTON_MODE_GESTURE
    })
    public @interface AccessibilityButtonMode {}

+27 −5
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ import static android.app.StatusBarManager.WindowVisibleState;
import static android.app.StatusBarManager.windowStateToString;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.InsetsState.containsType;
@@ -589,7 +591,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        mDeviceProvisionedController.addCallback(mUserSetupListener);
        mNotificationShadeDepthController.addListener(mDepthListener);

        setAccessibilityFloatingMenuModeIfNeeded();
        updateAccessibilityButtonModeIfNeeded();

        return barView;
    }
@@ -1379,11 +1381,31 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        updateSystemUiStateFlags(a11yFlags);
    }

    private void setAccessibilityFloatingMenuModeIfNeeded() {
        if (QuickStepContract.isGesturalMode(mNavBarMode)) {
    private void updateAccessibilityButtonModeIfNeeded() {
        final int mode = Settings.Secure.getIntForUser(mContentResolver,
                Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
                ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR, UserHandle.USER_CURRENT);

        // ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU is compatible under gestural or non-gestural
        // mode, so we don't need to update it.
        if (mode == ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU) {
            return;
        }

        // ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR is incompatible under gestural mode. Need to
        // force update to ACCESSIBILITY_BUTTON_MODE_GESTURE.
        if (QuickStepContract.isGesturalMode(mNavBarMode)
                && mode == ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR) {
            Settings.Secure.putIntForUser(mContentResolver,
                    Settings.Secure.ACCESSIBILITY_BUTTON_MODE, ACCESSIBILITY_BUTTON_MODE_GESTURE,
                    UserHandle.USER_CURRENT);
            // ACCESSIBILITY_BUTTON_MODE_GESTURE is incompatible under non gestural mode. Need to
            // force update to ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR.
        } else if (!QuickStepContract.isGesturalMode(mNavBarMode)
                && mode == ACCESSIBILITY_BUTTON_MODE_GESTURE) {
            Settings.Secure.putIntForUser(mContentResolver,
                    Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
                    ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU, UserHandle.USER_CURRENT);
                    ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR, UserHandle.USER_CURRENT);
        }
    }

@@ -1511,7 +1533,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
            }
        }
        updateScreenPinningGestures();
        setAccessibilityFloatingMenuModeIfNeeded();
        updateAccessibilityButtonModeIfNeeded();

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