Loading packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,10 @@ public class TileLifecycleManager extends BroadcastReceiver implements }); } boolean isBound() { return mBound.get(); } @WorkerThread private void setBindService(boolean bind) { if (mBound.get() && mUnbindImmediate.get()) { Loading packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java +5 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,11 @@ public class TileServiceManager { Log.e(TAG, "Service already bound"); return; } if (!mStateManager.isBound()) { // If we are bound, we don't need to set a pending bind. There's either one already or // we are fully bound. mPendingBind = true; } mBound = true; mJustBound = true; mHandler.postDelayed(mJustBoundOver, MIN_BIND_TIME); Loading packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceManagerTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static android.platform.test.flag.junit.FlagsParameterization.allCombinat import static com.android.systemui.Flags.FLAG_QS_CUSTOM_TILE_CLICK_GUARANTEED_BUG_FIX; import static com.android.systemui.util.concurrency.MockExecutorHandlerKt.mockExecutorHandler; import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; Loading Loading @@ -279,4 +281,23 @@ public class TileServiceManagerTest extends SysuiTestCase { verify(mTileLifecycle, never()).onStopListening(); verify(mTileLifecycle, never()).executeSetBindService(false); } @Test public void testNoExtraPendingBindIfAlreadyBound() { mTileServiceManager.startLifecycleManagerAndAddTile(); // As part of adding the tile, it will be bound and it will send a start successful to // TileServices. startSuccessful will clear pending bind mTileServiceManager.clearPendingBind(); // Assume we are still bound when(mTileLifecycle.isBound()).thenReturn(true); // And we want to bind again mTileServiceManager.setBindAllowed(true); mTileServiceManager.setBindRequested(true); // Then the tile doesn't have pending bind assertThat(mTileServiceManager.hasPendingBind()).isFalse(); } } Loading
packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,10 @@ public class TileLifecycleManager extends BroadcastReceiver implements }); } boolean isBound() { return mBound.get(); } @WorkerThread private void setBindService(boolean bind) { if (mBound.get() && mUnbindImmediate.get()) { Loading
packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java +5 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,11 @@ public class TileServiceManager { Log.e(TAG, "Service already bound"); return; } if (!mStateManager.isBound()) { // If we are bound, we don't need to set a pending bind. There's either one already or // we are fully bound. mPendingBind = true; } mBound = true; mJustBound = true; mHandler.postDelayed(mJustBoundOver, MIN_BIND_TIME); Loading
packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceManagerTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static android.platform.test.flag.junit.FlagsParameterization.allCombinat import static com.android.systemui.Flags.FLAG_QS_CUSTOM_TILE_CLICK_GUARANTEED_BUG_FIX; import static com.android.systemui.util.concurrency.MockExecutorHandlerKt.mockExecutorHandler; import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; Loading Loading @@ -279,4 +281,23 @@ public class TileServiceManagerTest extends SysuiTestCase { verify(mTileLifecycle, never()).onStopListening(); verify(mTileLifecycle, never()).executeSetBindService(false); } @Test public void testNoExtraPendingBindIfAlreadyBound() { mTileServiceManager.startLifecycleManagerAndAddTile(); // As part of adding the tile, it will be bound and it will send a start successful to // TileServices. startSuccessful will clear pending bind mTileServiceManager.clearPendingBind(); // Assume we are still bound when(mTileLifecycle.isBound()).thenReturn(true); // And we want to bind again mTileServiceManager.setBindAllowed(true); mTileServiceManager.setBindRequested(true); // Then the tile doesn't have pending bind assertThat(mTileServiceManager.hasPendingBind()).isFalse(); } }