Merge "Update the split screen APIs used by the launcher" into sc-dev
This commit is contained in:
@@ -234,8 +234,8 @@ public class DragAndDropPolicy {
|
|||||||
final UserHandle user = intent.getParcelableExtra(EXTRA_USER);
|
final UserHandle user = intent.getParcelableExtra(EXTRA_USER);
|
||||||
mStarter.startShortcut(packageName, id, stage, position, opts, user);
|
mStarter.startShortcut(packageName, id, stage, position, opts, user);
|
||||||
} else {
|
} else {
|
||||||
mStarter.startIntent(intent.getParcelableExtra(EXTRA_PENDING_INTENT), stage, position,
|
mStarter.startIntent(intent.getParcelableExtra(EXTRA_PENDING_INTENT),
|
||||||
opts);
|
mContext, null, stage, position, opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +295,8 @@ public class DragAndDropPolicy {
|
|||||||
@Nullable Bundle options);
|
@Nullable Bundle options);
|
||||||
void startShortcut(String packageName, String shortcutId, @StageType int stage,
|
void startShortcut(String packageName, String shortcutId, @StageType int stage,
|
||||||
@StagePosition int position, @Nullable Bundle options, UserHandle user);
|
@StagePosition int position, @Nullable Bundle options, UserHandle user);
|
||||||
void startIntent(PendingIntent intent, @StageType int stage, @StagePosition int position,
|
void startIntent(PendingIntent intent, Context context, Intent fillInIntent,
|
||||||
|
@StageType int stage, @StagePosition int position,
|
||||||
@Nullable Bundle options);
|
@Nullable Bundle options);
|
||||||
void enterSplitScreen(int taskId, boolean leftOrTop);
|
void enterSplitScreen(int taskId, boolean leftOrTop);
|
||||||
void exitSplitScreen();
|
void exitSplitScreen();
|
||||||
@@ -336,10 +337,11 @@ public class DragAndDropPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startIntent(PendingIntent intent, int stage, int position,
|
public void startIntent(PendingIntent intent, Context context,
|
||||||
|
@Nullable Intent fillInIntent, int stage, int position,
|
||||||
@Nullable Bundle options) {
|
@Nullable Bundle options) {
|
||||||
try {
|
try {
|
||||||
intent.send(null, 0, null, null, null, null, options);
|
intent.send(mContext, 0, fillInIntent, null, null, null, options);
|
||||||
} catch (PendingIntent.CanceledException e) {
|
} catch (PendingIntent.CanceledException e) {
|
||||||
Slog.e(TAG, "Failed to launch activity", e);
|
Slog.e(TAG, "Failed to launch activity", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,18 +19,17 @@ package com.android.wm.shell.splitscreen;
|
|||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
import com.android.wm.shell.common.annotations.ExternalThread;
|
||||||
import com.android.wm.shell.draganddrop.DragAndDropPolicy;
|
import com.android.wm.shell.draganddrop.DragAndDropPolicy;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to engage split-screen feature.
|
* Interface to engage split-screen feature.
|
||||||
* TODO: Figure out which of these are actually needed outside of the Shell
|
* TODO: Figure out which of these are actually needed outside of the Shell
|
||||||
@@ -87,7 +86,7 @@ public interface SplitScreen extends DragAndDropPolicy.Starter {
|
|||||||
/** Callback interface for listening to changes in a split-screen stage. */
|
/** Callback interface for listening to changes in a split-screen stage. */
|
||||||
interface SplitScreenListener {
|
interface SplitScreenListener {
|
||||||
void onStagePositionChanged(@StageType int stage, @StagePosition int position);
|
void onStagePositionChanged(@StageType int stage, @StagePosition int position);
|
||||||
void onTaskStageChanged(int taskId, @StageType int stage);
|
void onTaskStageChanged(int taskId, @StageType int stage, boolean visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@code true} if split-screen is currently visible. */
|
/** @return {@code true} if split-screen is currently visible. */
|
||||||
@@ -118,6 +117,7 @@ public interface SplitScreen extends DragAndDropPolicy.Starter {
|
|||||||
@StageType int stage, @StagePosition int position, @Nullable Bundle options);
|
@StageType int stage, @StagePosition int position, @Nullable Bundle options);
|
||||||
void startShortcut(String packageName, String shortcutId, @StageType int stage,
|
void startShortcut(String packageName, String shortcutId, @StageType int stage,
|
||||||
@StagePosition int position, @Nullable Bundle options, UserHandle user);
|
@StagePosition int position, @Nullable Bundle options, UserHandle user);
|
||||||
void startIntent(PendingIntent intent,
|
void startIntent(PendingIntent intent, Context context,
|
||||||
@StageType int stage, @StagePosition int position, @Nullable Bundle options);
|
@Nullable Intent fillInIntent, @StageType int stage,
|
||||||
|
@StagePosition int position, @Nullable Bundle options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import android.app.ActivityTaskManager;
|
|||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.LauncherApps;
|
import android.content.pm.LauncherApps;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -171,12 +172,13 @@ public class SplitScreenController implements DragAndDropPolicy.Starter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startIntent(PendingIntent intent, @SplitScreen.StageType int stage,
|
public void startIntent(PendingIntent intent, Context context,
|
||||||
|
Intent fillInIntent, @SplitScreen.StageType int stage,
|
||||||
@SplitScreen.StagePosition int position, @Nullable Bundle options) {
|
@SplitScreen.StagePosition int position, @Nullable Bundle options) {
|
||||||
options = resolveStartStage(stage, position, options);
|
options = resolveStartStage(stage, position, options);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
intent.send(null, 0, null, null, null, null, options);
|
intent.send(context, 0, fillInIntent, null, null, null, options);
|
||||||
} catch (PendingIntent.CanceledException e) {
|
} catch (PendingIntent.CanceledException e) {
|
||||||
Slog.e(TAG, "Failed to launch activity", e);
|
Slog.e(TAG, "Failed to launch activity", e);
|
||||||
}
|
}
|
||||||
@@ -348,10 +350,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startIntent(PendingIntent intent, int stage, int position,
|
public void startIntent(PendingIntent intent, Context context, Intent fillInIntent,
|
||||||
@Nullable Bundle options) {
|
int stage, int position, @Nullable Bundle options) {
|
||||||
mMainExecutor.execute(() -> {
|
mMainExecutor.execute(() -> {
|
||||||
SplitScreenController.this.startIntent(intent, stage, position, options);
|
SplitScreenController.this.startIntent(intent, context, fillInIntent, stage,
|
||||||
|
position, options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onStageChildTaskStatusChanged(
|
private void onStageChildTaskStatusChanged(
|
||||||
StageListenerImpl stageListener, int taskId, boolean present) {
|
StageListenerImpl stageListener, int taskId, boolean present, boolean visible) {
|
||||||
|
|
||||||
int stage;
|
int stage;
|
||||||
if (present) {
|
if (present) {
|
||||||
@@ -236,7 +236,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = mListeners.size() - 1; i >= 0; --i) {
|
for (int i = mListeners.size() - 1; i >= 0; --i) {
|
||||||
mListeners.get(i).onTaskStageChanged(taskId, stage);
|
mListeners.get(i).onTaskStageChanged(taskId, stage, visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,8 +495,8 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChildTaskStatusChanged(int taskId, boolean present) {
|
public void onChildTaskStatusChanged(int taskId, boolean present, boolean visible) {
|
||||||
StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present);
|
StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present, visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
public interface StageListenerCallbacks {
|
public interface StageListenerCallbacks {
|
||||||
void onRootTaskAppeared();
|
void onRootTaskAppeared();
|
||||||
void onStatusChanged(boolean visible, boolean hasChildren);
|
void onStatusChanged(boolean visible, boolean hasChildren);
|
||||||
void onChildTaskStatusChanged(int taskId, boolean present);
|
void onChildTaskStatusChanged(int taskId, boolean present, boolean visible);
|
||||||
void onRootTaskVanished();
|
void onRootTaskVanished();
|
||||||
}
|
}
|
||||||
private final StageListenerCallbacks mCallbacks;
|
private final StageListenerCallbacks mCallbacks;
|
||||||
@@ -88,7 +88,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
mChildrenLeashes.put(taskId, leash);
|
mChildrenLeashes.put(taskId, leash);
|
||||||
mChildrenTaskInfo.put(taskId, taskInfo);
|
mChildrenTaskInfo.put(taskId, taskInfo);
|
||||||
updateChildTaskSurface(taskInfo, leash, true /* firstAppeared */);
|
updateChildTaskSurface(taskInfo, leash, true /* firstAppeared */);
|
||||||
mCallbacks.onChildTaskStatusChanged(taskId, true /* present */);
|
mCallbacks.onChildTaskStatusChanged(taskId, true /* present */, taskInfo.isVisible);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
||||||
+ "\n mRootTaskInfo: " + mRootTaskInfo);
|
+ "\n mRootTaskInfo: " + mRootTaskInfo);
|
||||||
@@ -105,6 +105,8 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
|
mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
|
||||||
updateChildTaskSurface(
|
updateChildTaskSurface(
|
||||||
taskInfo, mChildrenLeashes.get(taskInfo.taskId), false /* firstAppeared */);
|
taskInfo, mChildrenLeashes.get(taskInfo.taskId), false /* firstAppeared */);
|
||||||
|
mCallbacks.onChildTaskStatusChanged(taskInfo.taskId, true /* present */,
|
||||||
|
taskInfo.isVisible);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
||||||
+ "\n mRootTaskInfo: " + mRootTaskInfo);
|
+ "\n mRootTaskInfo: " + mRootTaskInfo);
|
||||||
@@ -123,7 +125,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
mChildrenTaskInfo.remove(taskId);
|
mChildrenTaskInfo.remove(taskId);
|
||||||
mChildrenLeashes.remove(taskId);
|
mChildrenLeashes.remove(taskId);
|
||||||
sendStatusChanged();
|
sendStatusChanged();
|
||||||
mCallbacks.onChildTaskStatusChanged(taskId, false /* present */);
|
mCallbacks.onChildTaskStatusChanged(taskId, false /* present */, taskInfo.isVisible);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
||||||
+ "\n mRootTaskInfo: " + mRootTaskInfo);
|
+ "\n mRootTaskInfo: " + mRootTaskInfo);
|
||||||
@@ -152,7 +154,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
void onSplitScreenListenerRegistered(SplitScreen.SplitScreenListener listener,
|
void onSplitScreenListenerRegistered(SplitScreen.SplitScreenListener listener,
|
||||||
@SplitScreen.StageType int stage) {
|
@SplitScreen.StageType int stage) {
|
||||||
for (int i = mChildrenTaskInfo.size() - 1; i >= 0; --i) {
|
for (int i = mChildrenTaskInfo.size() - 1; i >= 0; --i) {
|
||||||
listener.onTaskStageChanged(mChildrenTaskInfo.keyAt(i), stage);
|
int taskId = mChildrenTaskInfo.keyAt(i);
|
||||||
|
listener.onTaskStageChanged(taskId, stage,
|
||||||
|
mChildrenTaskInfo.get(taskId).isVisible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ public class DragAndDropPolicyTest {
|
|||||||
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN);
|
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,12 +217,12 @@ public class DragAndDropPolicyTest {
|
|||||||
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_LEFT, TYPE_SPLIT_RIGHT);
|
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_LEFT, TYPE_SPLIT_RIGHT);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||||
reset(mSplitScreenStarter);
|
reset(mSplitScreenStarter);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_RIGHT), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_RIGHT), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,12 +234,12 @@ public class DragAndDropPolicyTest {
|
|||||||
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_TOP, TYPE_SPLIT_BOTTOM);
|
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_TOP, TYPE_SPLIT_BOTTOM);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||||
reset(mSplitScreenStarter);
|
reset(mSplitScreenStarter);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_BOTTOM), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_BOTTOM), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ public class DragAndDropPolicyTest {
|
|||||||
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_LEFT, TYPE_SPLIT_RIGHT);
|
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_LEFT, TYPE_SPLIT_RIGHT);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ public class DragAndDropPolicyTest {
|
|||||||
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_LEFT, TYPE_SPLIT_RIGHT);
|
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_LEFT, TYPE_SPLIT_RIGHT);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,13 +276,13 @@ public class DragAndDropPolicyTest {
|
|||||||
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_LEFT, TYPE_SPLIT_RIGHT);
|
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_LEFT, TYPE_SPLIT_RIGHT);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||||
reset(mSplitScreenStarter);
|
reset(mSplitScreenStarter);
|
||||||
|
|
||||||
// TODO(b/169894807): Just verify starting for the non-docked task until we have app pairs
|
// TODO(b/169894807): Just verify starting for the non-docked task until we have app pairs
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_RIGHT), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_RIGHT), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,13 +295,13 @@ public class DragAndDropPolicyTest {
|
|||||||
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_TOP, TYPE_SPLIT_BOTTOM);
|
mPolicy.getTargets(mInsets), TYPE_FULLSCREEN, TYPE_SPLIT_TOP, TYPE_SPLIT_BOTTOM);
|
||||||
|
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_FULLSCREEN), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
eq(STAGE_TYPE_UNDEFINED), eq(STAGE_POSITION_UNDEFINED), any());
|
||||||
reset(mSplitScreenStarter);
|
reset(mSplitScreenStarter);
|
||||||
|
|
||||||
// TODO(b/169894807): Just verify starting for the non-docked task until we have app pairs
|
// TODO(b/169894807): Just verify starting for the non-docked task until we have app pairs
|
||||||
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_BOTTOM), mActivityClipData);
|
mPolicy.handleDrop(filterTargetByType(targets, TYPE_SPLIT_BOTTOM), mActivityClipData);
|
||||||
verify(mSplitScreenStarter).startIntent(any(),
|
verify(mSplitScreenStarter).startIntent(any(), any(), any(),
|
||||||
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
eq(STAGE_TYPE_SIDE), eq(STAGE_POSITION_BOTTOM_OR_RIGHT), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ package com.android.systemui.shared.recents;
|
|||||||
*/
|
*/
|
||||||
oneway interface ISplitScreenListener {
|
oneway interface ISplitScreenListener {
|
||||||
void onStagePositionChanged(int stage, int position);
|
void onStagePositionChanged(int stage, int position);
|
||||||
void onTaskStageChanged(int taskId, int stage);
|
void onTaskStageChanged(int taskId, int stage, boolean visible);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.systemui.shared.recents;
|
|||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.PictureInPictureParams;
|
import android.app.PictureInPictureParams;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Insets;
|
import android.graphics.Insets;
|
||||||
@@ -34,7 +35,7 @@ import com.android.systemui.shared.system.RemoteTransitionCompat;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary callbacks into SystemUI.
|
* Temporary callbacks into SystemUI.
|
||||||
* Next id = 30
|
* Next id = 43
|
||||||
*/
|
*/
|
||||||
interface ISystemUiProxy {
|
interface ISystemUiProxy {
|
||||||
|
|
||||||
@@ -251,5 +252,7 @@ interface ISystemUiProxy {
|
|||||||
void startShortcut(in String packageName, in String shortcutId, in int stage, in int position,
|
void startShortcut(in String packageName, in String shortcutId, in int stage, in int position,
|
||||||
in Bundle options, in UserHandle user) = 40;
|
in Bundle options, in UserHandle user) = 40;
|
||||||
void startIntent(
|
void startIntent(
|
||||||
in PendingIntent intent, in int stage, in int position, in Bundle options) = 41;
|
in PendingIntent intent, in Intent fillInIntent, in int stage, in int position,
|
||||||
|
in Bundle options) = 41;
|
||||||
|
void removeFromSideStage(in int taskId) = 42;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -662,14 +662,29 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startIntent(PendingIntent intent, int stage, int position, Bundle options) {
|
public void startIntent(PendingIntent intent, Intent fillInIntent,
|
||||||
|
int stage, int position, Bundle options) {
|
||||||
if (!verifyCaller("startIntent")) {
|
if (!verifyCaller("startIntent")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final long token = Binder.clearCallingIdentity();
|
final long token = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
mSplitScreenOptional.ifPresent(s ->
|
mSplitScreenOptional.ifPresent(s ->
|
||||||
s.startIntent(intent, stage, position, options));
|
s.startIntent(intent, mContext, fillInIntent, stage, position, options));
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeFromSideStage(int taskId) {
|
||||||
|
if (!verifyCaller("removeFromSideStage")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
mSplitScreenOptional.ifPresent(
|
||||||
|
s -> s.removeFromSideStage(taskId));
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(token);
|
Binder.restoreCallingIdentity(token);
|
||||||
}
|
}
|
||||||
@@ -789,10 +804,10 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTaskStageChanged(int taskId, int stage) {
|
public void onTaskStageChanged(int taskId, int stage, boolean visible) {
|
||||||
try {
|
try {
|
||||||
if (mISplitScreenListener != null) {
|
if (mISplitScreenListener != null) {
|
||||||
mISplitScreenListener.onTaskStageChanged(taskId, stage);
|
mISplitScreenListener.onTaskStageChanged(taskId, stage, visible);
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG_OPS, "onTaskStageChanged", e);
|
Log.e(TAG_OPS, "onTaskStageChanged", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user