From f3d1715cc9fdd61ff23d551cd7c0aa6e87651ac2 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Mon, 15 Jun 2015 15:02:56 -0400 Subject: [PATCH] Only re-register callbacks if tuning changed We only need to get the state if the tuning has actually changed. Currently we hit this every time we open QS which breaks the alpha animation on the mobile icon. Bug: 21791609 Change-Id: I3d77a2d0f81d2d7bed600ccd7a2d2c2b4a262db7 --- .../systemui/statusbar/SignalClusterView.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java index ff7b37fb812fd..9e0b08bb994ca 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -114,14 +114,21 @@ public class SignalClusterView return; } ArraySet blockList = StatusBarIconController.getIconBlacklist(newValue); - mBlockAirplane = blockList.contains(SLOT_AIRPLANE); - mBlockMobile = blockList.contains(SLOT_MOBILE); - mBlockWifi = blockList.contains(SLOT_WIFI); - mBlockEthernet = blockList.contains(SLOT_ETHERNET); + boolean blockAirplane = blockList.contains(SLOT_AIRPLANE); + boolean blockMobile = blockList.contains(SLOT_MOBILE); + boolean blockWifi = blockList.contains(SLOT_WIFI); + boolean blockEthernet = blockList.contains(SLOT_ETHERNET); - // Re-register to get new callbacks. - mNC.removeSignalCallback(SignalClusterView.this); - mNC.addSignalCallback(SignalClusterView.this); + if (blockAirplane != mBlockAirplane || blockMobile != mBlockMobile + || blockEthernet != mBlockEthernet || blockWifi != mBlockWifi) { + mBlockAirplane = blockAirplane; + mBlockMobile = blockMobile; + mBlockEthernet = blockEthernet; + mBlockWifi = blockWifi; + // Re-register to get new callbacks. + mNC.removeSignalCallback(this); + mNC.addSignalCallback(this); + } } public void setNetworkController(NetworkControllerImpl nc) {