From adb380a7d1232be6acf67ef0d2c7c8bad72314b7 Mon Sep 17 00:00:00 2001 From: Dave Mankoff Date: Tue, 10 Dec 2019 15:31:58 -0500 Subject: [PATCH] Remove FakeSystemClock.setAutoIncrement. No test was relying on that behavior. Most tests were turning it off. Bug: 145739633 Test: atest SystemUITests Change-Id: I069241ae2d325facf2cf1aece6b28a42812144a4 --- .../qs/customize/TileQueryHelperTest.java | 1 - .../collection/NotifListBuilderImplTest.java | 1 - .../util/concurrency/FakeExecutorTest.java | 6 ----- .../systemui/util/time/FakeSystemClock.java | 25 ------------------- 4 files changed, 33 deletions(-) diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java index 39ce8c1209ac1..8a9a7a28efb7d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java @@ -120,7 +120,6 @@ public class TileQueryHelperTest extends SysuiTestCase { ).when(mQSTileHost).createTile(anyString()); FakeSystemClock clock = new FakeSystemClock(); - clock.setAutoIncrement(false); mMainExecutor = new FakeExecutor(clock); mBgExecutor = new FakeExecutor(clock); mTileQueryHelper = new TileQueryHelper(mContext, mMainExecutor, mBgExecutor); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifListBuilderImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifListBuilderImplTest.java index a25af84ca28ef..ffaea156c9d5e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifListBuilderImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifListBuilderImplTest.java @@ -690,7 +690,6 @@ public class NotifListBuilderImplTest extends SysuiTestCase { mListBuilder.addFilter(filter3); // GIVEN the SystemClock is set to a particular time: - mSystemClock.setAutoIncrement(true); mSystemClock.setUptimeMillis(47); // WHEN the pipeline is kicked off on a list of notifs diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/concurrency/FakeExecutorTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/concurrency/FakeExecutorTest.java index b1716ff47129e..bd641243be12d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/util/concurrency/FakeExecutorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/util/concurrency/FakeExecutorTest.java @@ -49,7 +49,6 @@ public class FakeExecutorTest extends SysuiTestCase { @Test public void testNoDelay() { FakeSystemClock clock = new FakeSystemClock(); - clock.setAutoIncrement(false); FakeExecutor fakeExecutor = new FakeExecutor(clock); RunnableImpl runnable = new RunnableImpl(); @@ -99,7 +98,6 @@ public class FakeExecutorTest extends SysuiTestCase { @Test public void testDelayed() { FakeSystemClock clock = new FakeSystemClock(); - clock.setAutoIncrement(false); FakeExecutor fakeExecutor = new FakeExecutor(clock); RunnableImpl runnable = new RunnableImpl(); @@ -134,7 +132,6 @@ public class FakeExecutorTest extends SysuiTestCase { @Test public void testDelayed_AdvanceAndRun() { FakeSystemClock clock = new FakeSystemClock(); - clock.setAutoIncrement(false); FakeExecutor fakeExecutor = new FakeExecutor(clock); RunnableImpl runnable = new RunnableImpl(); @@ -181,7 +178,6 @@ public class FakeExecutorTest extends SysuiTestCase { @Test public void testExecutionOrder() { FakeSystemClock clock = new FakeSystemClock(); - clock.setAutoIncrement(false); FakeExecutor fakeExecutor = new FakeExecutor(clock); RunnableImpl runnableA = new RunnableImpl(); RunnableImpl runnableB = new RunnableImpl(); @@ -251,7 +247,6 @@ public class FakeExecutorTest extends SysuiTestCase { @Test public void testRemoval_single() { FakeSystemClock clock = new FakeSystemClock(); - clock.setAutoIncrement(false); FakeExecutor fakeExecutor = new FakeExecutor(clock); RunnableImpl runnable = new RunnableImpl(); Runnable removeFunction; @@ -291,7 +286,6 @@ public class FakeExecutorTest extends SysuiTestCase { @Test public void testRemoval_multi() { FakeSystemClock clock = new FakeSystemClock(); - clock.setAutoIncrement(false); FakeExecutor fakeExecutor = new FakeExecutor(clock); List removeFunctions = new ArrayList<>(); RunnableImpl runnable = new RunnableImpl(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/time/FakeSystemClock.java b/packages/SystemUI/tests/src/com/android/systemui/util/time/FakeSystemClock.java index 65e5902c84dfa..e94eaafdb6927 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/util/time/FakeSystemClock.java +++ b/packages/SystemUI/tests/src/com/android/systemui/util/time/FakeSystemClock.java @@ -20,8 +20,6 @@ import java.util.ArrayList; import java.util.List; public class FakeSystemClock implements SystemClock { - private boolean mAutoIncrement = true; - private long mUptimeMillis; private long mElapsedRealtime; private long mElapsedRealtimeNanos; @@ -34,54 +32,36 @@ public class FakeSystemClock implements SystemClock { @Override public long uptimeMillis() { long value = mUptimeMillis; - if (mAutoIncrement) { - setUptimeMillis(mUptimeMillis + 1); - } return value; } @Override public long elapsedRealtime() { long value = mElapsedRealtime; - if (mAutoIncrement) { - setElapsedRealtime(mElapsedRealtime + 1); - } return value; } @Override public long elapsedRealtimeNanos() { long value = mElapsedRealtimeNanos; - if (mAutoIncrement) { - setElapsedRealtimeNanos(mElapsedRealtimeNanos + 1); - } return value; } @Override public long currentThreadTimeMillis() { long value = mCurrentThreadTimeMillis; - if (mAutoIncrement) { - setCurrentThreadTimeMillis(mCurrentThreadTimeMillis + 1); - } return value; } @Override public long currentThreadTimeMicro() { long value = mCurrentThreadTimeMicro; - if (mAutoIncrement) { - setCurrentThreadTimeMicro(mCurrentThreadTimeMicro + 1); - } return value; } @Override public long currentTimeMicro() { long value = mCurrentTimeMicro; - if (mAutoIncrement) { - setCurrentTimeMicro(mCurrentTimeMicro + 1); - } return value; } @@ -127,11 +107,6 @@ public class FakeSystemClock implements SystemClock { } } - /** If true, each call to get____ will be one higher than the previous call to that method. */ - public void setAutoIncrement(boolean autoIncrement) { - mAutoIncrement = autoIncrement; - } - public void addListener(ClockTickListener listener) { mListeners.add(listener); }