Don't set the text on QS Tiles unless we need to
Avoid causing layout passes.
Bug: 27278616
Change-Id: I5104a756b44154f6b66f2c74aee17caf29acf628
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
index 6fa23e7..98a1c23 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
@@ -28,6 +28,7 @@
import com.android.systemui.FontSizeUtils;
import com.android.systemui.R;
+import libcore.util.Objects;
/** View that represents a standard quick settings tile. **/
public class QSTileView extends QSTileBaseView {
@@ -90,7 +91,9 @@
protected void handleStateChanged(QSTile.State state) {
super.handleStateChanged(state);
- mLabel.setText(state.label);
+ if (!Objects.equal(mLabel.getText(), state.label)) {
+ mLabel.setText(state.label);
+ }
mLabel.setEnabled(!state.disabledByPolicy);
mPadLock.setVisibility(state.disabledByPolicy ? View.VISIBLE : View.GONE);
}