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

Commit 42351563 authored by menghanli's avatar menghanli
Browse files

Fix Accessibility Shortcut does not show up while SystemUI restart

Root cause: SystemUI restart to initial new AccessibilityFloatingMenuController, but it won't call onUserUnlocked to turn on the floating action menu ready.
Solution: No need to check mIsAccessibilityManagerServiceReady for AccessibilityManagerService is ready to retrieve. The onKeyguardVisibilityChanged is enough to update the floating action menu visibility.

Bug: 192635136
Test: Manual testing
   1. The floating action menu is not be displayed on the lock screen
   2. The floating action menu shows on a device restart
   3. The floating action menu shows on a SystemUI restart
   4. The floating action menu shows on user switching

Change-Id: Ifdd5f71af6810342d60f2c1e70f27b171cbc4adc
parent 1c5f21f0
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -51,27 +51,20 @@ public class AccessibilityFloatingMenuController implements
    private int mBtnMode;
    private String mBtnTargets;
    private boolean mIsKeyguardVisible;
    private boolean mIsAccessibilityManagerServiceReady;

    @VisibleForTesting
    final KeyguardUpdateMonitorCallback mKeyguardCallback = new KeyguardUpdateMonitorCallback() {
        // Accessibility floating menu needs to retrieve information from
        // AccessibilityManagerService, and it would be ready before onUserUnlocked().

        @Override
        public void onUserUnlocked() {
            mIsAccessibilityManagerServiceReady = true;
            handleFloatingMenuVisibility(mIsKeyguardVisible, mBtnMode, mBtnTargets);
        }

        // Keyguard state would be changed before AccessibilityManagerService is ready to retrieve,
        // need to wait until receive onUserUnlocked().
        @Override
        public void onKeyguardVisibilityChanged(boolean showing) {
            mIsKeyguardVisible = showing;
            if (mIsAccessibilityManagerServiceReady) {
            handleFloatingMenuVisibility(mIsKeyguardVisible, mBtnMode, mBtnTargets);
        }
        }

        @Override
        public void onUserSwitching(int userId) {
@@ -99,7 +92,6 @@ public class AccessibilityFloatingMenuController implements
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;

        mIsKeyguardVisible = false;
        mIsAccessibilityManagerServiceReady = false;
    }

    /**