From 2d6fce65c23d4617a0bbac046929feca991ba814 Mon Sep 17 00:00:00 2001 From: Merissa Tan Date: Fri, 14 Jan 2022 20:06:23 -0800 Subject: [PATCH] Create new DesktopNavbarButtonsViewController class. This CL creates a new DesktopNavbarButtonsViewController class to allow for taskbar buttons and status icons customization on desktop environment. Recall: http://recall/clips/1f3b88e2-9f4e-4291-a9fe-a17641d1fd0c Bug: 213964564 Bug: 196757951 Test: Switch between different system navigation modes and verify the desktop taskbar buttons/status icons stay on screen, and are functional. Change-Id: I05846b61689213ded88b8f49460aced88e49fd65 --- .../systemui/shared/rotation/RotationButtonController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java index 605d37628ec7f..d518cb5cdba15 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java @@ -16,6 +16,7 @@ package com.android.systemui.shared.rotation; +import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.Display.DEFAULT_DISPLAY; import static com.android.internal.view.RotationPolicy.NATURAL_ROTATION; @@ -200,7 +201,7 @@ public class RotationButtonController { } public void registerListeners() { - if (mListenersRegistered) { + if (mListenersRegistered || getContext().getPackageManager().hasSystemFeature(FEATURE_PC)) { return; } @@ -414,6 +415,9 @@ public class RotationButtonController { } public void onTaskbarStateChange(boolean visible, boolean stashed) { + if (getRotationButton() == null) { + return; + } getRotationButton().onTaskbarStateChanged(visible, stashed); }