Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1c6fb55 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Remove Handler messages on QSTileImpl destroy"

parents 3a70dd66 30aa3add
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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) {
+10 −0
Original line number Diff line number Diff line
@@ -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;