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