Handle density changes in QS
Bug: 26845796
Change-Id: Icc783c9d706382e553df49f699aaf44aac943d18
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 30a9850..b6269e2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -31,6 +31,7 @@
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.systemui.R;
import com.android.systemui.qs.QSTile.DetailAdapter;
+import com.android.systemui.qs.QSTile.Host.Callback;
import com.android.systemui.qs.customize.QSCustomizer;
import com.android.systemui.qs.external.CustomTile;
import com.android.systemui.settings.BrightnessController;
@@ -44,7 +45,7 @@
import java.util.Collection;
/** View that represents the quick settings tile panel. **/
-public class QSPanel extends LinearLayout implements Tunable {
+public class QSPanel extends LinearLayout implements Tunable, Callback {
public static final String QS_SHOW_BRIGHTNESS = "qs_show_brightness";
@@ -123,10 +124,16 @@
@Override
protected void onDetachedFromWindow() {
TunerService.get(mContext).removeTunable(this);
+ mHost.removeCallback(this);
super.onDetachedFromWindow();
}
@Override
+ public void onTilesChanged() {
+ setTiles(mHost.getTiles());
+ }
+
+ @Override
public void onTuningChanged(String key, String newValue) {
if (QS_SHOW_BRIGHTNESS.equals(key)) {
mBrightnessView.setVisibility(newValue == null || Integer.parseInt(newValue) != 0
@@ -168,6 +175,8 @@
public void setHost(QSTileHost host) {
mHost = host;
+ mHost.addCallback(this);
+ setTiles(mHost.getTiles());
mFooter.setHost(host);
createCustomizePanel();
}