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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user