Loading ext_tests/src/com/android/launcher3/testing/DebugTestInformationHandler.java +15 −0 Original line number Diff line number Diff line Loading @@ -188,12 +188,27 @@ public class DebugTestInformationHandler extends TestInformationHandler { return response; } case TestProtocol.REQUEST_REINITIALIZE_DATA: { final long identity = Binder.clearCallingIdentity(); try { MODEL_EXECUTOR.execute(() -> { LauncherModel model = LauncherAppState.getInstance(mContext).getModel(); model.getModelDbController().createEmptyDB(); MAIN_EXECUTOR.execute(model::forceReload); }); return response; } finally { Binder.restoreCallingIdentity(identity); } } case TestProtocol.REQUEST_CLEAR_DATA: { final long identity = Binder.clearCallingIdentity(); try { MODEL_EXECUTOR.execute(() -> { LauncherModel model = LauncherAppState.getInstance(mContext).getModel(); model.getModelDbController().createEmptyDB(); model.getModelDbController().clearEmptyDbFlag(); MAIN_EXECUTOR.execute(model::forceReload); }); return response; Loading tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +1 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ public final class TestProtocol { public static final String REQUEST_GET_TEST_EVENTS = "get-test-events"; public static final String REQUEST_GET_HAD_NONTEST_EVENTS = "get-had-nontest-events"; public static final String REQUEST_STOP_EVENT_LOGGING = "stop-event-logging"; public static final String REQUEST_REINITIALIZE_DATA = "reinitialize-data"; public static final String REQUEST_CLEAR_DATA = "clear-data"; public static final String REQUEST_HOTSEAT_ICON_NAMES = "get-hotseat-icon-names"; public static final String REQUEST_IS_TABLET = "is-tablet"; Loading tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +10 −2 Original line number Diff line number Diff line Loading @@ -291,8 +291,16 @@ public abstract class AbstractLauncherUiTest { } } protected void clearLauncherData() { protected void reinitializeLauncherData() { reinitializeLauncherData(false); } protected void reinitializeLauncherData(boolean clearWorkspace) { if (clearWorkspace) { mLauncher.clearLauncherData(); } else { mLauncher.reinitializeLauncherData(); } mLauncher.waitForLauncherInitialized(); } Loading tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +8 −3 Original line number Diff line number Diff line Loading @@ -97,7 +97,12 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } public static void initialize(AbstractLauncherUiTest test) throws Exception { test.clearLauncherData(); initialize(test, false); } public static void initialize( AbstractLauncherUiTest test, boolean clearWorkspace) throws Exception { test.reinitializeLauncherData(clearWorkspace); test.mDevice.pressHome(); test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null); test.waitForState("Launcher internal state didn't switch to Home", Loading Loading @@ -248,7 +253,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { LauncherLayoutBuilder builder = new LauncherLayoutBuilder() .atHotseat(0).putApp("com.android.chrome", "com.google.android.apps.chrome.Main"); mLauncherLayout = TestUtil.setLauncherDefaultLayout(mTargetContext, builder); clearLauncherData(); reinitializeLauncherData(); final Workspace workspace = mLauncher.getWorkspace(); Loading Loading @@ -557,7 +562,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { allApps.unfreeze(); } // Reset the workspace for the next shortcut creation. initialize(this); initialize(this, true); endTime = SystemClock.uptimeMillis(); elapsedTime = endTime - startTime; Log.d("testDragAppIconToWorkspaceCellTime", Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +6 −0 Original line number Diff line number Diff line Loading @@ -1855,6 +1855,12 @@ public final class LauncherInstrumentation { return tasks; } /** Reinitializes the workspace to its default layout. */ public void reinitializeLauncherData() { getTestInfo(TestProtocol.REQUEST_REINITIALIZE_DATA); } /** Clears the workspace, leaving it empty. */ public void clearLauncherData() { getTestInfo(TestProtocol.REQUEST_CLEAR_DATA); } Loading Loading
ext_tests/src/com/android/launcher3/testing/DebugTestInformationHandler.java +15 −0 Original line number Diff line number Diff line Loading @@ -188,12 +188,27 @@ public class DebugTestInformationHandler extends TestInformationHandler { return response; } case TestProtocol.REQUEST_REINITIALIZE_DATA: { final long identity = Binder.clearCallingIdentity(); try { MODEL_EXECUTOR.execute(() -> { LauncherModel model = LauncherAppState.getInstance(mContext).getModel(); model.getModelDbController().createEmptyDB(); MAIN_EXECUTOR.execute(model::forceReload); }); return response; } finally { Binder.restoreCallingIdentity(identity); } } case TestProtocol.REQUEST_CLEAR_DATA: { final long identity = Binder.clearCallingIdentity(); try { MODEL_EXECUTOR.execute(() -> { LauncherModel model = LauncherAppState.getInstance(mContext).getModel(); model.getModelDbController().createEmptyDB(); model.getModelDbController().clearEmptyDbFlag(); MAIN_EXECUTOR.execute(model::forceReload); }); return response; Loading
tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +1 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ public final class TestProtocol { public static final String REQUEST_GET_TEST_EVENTS = "get-test-events"; public static final String REQUEST_GET_HAD_NONTEST_EVENTS = "get-had-nontest-events"; public static final String REQUEST_STOP_EVENT_LOGGING = "stop-event-logging"; public static final String REQUEST_REINITIALIZE_DATA = "reinitialize-data"; public static final String REQUEST_CLEAR_DATA = "clear-data"; public static final String REQUEST_HOTSEAT_ICON_NAMES = "get-hotseat-icon-names"; public static final String REQUEST_IS_TABLET = "is-tablet"; Loading
tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +10 −2 Original line number Diff line number Diff line Loading @@ -291,8 +291,16 @@ public abstract class AbstractLauncherUiTest { } } protected void clearLauncherData() { protected void reinitializeLauncherData() { reinitializeLauncherData(false); } protected void reinitializeLauncherData(boolean clearWorkspace) { if (clearWorkspace) { mLauncher.clearLauncherData(); } else { mLauncher.reinitializeLauncherData(); } mLauncher.waitForLauncherInitialized(); } Loading
tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +8 −3 Original line number Diff line number Diff line Loading @@ -97,7 +97,12 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } public static void initialize(AbstractLauncherUiTest test) throws Exception { test.clearLauncherData(); initialize(test, false); } public static void initialize( AbstractLauncherUiTest test, boolean clearWorkspace) throws Exception { test.reinitializeLauncherData(clearWorkspace); test.mDevice.pressHome(); test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null); test.waitForState("Launcher internal state didn't switch to Home", Loading Loading @@ -248,7 +253,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { LauncherLayoutBuilder builder = new LauncherLayoutBuilder() .atHotseat(0).putApp("com.android.chrome", "com.google.android.apps.chrome.Main"); mLauncherLayout = TestUtil.setLauncherDefaultLayout(mTargetContext, builder); clearLauncherData(); reinitializeLauncherData(); final Workspace workspace = mLauncher.getWorkspace(); Loading Loading @@ -557,7 +562,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { allApps.unfreeze(); } // Reset the workspace for the next shortcut creation. initialize(this); initialize(this, true); endTime = SystemClock.uptimeMillis(); elapsedTime = endTime - startTime; Log.d("testDragAppIconToWorkspaceCellTime", Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +6 −0 Original line number Diff line number Diff line Loading @@ -1855,6 +1855,12 @@ public final class LauncherInstrumentation { return tasks; } /** Reinitializes the workspace to its default layout. */ public void reinitializeLauncherData() { getTestInfo(TestProtocol.REQUEST_REINITIALIZE_DATA); } /** Clears the workspace, leaving it empty. */ public void clearLauncherData() { getTestInfo(TestProtocol.REQUEST_CLEAR_DATA); } Loading