Android - Multi-window: prevent the out-of-focus app from pausing?
Early this November, Google has confirmed that multi-resume - running two apps simultaneously without pausing - will be part of the next major Android release (Q), thus indirectly confirming that this functionality is currently not a part of AOSP Android.
However, Google also stated that...
To help developers provide the best user experience on multi-window with minimal effort, we're allowing device manufacturers to keep all apps resumed when in multi-windows in P.
To opt-in to this behavior in Android P, add the following meta-data in your app manifest:
<meta-data android:name="android.allow_multiple_resumed_activities" android:value="true" />
How to test: There are no device at the moment with this behavior but device manufacturers are working to update existing devices to allow developers to test. Stay tuned for more details from device manufacturers.
This implies that such functionality will be available in Android P at a later time. As of now (December 2018) though, there is zero reference to allow_multiple_resumed_activities
in AOSP Android code, meaning that the time has yet to come.
Sources: Google Blog, XDA-Developers
Android Q beta was released on March 13, 2019, marking the first public debut of the multi-resume feature on non-OEM Android. Unfortunately, there's still no reference to allow_multiple_resumed_activities
in AOSP Android P code (Q not open-source yet, obviously), and the "There are no device at the moment with this behavior" statement didn't change in the aforementioned blog either - the situation remains unchanged for the majority of users and the custom ROM community.
As of the formal release of Android 10, multi-resume has been made the default behaviour, as indicated in the multi-resume design page.
No that's not something you can effect as a user, or a developer. The multi-window behavior is defined by Android and any device that calls itself "Android" has implement the rules for multi-window life cycle.
The bottom line is the app needs to be coded to respect the resume/pause vs. start/stop differentiation. Prior to the invention of multi window the distinction between the two was tenuous at best. Now it actually matters.
In my experience, Google apps do a great job of working with multi window and it's hit or miss with everything else. YMMV.