From 9097d7d09f96c2459690c10701b0dce54cdb215c Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Thu, 16 Jun 2022 14:43:42 -0700 Subject: [PATCH] Added a content call to emulate the other devices displays Running the following commands should change your connected device display: adb root adb shell setprop ro.test_harness 1 adb shell pm enable --user 0 com.google.android.apps.nexuslauncher/com.android.launcher3.testing.TestInformationProvider adb shell content call --uri content://com.google.android.apps.nexuslauncher.TestInfo --method emulate-display --extra device:s:pixel5 --extra grid:s:crazy_big adb shell setprop ro.test_harness 0 Alternative method for this is using ./display_emulator.py emulate --device pixel5 I hooked up the existing DisplayEmulator into a content provider. Doing this has a couple advantages to the previous method of calling the emulator inside of a test. The biggest one is that running the emulation doesn't restarts the Launcher3, and because of that the previous method could leave the user in a fake emulation where it looks like the device is being emulated but is not 100% accurate. Test: Run the command lines described above. Fix: 229666646 Change-Id: Ia039fbaf4c7330d6bdf469633127f58d2466a1bf --- src/com/android/launcher3/testing/TestProtocol.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 3a030a8b87..b76e9d55b4 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -139,4 +139,9 @@ public final class TestProtocol { public static final String MISSING_PROMISE_ICON = "b/202985412"; public static final String BAD_STATE = "b/223498680"; public static final String TASKBAR_IN_APP_STATE = "b/227657604"; + + public static final String REQUEST_EMULATE_DISPLAY = "emulate-display"; + public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display"; + public static final String REQUEST_IS_EMULATE_DISPLAY_RUNNING = "is-emulate-display-running"; + public static final String REQUEST_EMULATE_PRINT_DEVICE = "emulate-print-device"; }