How to programmatically invoke two applications in split screen mode (ideally, via ADB)?
3
votes
0
answers
185
views
##### Context
My OEM's AOSP distribution includes a version of
com.android.launcher3
that doesn't cope with "Split screen" mode. Summarily, [it crashes](https://forum.fairphone.com/t/i-am-unable-to-utilise-split-screen-mode-with-any-two-applications/118038?u=rokejulianlockhart) :
~~~YAML FATAL EXCEPTION: main Process: com.android.launcher3, PID: 5246 java.lang.NullPointerException: Attempt to invoke virtual method 'void com.android.quickstep.views.FloatingTaskView.getBoundsOnScreen(android.graphics.Rect)' on a null object reference at com.android.quickstep.views.RecentsView.confirmSplitSelect(RecentsView.java:4700) at com.android.quickstep.views.TaskView.confirmSecondSplitSelectApp(TaskView.java:763) at com.android.quickstep.views.TaskView.onClick(TaskView.java:747) at com.android.quickstep.views.TaskView.$r8$lambda$2dErZAYzRAWboZR0vn31kIz_HGY(Unknown Source:0) at com.android.quickstep.views.TaskView$$ExternalSyntheticLambda2.onClick(Unknown Source:2) at android.view.View.performClick(View.java:7660) at android.view.View.performClickInternal(View.java:7637) at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0) at android.view.View$PerformClick.run(View.java:30165) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8223) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:977) ~~~In order to file a useful report, I want to be able to deterministically invoke two (already installed) applications in "Split screen" mode. ##### Research 1. I've located [a bug report explaining that the way to perform this doesn't work anymore](https://issuetracker.google.com/issues/236675595#comment1:~:text=am%20start%2Dactivity%20%2Dn%20%3Cactivity%20component%3E%20%2D%2DwindowingMode%203&text=am%20start%2Dactivity%20%2Dn%20%3Cactivity%20component%3E%20%2D%2DwindowingMode%204) :
We use theHowever, [I've no indication that this is actually how one was ever meant to achieve this](https://issuetracker.google.com/issues/236675595#comment5:~:text=However%2C%20is%20this%20expected%20to%20generate%20a%20split%2Dscreen%20window?) , since even Google disregarded the report, when the original reporter didn't respond. 1. Additionally, [this doesn't appear to be possible to induce via code](https://stackoverflow.com/revisions/42981316/1#:~:text=It%20means%20that%20you%20can 't%20start%20split%20screen%20mode%20programmatically.%20You%20can%20just%20try%20to%20launch%20activity%20in%20another%20part%20of%20screen%20if%20you%20are%20already%20in%20split%20screen%20mode.): > It means that you can't start split screen mode programmatically. You can just try to launch activity in another part of screen if you are already in split screen mode. However, that's somewhat expected. It would also be for SO.--windowingMode
option with the ADB shell'sam start-activity
command in our automated testing. Historically, this has allowed us launch test apps in splitscreen mode without doing UI automation in the Pixel Launcher app. This strategy works effectively on API 31 emulators; however, it no longer works on the latest API 33 google-apis rev5 emulators. ##### Repro steps 1. Install the latest Android 13 google-apis emulator (rev5). 2. Install two apps on the emulator. 3. Launch the first app in the primary splitscreen mode via adb using the following command:4. Launch the second app in the secondary splitscreen mode via adb using the following command:#!/usr/bin/env bash am start-activity -n --windowingMode 3
##### Expected First app launches in the top half of the screen and second apps launches in the bottom half of the screen. ##### Actual The apps do not launch in splitscreen mode, so the second app simply launches on top of the first app.#!/usr/bin/env bash am start-activity -n --windowingMode 4
Asked by RokeJulianLockhart
(556 rep)
Apr 25, 2025, 03:36 PM
Last activity: Apr 26, 2025, 06:20 PM
Last activity: Apr 26, 2025, 06:20 PM