Loading src/com/android/launcher3/Launcher.java +0 −10 Original line number Original line Diff line number Diff line Loading @@ -411,8 +411,6 @@ public class Launcher extends StatefulActivity<LauncherState> private final SettingsCache.OnChangeListener mNaturalScrollingChangedListener = private final SettingsCache.OnChangeListener mNaturalScrollingChangedListener = enabled -> mIsNaturalScrollingEnabled = enabled; enabled -> mIsNaturalScrollingEnabled = enabled; private int mActivityStopCount; // Used only by tests public static Launcher getLauncher(Context context) { public static Launcher getLauncher(Context context) { return fromContext(context); return fromContext(context); } } Loading Loading @@ -1054,18 +1052,10 @@ public class Launcher extends StatefulActivity<LauncherState> mAppWidgetHolder.setActivityStarted(false); mAppWidgetHolder.setActivityStarted(false); NotificationListener.removeNotificationsChangedListener(getPopupDataProvider()); NotificationListener.removeNotificationsChangedListener(getPopupDataProvider()); FloatingIconView.resetIconLoadResult(); FloatingIconView.resetIconLoadResult(); ++mActivityStopCount; AccessibilityManagerCompat.sendTestProtocolEventToTest( AccessibilityManagerCompat.sendTestProtocolEventToTest( this, LAUNCHER_ACTIVITY_STOPPED_MESSAGE); this, LAUNCHER_ACTIVITY_STOPPED_MESSAGE); } } /** Return activity stop count and reset it. Used only by tests. */ public int getAndResetActivityStopCount() { final int activityStopCount = mActivityStopCount; mActivityStopCount = 0; return activityStopCount; } @Override @Override protected void onStart() { protected void onStart() { TraceHelper.INSTANCE.beginSection(ON_START_EVT); TraceHelper.INSTANCE.beginSection(ON_START_EVT); Loading src/com/android/launcher3/testing/TestInformationHandler.java +0 −10 Original line number Original line Diff line number Diff line Loading @@ -214,16 +214,6 @@ public class TestInformationHandler implements ResourceBasedOverride { .forceAllowRotationForTesting(Boolean.parseBoolean(arg))); .forceAllowRotationForTesting(Boolean.parseBoolean(arg))); return response; return response; case TestProtocol.REQUEST_GET_AND_RESET_ACTIVITY_STOP_COUNT: { final Bundle bundle = getLauncherUIProperty(Bundle::putInt, launcher -> launcher.getAndResetActivityStopCount()); if (bundle != null) return bundle; // If Launcher activity wasn't created, 'it' was stopped 0 times. response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, 0); return response; } case TestProtocol.REQUEST_WORKSPACE_CELL_LAYOUT_SIZE: case TestProtocol.REQUEST_WORKSPACE_CELL_LAYOUT_SIZE: return getLauncherUIProperty(Bundle::putIntArray, launcher -> { return getLauncherUIProperty(Bundle::putIntArray, launcher -> { final Workspace<?> workspace = launcher.getWorkspace(); final Workspace<?> workspace = launcher.getWorkspace(); Loading tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -178,9 +178,6 @@ public final class TestProtocol { public static final String REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED = public static final String REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED = "unstash-bubble-bar-if-stashed"; "unstash-bubble-bar-if-stashed"; public static final String REQUEST_GET_AND_RESET_ACTIVITY_STOP_COUNT = "get-and-reset-activity-stops"; /** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */ /** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */ public static void testLogD(String tag, String message) { public static void testLogD(String tag, String message) { if (!sDebugTracing) { if (!sDebugTracing) { Loading tests/multivalentTests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -599,9 +599,6 @@ public abstract class AbstractLauncherUiTest { Wait.atMost("Launcher activity didn't stop", Wait.atMost("Launcher activity didn't stop", () -> !launcherInstrumentation.isLauncherActivityStarted(), () -> !launcherInstrumentation.isLauncherActivityStarted(), DEFAULT_ACTIVITY_TIMEOUT, launcherInstrumentation); DEFAULT_ACTIVITY_TIMEOUT, launcherInstrumentation); // Reset activity stop count. launcherInstrumentation.getAndResetActivityStopCount(); } } public static ActivityInfo resolveSystemAppInfo(String category) { public static ActivityInfo resolveSystemAppInfo(String category) { Loading tests/multivalentTests/src/com/android/launcher3/util/rule/TestIsolationRule.java +1 −5 Original line number Original line Diff line number Diff line Loading @@ -44,15 +44,11 @@ public class TestIsolationRule implements TestRule { return new Statement() { return new Statement() { @Override @Override public void evaluate() throws Throwable { public void evaluate() throws Throwable { // Reset activity stop count. mLauncher.getAndResetActivityStopCount(); base.evaluate(); base.evaluate(); // Make sure that Launcher workspace looks correct. // Make sure that Launcher workspace looks correct. UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).pressHome(); UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).pressHome(); AbstractLauncherUiTest.checkDetectedLeaks(mLauncher, mRequireOneActiveActivity); AbstractLauncherUiTest.checkDetectedLeaks(mLauncher, mRequireOneActiveActivity); mLauncher.assertNoUnexpectedStops(); } } }; }; } } Loading Loading
src/com/android/launcher3/Launcher.java +0 −10 Original line number Original line Diff line number Diff line Loading @@ -411,8 +411,6 @@ public class Launcher extends StatefulActivity<LauncherState> private final SettingsCache.OnChangeListener mNaturalScrollingChangedListener = private final SettingsCache.OnChangeListener mNaturalScrollingChangedListener = enabled -> mIsNaturalScrollingEnabled = enabled; enabled -> mIsNaturalScrollingEnabled = enabled; private int mActivityStopCount; // Used only by tests public static Launcher getLauncher(Context context) { public static Launcher getLauncher(Context context) { return fromContext(context); return fromContext(context); } } Loading Loading @@ -1054,18 +1052,10 @@ public class Launcher extends StatefulActivity<LauncherState> mAppWidgetHolder.setActivityStarted(false); mAppWidgetHolder.setActivityStarted(false); NotificationListener.removeNotificationsChangedListener(getPopupDataProvider()); NotificationListener.removeNotificationsChangedListener(getPopupDataProvider()); FloatingIconView.resetIconLoadResult(); FloatingIconView.resetIconLoadResult(); ++mActivityStopCount; AccessibilityManagerCompat.sendTestProtocolEventToTest( AccessibilityManagerCompat.sendTestProtocolEventToTest( this, LAUNCHER_ACTIVITY_STOPPED_MESSAGE); this, LAUNCHER_ACTIVITY_STOPPED_MESSAGE); } } /** Return activity stop count and reset it. Used only by tests. */ public int getAndResetActivityStopCount() { final int activityStopCount = mActivityStopCount; mActivityStopCount = 0; return activityStopCount; } @Override @Override protected void onStart() { protected void onStart() { TraceHelper.INSTANCE.beginSection(ON_START_EVT); TraceHelper.INSTANCE.beginSection(ON_START_EVT); Loading
src/com/android/launcher3/testing/TestInformationHandler.java +0 −10 Original line number Original line Diff line number Diff line Loading @@ -214,16 +214,6 @@ public class TestInformationHandler implements ResourceBasedOverride { .forceAllowRotationForTesting(Boolean.parseBoolean(arg))); .forceAllowRotationForTesting(Boolean.parseBoolean(arg))); return response; return response; case TestProtocol.REQUEST_GET_AND_RESET_ACTIVITY_STOP_COUNT: { final Bundle bundle = getLauncherUIProperty(Bundle::putInt, launcher -> launcher.getAndResetActivityStopCount()); if (bundle != null) return bundle; // If Launcher activity wasn't created, 'it' was stopped 0 times. response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, 0); return response; } case TestProtocol.REQUEST_WORKSPACE_CELL_LAYOUT_SIZE: case TestProtocol.REQUEST_WORKSPACE_CELL_LAYOUT_SIZE: return getLauncherUIProperty(Bundle::putIntArray, launcher -> { return getLauncherUIProperty(Bundle::putIntArray, launcher -> { final Workspace<?> workspace = launcher.getWorkspace(); final Workspace<?> workspace = launcher.getWorkspace(); Loading
tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -178,9 +178,6 @@ public final class TestProtocol { public static final String REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED = public static final String REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED = "unstash-bubble-bar-if-stashed"; "unstash-bubble-bar-if-stashed"; public static final String REQUEST_GET_AND_RESET_ACTIVITY_STOP_COUNT = "get-and-reset-activity-stops"; /** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */ /** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */ public static void testLogD(String tag, String message) { public static void testLogD(String tag, String message) { if (!sDebugTracing) { if (!sDebugTracing) { Loading
tests/multivalentTests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -599,9 +599,6 @@ public abstract class AbstractLauncherUiTest { Wait.atMost("Launcher activity didn't stop", Wait.atMost("Launcher activity didn't stop", () -> !launcherInstrumentation.isLauncherActivityStarted(), () -> !launcherInstrumentation.isLauncherActivityStarted(), DEFAULT_ACTIVITY_TIMEOUT, launcherInstrumentation); DEFAULT_ACTIVITY_TIMEOUT, launcherInstrumentation); // Reset activity stop count. launcherInstrumentation.getAndResetActivityStopCount(); } } public static ActivityInfo resolveSystemAppInfo(String category) { public static ActivityInfo resolveSystemAppInfo(String category) { Loading
tests/multivalentTests/src/com/android/launcher3/util/rule/TestIsolationRule.java +1 −5 Original line number Original line Diff line number Diff line Loading @@ -44,15 +44,11 @@ public class TestIsolationRule implements TestRule { return new Statement() { return new Statement() { @Override @Override public void evaluate() throws Throwable { public void evaluate() throws Throwable { // Reset activity stop count. mLauncher.getAndResetActivityStopCount(); base.evaluate(); base.evaluate(); // Make sure that Launcher workspace looks correct. // Make sure that Launcher workspace looks correct. UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).pressHome(); UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).pressHome(); AbstractLauncherUiTest.checkDetectedLeaks(mLauncher, mRequireOneActiveActivity); AbstractLauncherUiTest.checkDetectedLeaks(mLauncher, mRequireOneActiveActivity); mLauncher.assertNoUnexpectedStops(); } } }; }; } } Loading