summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmin Shaikh <ashaikh@google.com>2018-08-16 10:49:48 -0400
committerAmin Shaikh <ashaikh@google.com>2018-08-20 23:40:09 +0000
commit334d1bceb526cc343428ab8ff625800b15f21283 (patch)
tree54ea49b8e2e8bfe1d1bf21f04ced126489bd105d
parente4e1b4fbec5cb1429a7b58ae57f075de7921735c (diff)
downloadbase-334d1bceb526cc343428ab8ff625800b15f21283.tar.gz
Never clear QS tile state.
QSTile#clearState puts QS tiles in an invalid state that may not be immediately rectified through QSTile#refreshState. In the case of configuration changes, if a subclass implementation of QSTile#handleSetListening does not trigger a refresh state, the invalid state causes incorrect click handling. Change-Id: I17eba133cf08c45a768e9e0ed8fda623e85b4370 Fixes: 69738120 Fixes: 110480955 Test: manual (cherry picked from commit 299c45c85d41975514022263fa6a29329eb5a0bc)
-rw-r--r--packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanel.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java21
4 files changed, 5 insertions, 22 deletions
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java
index 61f7fe8dc019..bf4374acf6e6 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java
@@ -43,7 +43,7 @@ public interface QSTile {
boolean isAvailable();
void setTileSpec(String tileSpec);
- void clearState();
+ @Deprecated default void clearState() {}
void refreshState();
void addCallback(Callback callback);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 0876a5d3f456..3fc258b1e8e9 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -285,9 +285,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
updatePageIndicator();
- for (TileRecord r : mRecords) {
- r.tile.clearState();
- }
if (mListening) {
refreshAllTiles();
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
index 53a576d3519d..591e9e015897 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
@@ -95,7 +95,6 @@ public class TileQueryHelper {
continue;
}
tile.setListening(this, true);
- tile.clearState();
tile.refreshState();
tile.setListening(this, false);
tile.setTileSpec(spec);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
index 834feb7781ea..022a2b4a5fbf 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
@@ -211,10 +211,6 @@ public abstract class QSTileImpl<TState extends State> implements QSTile {
mHandler.obtainMessage(H.REFRESH_STATE, arg).sendToTarget();
}
- public void clearState() {
- mHandler.sendEmptyMessage(H.CLEAR_STATE);
- }
-
public void userSwitch(int newUserId) {
mHandler.obtainMessage(H.USER_SWITCH, newUserId, 0).sendToTarget();
}
@@ -266,11 +262,6 @@ public abstract class QSTileImpl<TState extends State> implements QSTile {
public abstract Intent getLongClickIntent();
- protected void handleClearState() {
- mTmpState = newTileState();
- mState = newTileState();
- }
-
protected void handleRefreshState(Object arg) {
handleUpdateState(mTmpState, arg);
final boolean changed = mTmpState.copyTo(mState);
@@ -409,11 +400,10 @@ public abstract class QSTileImpl<TState extends State> implements QSTile {
private static final int TOGGLE_STATE_CHANGED = 8;
private static final int SCAN_STATE_CHANGED = 9;
private static final int DESTROY = 10;
- private static final int CLEAR_STATE = 11;
- private static final int REMOVE_CALLBACKS = 12;
- private static final int REMOVE_CALLBACK = 13;
- private static final int SET_LISTENING = 14;
- private static final int STALE = 15;
+ private static final int REMOVE_CALLBACKS = 11;
+ private static final int REMOVE_CALLBACK = 12;
+ private static final int SET_LISTENING = 13;
+ private static final int STALE = 14;
@VisibleForTesting
protected H(Looper looper) {
@@ -467,9 +457,6 @@ public abstract class QSTileImpl<TState extends State> implements QSTile {
} else if (msg.what == DESTROY) {
name = "handleDestroy";
handleDestroy();
- } else if (msg.what == CLEAR_STATE) {
- name = "handleClearState";
- handleClearState();
} else if (msg.what == SET_LISTENING) {
name = "handleSetListeningInternal";
handleSetListeningInternal(msg.obj, msg.arg1 != 0);