QS: Only put visible tiles in listening state
- Make it so the QSPanel doesn't listen until expansion starts
- Push listening state through the TileLayout
- Make PagedTileLayout only listen for visible pages
- Push setListening onto background thread
Change-Id: Id7c008c9447f9a5dac69469fef72bc580f423b0c
Fixes: 28962155
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index bab63f1..ded91fd 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -57,7 +57,7 @@
private int mPanelPaddingBottom;
private int mBrightnessPaddingTop;
protected boolean mExpanded;
- private boolean mListening;
+ protected boolean mListening;
private Callback mCallback;
private BrightnessController mBrightnessController;
@@ -102,6 +102,7 @@
protected void setupTileLayout() {
mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate(
R.layout.qs_paged_tile_layout, this, false);
+ mTileLayout.setListening(mListening);
addView((View) mTileLayout);
}
@@ -233,8 +234,8 @@
public void setListening(boolean listening) {
if (mListening == listening) return;
mListening = listening;
- for (TileRecord r : mRecords) {
- r.tile.setListening(mListening);
+ if (mTileLayout != null) {
+ mTileLayout.setListening(listening);
}
mFooter.setListening(mListening);
if (mListening) {
@@ -348,7 +349,6 @@
}
};
r.tileView.init(click, longClick);
- r.tile.setListening(mListening);
callback.onStateChanged(r.tile.getState());
r.tile.refreshState();
mRecords.add(r);
@@ -541,5 +541,7 @@
void removeTile(TileRecord tile);
int getOffsetTop(TileRecord tile);
boolean updateResources();
+
+ void setListening(boolean listening);
}
}