diff options
| author | 2019-12-16 14:53:40 +0000 | |
|---|---|---|
| committer | 2019-12-16 14:53:40 +0000 | |
| commit | d1c6fb55eac75bc46536f6972054f5c237f8252c (patch) | |
| tree | cb890a5a858d1f8e2394f4f454206f276a26a9e9 | |
| parent | 3a70dd663e3fd0738cf728057e4202a9f40fd948 (diff) | |
| parent | 30aa3add8555a887c74bcb2ef18c559f5d592853 (diff) | |
Merge "Remove Handler messages on QSTileImpl destroy"
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java | 1 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java | 10 |
2 files changed, 11 insertions, 0 deletions
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 e0f26cd1a267..1d379110325a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java @@ -413,6 +413,7 @@ public abstract class QSTileImpl<TState extends State> implements QSTile, Lifecy handleSetListening(false); } mCallbacks.clear(); + mHandler.removeCallbacksAndMessages(null); } protected void checkIfRestrictionEnforcedByAdminOnly(State state, String userRestriction) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java index 192d8f8e8226..49b47c5c72d4 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java @@ -188,6 +188,16 @@ public class QSTileImplTest extends SysuiTestCase { verify(mTile).handleSetListening(eq(false)); } + @Test + public void testHandleDestroyClearsHandlerQueue() { + when(mTile.getStaleTimeout()).thenReturn(0L); + mTile.handleRefreshState(null); // this will add a delayed H.STALE message + mTile.handleDestroy(); + + mTestableLooper.processAllMessages(); + verify(mTile, never()).handleStale(); + } + private class TileLogMatcher implements ArgumentMatcher<LogMaker> { private final int mCategory; |