Loading packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,11 @@ public class QSIconViewImpl extends QSIconView { d.setLayoutDirection(getLayoutDirection()); } final Drawable lastDrawable = iv.getDrawable(); if (lastDrawable instanceof Animatable2) { ((Animatable2) lastDrawable).clearAnimationCallbacks(); } if (iv instanceof SlashImageView) { ((SlashImageView) iv).setAnimationEnabled(shouldAnimate); ((SlashImageView) iv).setState(null, d); Loading packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java +9 −3 Original line number Diff line number Diff line Loading @@ -172,7 +172,8 @@ public class InternetDialogController implements AccessPointController.AccessPoi private Executor mExecutor; private AccessPointController mAccessPointController; private IntentFilter mConnectionStateFilter; private InternetDialogCallback mCallback; @VisibleForTesting InternetDialogCallback mCallback; private UiEventLogger mUiEventLogger; private BroadcastDispatcher mBroadcastDispatcher; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; Loading Loading @@ -215,13 +216,17 @@ public class InternetDialogController implements AccessPointController.AccessPoi new KeyguardUpdateMonitorCallback() { @Override public void onRefreshCarrierInfo() { if (mCallback != null) { mCallback.onRefreshCarrierInfo(); } } @Override public void onSimStateChanged(int subId, int slotId, int simState) { if (mCallback != null) { mCallback.onSimStateChanged(); } } }; protected List<SubscriptionInfo> getSubscriptionInfo() { Loading Loading @@ -331,6 +336,7 @@ public class InternetDialogController implements AccessPointController.AccessPoi mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateCallback); mConnectivityManager.unregisterNetworkCallback(mConnectivityManagerNetworkCallback); mConnectedWifiInternetMonitor.unregisterCallback(); mCallback = null; } @VisibleForTesting Loading packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,28 @@ public class QSIconViewImplTest extends SysuiTestCase { inOrder.verify(d).stop(); } @Test public void testAnimatorCallbackRemovedOnOldDrawable() { ImageView iv = new ImageView(mContext); AnimatedVectorDrawable d1 = mock(AnimatedVectorDrawable.class); when(d1.getConstantState()).thenReturn(fakeConstantState(d1)); AnimatedVectorDrawable d2 = mock(AnimatedVectorDrawable.class); when(d2.getConstantState()).thenReturn(fakeConstantState(d2)); State s = new State(); s.isTransient = true; // When set Animatable2 d1 s.icon = new QSTileImpl.DrawableIcon(d1); mIconView.updateIcon(iv, s, true); // And then set Animatable2 d2 s.icon = new QSTileImpl.DrawableIcon(d2); mIconView.updateIcon(iv, s, true); // Then d1 has its callback cleared verify(d1).clearAnimationCallbacks(); } private static Drawable.ConstantState fakeConstantState(Drawable otherDrawable) { return new Drawable.ConstantState() { @Override Loading packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogControllerTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -968,6 +968,7 @@ public class InternetDialogControllerTest extends SysuiTestCase { assertThat(mInternetDialogController.mSubIdTelephonyManagerMap.get(SUB_ID)).isEqualTo( mTelephonyManager); assertThat(mInternetDialogController.mSubIdTelephonyCallbackMap.get(SUB_ID)).isNotNull(); assertThat(mInternetDialogController.mCallback).isNotNull(); mInternetDialogController.onStop(); Loading @@ -980,6 +981,7 @@ public class InternetDialogControllerTest extends SysuiTestCase { verify(mAccessPointController).removeAccessPointCallback(mInternetDialogController); verify(mConnectivityManager).unregisterNetworkCallback( any(ConnectivityManager.NetworkCallback.class)); assertThat(mInternetDialogController.mCallback).isNull(); } private String getResourcesString(String name) { Loading Loading
packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,11 @@ public class QSIconViewImpl extends QSIconView { d.setLayoutDirection(getLayoutDirection()); } final Drawable lastDrawable = iv.getDrawable(); if (lastDrawable instanceof Animatable2) { ((Animatable2) lastDrawable).clearAnimationCallbacks(); } if (iv instanceof SlashImageView) { ((SlashImageView) iv).setAnimationEnabled(shouldAnimate); ((SlashImageView) iv).setState(null, d); Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java +9 −3 Original line number Diff line number Diff line Loading @@ -172,7 +172,8 @@ public class InternetDialogController implements AccessPointController.AccessPoi private Executor mExecutor; private AccessPointController mAccessPointController; private IntentFilter mConnectionStateFilter; private InternetDialogCallback mCallback; @VisibleForTesting InternetDialogCallback mCallback; private UiEventLogger mUiEventLogger; private BroadcastDispatcher mBroadcastDispatcher; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; Loading Loading @@ -215,13 +216,17 @@ public class InternetDialogController implements AccessPointController.AccessPoi new KeyguardUpdateMonitorCallback() { @Override public void onRefreshCarrierInfo() { if (mCallback != null) { mCallback.onRefreshCarrierInfo(); } } @Override public void onSimStateChanged(int subId, int slotId, int simState) { if (mCallback != null) { mCallback.onSimStateChanged(); } } }; protected List<SubscriptionInfo> getSubscriptionInfo() { Loading Loading @@ -331,6 +336,7 @@ public class InternetDialogController implements AccessPointController.AccessPoi mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateCallback); mConnectivityManager.unregisterNetworkCallback(mConnectivityManagerNetworkCallback); mConnectedWifiInternetMonitor.unregisterCallback(); mCallback = null; } @VisibleForTesting Loading
packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,28 @@ public class QSIconViewImplTest extends SysuiTestCase { inOrder.verify(d).stop(); } @Test public void testAnimatorCallbackRemovedOnOldDrawable() { ImageView iv = new ImageView(mContext); AnimatedVectorDrawable d1 = mock(AnimatedVectorDrawable.class); when(d1.getConstantState()).thenReturn(fakeConstantState(d1)); AnimatedVectorDrawable d2 = mock(AnimatedVectorDrawable.class); when(d2.getConstantState()).thenReturn(fakeConstantState(d2)); State s = new State(); s.isTransient = true; // When set Animatable2 d1 s.icon = new QSTileImpl.DrawableIcon(d1); mIconView.updateIcon(iv, s, true); // And then set Animatable2 d2 s.icon = new QSTileImpl.DrawableIcon(d2); mIconView.updateIcon(iv, s, true); // Then d1 has its callback cleared verify(d1).clearAnimationCallbacks(); } private static Drawable.ConstantState fakeConstantState(Drawable otherDrawable) { return new Drawable.ConstantState() { @Override Loading
packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogControllerTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -968,6 +968,7 @@ public class InternetDialogControllerTest extends SysuiTestCase { assertThat(mInternetDialogController.mSubIdTelephonyManagerMap.get(SUB_ID)).isEqualTo( mTelephonyManager); assertThat(mInternetDialogController.mSubIdTelephonyCallbackMap.get(SUB_ID)).isNotNull(); assertThat(mInternetDialogController.mCallback).isNotNull(); mInternetDialogController.onStop(); Loading @@ -980,6 +981,7 @@ public class InternetDialogControllerTest extends SysuiTestCase { verify(mAccessPointController).removeAccessPointCallback(mInternetDialogController); verify(mConnectivityManager).unregisterNetworkCallback( any(ConnectivityManager.NetworkCallback.class)); assertThat(mInternetDialogController.mCallback).isNull(); } private String getResourcesString(String name) { Loading