From 42351563a2e4e7b943d7c6ab1f389225fc36b22f Mon Sep 17 00:00:00 2001 From: menghanli Date: Mon, 11 Apr 2022 14:13:03 +0800 Subject: [PATCH] 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 --- .../AccessibilityFloatingMenuController.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/AccessibilityFloatingMenuController.java b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/AccessibilityFloatingMenuController.java index cc5a792e89a1a..11353f67a7994 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/AccessibilityFloatingMenuController.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/AccessibilityFloatingMenuController.java @@ -51,26 +51,19 @@ 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); - } + handleFloatingMenuVisibility(mIsKeyguardVisible, mBtnMode, mBtnTargets); } @Override @@ -99,7 +92,6 @@ public class AccessibilityFloatingMenuController implements mKeyguardUpdateMonitor = keyguardUpdateMonitor; mIsKeyguardVisible = false; - mIsAccessibilityManagerServiceReady = false; } /**