Add compat for secondary splitscreen window option
Test: Tested that compiles and option works in plugin Change-Id: I4861e09fe4bba6c1a0ec57395939aa293dd95347 (cherry picked from commit 401c20314169cfd2f50c926bdabd78d4c76502d3)
This commit is contained in:
committed by
Nadia Benbernou
parent
4d1a60d70f
commit
ab47e04df5
@@ -20,6 +20,7 @@ import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR
|
||||
import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
|
||||
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
@@ -31,11 +32,20 @@ import android.os.Handler;
|
||||
public abstract class ActivityOptionsCompat {
|
||||
|
||||
/**
|
||||
* @return ActivityOptions for starting a task in split screen.
|
||||
* @return ActivityOptions for starting a task in split screen as the primary window.
|
||||
*/
|
||||
public static ActivityOptions makeSplitScreenOptions(boolean dockTopLeft) {
|
||||
return makeSplitScreenOptions(dockTopLeft, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ActivityOptions for starting a task in split screen.
|
||||
*/
|
||||
public static ActivityOptions makeSplitScreenOptions(boolean dockTopLeft, boolean isPrimary) {
|
||||
final ActivityOptions options = ActivityOptions.makeBasic();
|
||||
options.setLaunchWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
|
||||
options.setLaunchWindowingMode(isPrimary
|
||||
? WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
|
||||
: WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
|
||||
options.setSplitScreenCreateMode(dockTopLeft
|
||||
? SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT
|
||||
: SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT);
|
||||
|
||||
Reference in New Issue
Block a user