From 3cc9758323cb6779a02618cb9bf2015e7b4f9fba Mon Sep 17 00:00:00 2001 From: kwaky Date: Tue, 18 Feb 2020 14:52:10 -0800 Subject: [PATCH] DO NOT MERGE Reflect the selection state that reflects the current task stack upon restarting the Navigation Bar. Previously, while restarting the Navigation Bar, we omitted the step where we apply the selection state that reflects the current task stack. This omission caused CarFacetButtons to lose their selection state on certain events, such as the day/night toggle. Bug: 148211695 Test: Manual -- Verify that the selection state is preserved between day/night toggle. adb shell dumpsys activity service com.android.car/.CarService day-night-mode day adb shell dumpsys activity service com.android.car/.CarService day-night-mode night Change-Id: Ic07b8b66aa531436ce4f23d56bb3c11a79b7cb46 --- .../com/android/systemui/statusbar/car/CarStatusBar.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java index e0f398742ebca..4e1f552f7f997 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -486,6 +486,15 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt // CarFacetButtonController was reset therefore we need to re-add the status bar elements // to the controller. mCarFacetButtonController.addAllFacetButtons(mStatusBarWindow); + + // Upon restarting the Navigation Bar, CarFacetButtonController should immediately apply the + // selection state that reflects the current task stack. + try { + mCarFacetButtonController.taskChanged( + ActivityTaskManager.getService().getAllStackInfos()); + } catch (Exception e) { + Log.e(TAG, "Getting StackInfo from activity manager failed", e); + } } private void addTemperatureViewToController(View v) {