javaandroidkotlinandroid-serviceaccessibilityservice

Alternative to "performGlobalAction(GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN)" in Android Accessibility Service? How to enable it programmatically?


I've been using the GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN global accessibility action in my Android accessibility service to enable split-screen mode programmatically. However, it appears that this action is not available in recent Android versions.

I have searched extensively but couldn't find any documented alternative or workaround to achieve the same functionality. Enabling split-screen mode programmatically is crucial for my app's functionality.

Could someone please provide insights or code snippets on how to achieve split-screen functionality programmatically in the absence of GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN?

I have also refer this Issue: https://issuetracker.google.com/issues/225186417

Thank you for your assistance!


Solution

  • I found a solution:

    val intent = Intent().apply {
    component = ComponentName("com.google.android.apps.messaging", "com.google.android.apps.messaging.home.HomeActivity")
        addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT)
        addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
    }
    this.startActivity(intent)
    

    Seems to be the only option to trigger split screen in Android 13.

    The down side is this works only on Android 13, afaik, and you need to name the app and activity that should take the second screen, contrary to GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN, which just opened split screen and let the user choose which app to open.