From eef0e0c32615e10117e34ede245b1b1ff8fdf03e Mon Sep 17 00:00:00 2001 From: Guobin Zhang Date: Fri, 1 Feb 2019 11:54:24 -0800 Subject: [PATCH] Update navigation bar upon change of display density Restart the navigation bar upon change of density or font scale, then the facet buttons of navigation bar will be scaled properly. Test: Settings->Display->Advanced->Display size->Largest bug: 122563094 Change-Id: I6d2d7ac4a801fac6f30bb78acee4c00ec2c4e507 Signed-off-by: Lei,RayX Signed-off-by: Guobin Zhang --- .../com/android/systemui/statusbar/car/CarStatusBar.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 e66a46249ff11..2dba1d5bc2571 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -105,8 +105,6 @@ public class CarStatusBar extends StatusBar implements mHvacController.connectToCarService(); CarSystemUIFactory factory = SystemUIFactory.getInstance(); - mCarFacetButtonController = factory.getCarDependencyComponent() - .getCarFacetButtonController(); mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); mDeviceIsProvisioned = mDeviceProvisionedController.isDeviceProvisioned(); if (!mDeviceIsProvisioned) { @@ -137,7 +135,7 @@ public class CarStatusBar extends StatusBar implements /** * Remove all content from navbars and rebuild them. Used to allow for different nav bars - * before and after the device is provisioned + * before and after the device is provisioned. . Also for change of density and font size. */ private void restartNavBars() { // remove and reattach all hvac components such that we don't keep a reference to unused @@ -253,6 +251,9 @@ public class CarStatusBar extends StatusBar implements super.makeStatusBarView(); mHvacController = new HvacController(mContext); + CarSystemUIFactory factory = SystemUIFactory.getInstance(); + mCarFacetButtonController = factory.getCarDependencyComponent() + .getCarFacetButtonController(); mNotificationPanelBackground = getDefaultWallpaper(); mScrimController.setScrimBehindDrawable(mNotificationPanelBackground); @@ -589,6 +590,7 @@ public class CarStatusBar extends StatusBar implements @Override public void onDensityOrFontScaleChanged() { super.onDensityOrFontScaleChanged(); + restartNavBars(); // Need to update the background on density changed in case the change was due to night // mode. mNotificationPanelBackground = getDefaultWallpaper();