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
This commit is contained in:
Amin Shaikh
2018-08-16 10:49:48 -04:00
parent ace398c3fb
commit 299c45c85d
4 changed files with 5 additions and 22 deletions

View File

@@ -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);

View File

@@ -285,9 +285,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
updatePageIndicator();
for (TileRecord r : mRecords) {
r.tile.clearState();
}
if (mListening) {
refreshAllTiles();
}

View File

@@ -95,7 +95,6 @@ public class TileQueryHelper {
continue;
}
tile.setListening(this, true);
tile.clearState();
tile.refreshState();
tile.setListening(this, false);
tile.setTileSpec(spec);

View File

@@ -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);