From 81db8e484dd7c8b3efe1fc618158d0363353f78d Mon Sep 17 00:00:00 2001 From: Toshiki Kikuchi Date: Wed, 2 Nov 2022 14:15:12 +0900 Subject: [PATCH] Register statusbar actions only if CentralSurfaces is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL changes SystemActions to register status bar-related actions only if CentralSurfaces is available. Because S_A_ID_NOTIFICATIONS and S_A_ID_QUICK_SETTINGS expect the CentralSurfaces instance in each handler (i.e. handleNotifications() and handleQuickSettings()), but CentralSurfaces is optional and some vendors (e.g. ARC) don’t provide it. Therefore, these two actions shouldn’t be registered when CentralSurfaces is not provided via DI. Bug: 255544050 Test: atest android.app.usage.cts.UsageStatsTest#testNotificationSee on ARC Change-Id: I592ca34d8081e4d76b9b7049359b2145f22f1dad --- .../com/android/systemui/accessibility/SystemActions.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java index 9f1c9b45e6cd7..998288a0a2c05 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java @@ -291,8 +291,11 @@ public class SystemActions implements CoreStartable { mA11yManager.registerSystemAction(actionBack, SYSTEM_ACTION_ID_BACK); mA11yManager.registerSystemAction(actionHome, SYSTEM_ACTION_ID_HOME); mA11yManager.registerSystemAction(actionRecents, SYSTEM_ACTION_ID_RECENTS); - mA11yManager.registerSystemAction(actionNotifications, SYSTEM_ACTION_ID_NOTIFICATIONS); - mA11yManager.registerSystemAction(actionQuickSettings, SYSTEM_ACTION_ID_QUICK_SETTINGS); + if (mCentralSurfacesOptionalLazy.get().isPresent()) { + // These two actions require the CentralSurfaces instance. + mA11yManager.registerSystemAction(actionNotifications, SYSTEM_ACTION_ID_NOTIFICATIONS); + mA11yManager.registerSystemAction(actionQuickSettings, SYSTEM_ACTION_ID_QUICK_SETTINGS); + } mA11yManager.registerSystemAction(actionPowerDialog, SYSTEM_ACTION_ID_POWER_DIALOG); mA11yManager.registerSystemAction(actionLockScreen, SYSTEM_ACTION_ID_LOCK_SCREEN); mA11yManager.registerSystemAction(actionTakeScreenshot, SYSTEM_ACTION_ID_TAKE_SCREENSHOT);