Loading packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java +2 −12 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.battery; import static android.provider.Settings.System.SHOW_BATTERY_PERCENT; import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.util.SysuiLifecycle.viewAttachLifecycle; import static java.lang.annotation.RetentionPolicy.SOURCE; Loading Loading @@ -61,8 +60,6 @@ import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; Loading @@ -72,8 +69,7 @@ import java.lang.annotation.Retention; import java.text.NumberFormat; public class BatteryMeterView extends LinearLayout implements BatteryStateChangeCallback, Tunable, DarkReceiver, ConfigurationListener { BatteryStateChangeCallback, Tunable, DarkReceiver { @Retention(SOURCE) @IntDef({MODE_DEFAULT, MODE_ON, MODE_OFF, MODE_ESTIMATE}) Loading Loading @@ -167,7 +163,6 @@ public class BatteryMeterView extends LinearLayout implements setClipChildren(false); setClipToPadding(false); Dependency.get(ConfigurationController.class).observe(viewAttachLifecycle(this), this); } private void setupLayoutTransition() { Loading Loading @@ -398,11 +393,6 @@ public class BatteryMeterView extends LinearLayout implements } } @Override public void onDensityOrFontScaleChanged() { scaleBatteryMeterViews(); } private Drawable getUnknownStateDrawable() { if (mUnknownStateDrawable == null) { mUnknownStateDrawable = mContext.getDrawable(R.drawable.ic_battery_unknown); Loading Loading @@ -432,7 +422,7 @@ public class BatteryMeterView extends LinearLayout implements /** * Looks up the scale factor for status bar icons and scales the battery view by that amount. */ private void scaleBatteryMeterViews() { void scaleBatteryMeterViews() { Resources res = getContext().getResources(); TypedValue typedValue = new TypedValue(); Loading packages/SystemUI/src/com/android/systemui/battery/BatteryMeterViewController.java +24 −2 Original line number Diff line number Diff line Loading @@ -15,22 +15,44 @@ */ package com.android.systemui.battery; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.util.ViewController; import javax.inject.Inject; /** Controller for {@link BatteryMeterView}. **/ public class BatteryMeterViewController extends ViewController<BatteryMeterView> { private final ConfigurationController mConfigurationController; private final ConfigurationController.ConfigurationListener mConfigurationListener = new ConfigurationController.ConfigurationListener() { @Override public void onDensityOrFontScaleChanged() { mView.scaleBatteryMeterViews(); } }; @Inject public BatteryMeterViewController(BatteryMeterView view) { public BatteryMeterViewController( BatteryMeterView view, ConfigurationController configurationController) { super(view); mConfigurationController = configurationController; } @Override protected void onViewAttached() { mConfigurationController.addCallback(mConfigurationListener); } @Override protected void onViewDetached() { destroy(); } @Override public void destroy() { super.destroy(); mConfigurationController.removeCallback(mConfigurationListener); } } No newline at end of file packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java +7 −1 Original line number Diff line number Diff line Loading @@ -159,10 +159,16 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat @Override protected void onViewDetached() { destroy(); } @Override public void destroy() { // Don't receive future #onViewAttached calls so that we don't accidentally have two // controllers registered for the same view. // TODO(b/194181195): This shouldn't be necessary. destroy(); super.destroy(); mBatteryMeterViewController.destroy(); mConfigurationController.removeCallback(mConfigurationListener); mAnimationScheduler.removeCallback(mAnimationCallback); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +1 −1 Original line number Diff line number Diff line Loading @@ -1043,7 +1043,7 @@ public class NotificationPanelViewController extends PanelViewController { mKeyguardStatusBarViewComponentFactory.build(keyguardStatusBarView); if (mKeyguardStatusBarViewController != null) { // TODO(b/194181195): This shouldn't be necessary. mKeyguardStatusBarViewController.onViewDetached(); mKeyguardStatusBarViewController.destroy(); } mKeyguardStatusBarViewController = statusBarViewComponent.getKeyguardStatusBarViewController(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +1 −1 Original line number Diff line number Diff line Loading @@ -1212,7 +1212,7 @@ public class StatusBar extends SystemUI implements mPhoneStatusBarViewController.init(); mBatteryMeterViewController = new BatteryMeterViewController( mStatusBarView.findViewById(R.id.battery) mStatusBarView.findViewById(R.id.battery), mConfigurationController ); mBatteryMeterViewController.init(); Loading Loading
packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java +2 −12 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.battery; import static android.provider.Settings.System.SHOW_BATTERY_PERCENT; import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.util.SysuiLifecycle.viewAttachLifecycle; import static java.lang.annotation.RetentionPolicy.SOURCE; Loading Loading @@ -61,8 +60,6 @@ import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; Loading @@ -72,8 +69,7 @@ import java.lang.annotation.Retention; import java.text.NumberFormat; public class BatteryMeterView extends LinearLayout implements BatteryStateChangeCallback, Tunable, DarkReceiver, ConfigurationListener { BatteryStateChangeCallback, Tunable, DarkReceiver { @Retention(SOURCE) @IntDef({MODE_DEFAULT, MODE_ON, MODE_OFF, MODE_ESTIMATE}) Loading Loading @@ -167,7 +163,6 @@ public class BatteryMeterView extends LinearLayout implements setClipChildren(false); setClipToPadding(false); Dependency.get(ConfigurationController.class).observe(viewAttachLifecycle(this), this); } private void setupLayoutTransition() { Loading Loading @@ -398,11 +393,6 @@ public class BatteryMeterView extends LinearLayout implements } } @Override public void onDensityOrFontScaleChanged() { scaleBatteryMeterViews(); } private Drawable getUnknownStateDrawable() { if (mUnknownStateDrawable == null) { mUnknownStateDrawable = mContext.getDrawable(R.drawable.ic_battery_unknown); Loading Loading @@ -432,7 +422,7 @@ public class BatteryMeterView extends LinearLayout implements /** * Looks up the scale factor for status bar icons and scales the battery view by that amount. */ private void scaleBatteryMeterViews() { void scaleBatteryMeterViews() { Resources res = getContext().getResources(); TypedValue typedValue = new TypedValue(); Loading
packages/SystemUI/src/com/android/systemui/battery/BatteryMeterViewController.java +24 −2 Original line number Diff line number Diff line Loading @@ -15,22 +15,44 @@ */ package com.android.systemui.battery; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.util.ViewController; import javax.inject.Inject; /** Controller for {@link BatteryMeterView}. **/ public class BatteryMeterViewController extends ViewController<BatteryMeterView> { private final ConfigurationController mConfigurationController; private final ConfigurationController.ConfigurationListener mConfigurationListener = new ConfigurationController.ConfigurationListener() { @Override public void onDensityOrFontScaleChanged() { mView.scaleBatteryMeterViews(); } }; @Inject public BatteryMeterViewController(BatteryMeterView view) { public BatteryMeterViewController( BatteryMeterView view, ConfigurationController configurationController) { super(view); mConfigurationController = configurationController; } @Override protected void onViewAttached() { mConfigurationController.addCallback(mConfigurationListener); } @Override protected void onViewDetached() { destroy(); } @Override public void destroy() { super.destroy(); mConfigurationController.removeCallback(mConfigurationListener); } } No newline at end of file
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java +7 −1 Original line number Diff line number Diff line Loading @@ -159,10 +159,16 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat @Override protected void onViewDetached() { destroy(); } @Override public void destroy() { // Don't receive future #onViewAttached calls so that we don't accidentally have two // controllers registered for the same view. // TODO(b/194181195): This shouldn't be necessary. destroy(); super.destroy(); mBatteryMeterViewController.destroy(); mConfigurationController.removeCallback(mConfigurationListener); mAnimationScheduler.removeCallback(mAnimationCallback); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +1 −1 Original line number Diff line number Diff line Loading @@ -1043,7 +1043,7 @@ public class NotificationPanelViewController extends PanelViewController { mKeyguardStatusBarViewComponentFactory.build(keyguardStatusBarView); if (mKeyguardStatusBarViewController != null) { // TODO(b/194181195): This shouldn't be necessary. mKeyguardStatusBarViewController.onViewDetached(); mKeyguardStatusBarViewController.destroy(); } mKeyguardStatusBarViewController = statusBarViewComponent.getKeyguardStatusBarViewController(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +1 −1 Original line number Diff line number Diff line Loading @@ -1212,7 +1212,7 @@ public class StatusBar extends SystemUI implements mPhoneStatusBarViewController.init(); mBatteryMeterViewController = new BatteryMeterViewController( mStatusBarView.findViewById(R.id.battery) mStatusBarView.findViewById(R.id.battery), mConfigurationController ); mBatteryMeterViewController.init(); Loading