Loading libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropPolicy.java +7 −5 Original line number Diff line number Diff line Loading @@ -234,8 +234,8 @@ public class DragAndDropPolicy { final UserHandle user = intent.getParcelableExtra(EXTRA_USER); mStarter.startShortcut(packageName, id, stage, position, opts, user); } else { mStarter.startIntent(intent.getParcelableExtra(EXTRA_PENDING_INTENT), stage, position, opts); mStarter.startIntent(intent.getParcelableExtra(EXTRA_PENDING_INTENT), mContext, null, stage, position, opts); } } Loading Loading @@ -295,7 +295,8 @@ public class DragAndDropPolicy { @Nullable Bundle options); void startShortcut(String packageName, String shortcutId, @StageType int stage, @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); void enterSplitScreen(int taskId, boolean leftOrTop); void exitSplitScreen(); Loading Loading @@ -336,10 +337,11 @@ public class DragAndDropPolicy { } @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) { try { intent.send(null, 0, null, null, null, null, options); intent.send(mContext, 0, fillInIntent, null, null, null, options); } catch (PendingIntent.CanceledException e) { Slog.e(TAG, "Failed to launch activity", e); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreen.java +6 −6 Original line number Diff line number Diff line Loading @@ -19,18 +19,17 @@ package com.android.wm.shell.splitscreen; import android.annotation.IntDef; import android.app.ActivityManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.os.Bundle; import android.os.UserHandle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.wm.shell.common.annotations.ExternalThread; import com.android.wm.shell.draganddrop.DragAndDropPolicy; import java.io.PrintWriter; /** * Interface to engage split-screen feature. * TODO: Figure out which of these are actually needed outside of the Shell Loading Loading @@ -87,7 +86,7 @@ public interface SplitScreen extends DragAndDropPolicy.Starter { /** Callback interface for listening to changes in a split-screen stage. */ interface SplitScreenListener { 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. */ Loading Loading @@ -118,6 +117,7 @@ public interface SplitScreen extends DragAndDropPolicy.Starter { @StageType int stage, @StagePosition int position, @Nullable Bundle options); void startShortcut(String packageName, String shortcutId, @StageType int stage, @StagePosition int position, @Nullable Bundle options, UserHandle user); void startIntent(PendingIntent intent, @StageType int stage, @StagePosition int position, @Nullable Bundle options); void startIntent(PendingIntent intent, Context context, @Nullable Intent fillInIntent, @StageType int stage, @StagePosition int position, @Nullable Bundle options); } libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +8 −5 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.app.ActivityTaskManager; import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.LauncherApps; import android.graphics.Rect; import android.os.Bundle; Loading Loading @@ -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) { options = resolveStartStage(stage, position, options); try { intent.send(null, 0, null, null, null, null, options); intent.send(context, 0, fillInIntent, null, null, null, options); } catch (PendingIntent.CanceledException e) { Slog.e(TAG, "Failed to launch activity", e); } Loading Loading @@ -348,10 +350,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter { } @Override public void startIntent(PendingIntent intent, int stage, int position, @Nullable Bundle options) { public void startIntent(PendingIntent intent, Context context, Intent fillInIntent, int stage, int position, @Nullable Bundle options) { mMainExecutor.execute(() -> { SplitScreenController.this.startIntent(intent, stage, position, options); SplitScreenController.this.startIntent(intent, context, fillInIntent, stage, position, options); }); } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +4 −4 Original line number Diff line number Diff line Loading @@ -225,7 +225,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener, } private void onStageChildTaskStatusChanged( StageListenerImpl stageListener, int taskId, boolean present) { StageListenerImpl stageListener, int taskId, boolean present, boolean visible) { int stage; if (present) { Loading @@ -236,7 +236,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener, } for (int i = mListeners.size() - 1; i >= 0; --i) { mListeners.get(i).onTaskStageChanged(taskId, stage); mListeners.get(i).onTaskStageChanged(taskId, stage, visible); } } Loading Loading @@ -495,8 +495,8 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener, } @Override public void onChildTaskStatusChanged(int taskId, boolean present) { StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present); public void onChildTaskStatusChanged(int taskId, boolean present, boolean visible) { StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present, visible); } @Override Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +8 −4 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { public interface StageListenerCallbacks { void onRootTaskAppeared(); void onStatusChanged(boolean visible, boolean hasChildren); void onChildTaskStatusChanged(int taskId, boolean present); void onChildTaskStatusChanged(int taskId, boolean present, boolean visible); void onRootTaskVanished(); } private final StageListenerCallbacks mCallbacks; Loading Loading @@ -88,7 +88,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { mChildrenLeashes.put(taskId, leash); mChildrenTaskInfo.put(taskId, taskInfo); updateChildTaskSurface(taskInfo, leash, true /* firstAppeared */); mCallbacks.onChildTaskStatusChanged(taskId, true /* present */); mCallbacks.onChildTaskStatusChanged(taskId, true /* present */, taskInfo.isVisible); } else { throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo + "\n mRootTaskInfo: " + mRootTaskInfo); Loading @@ -105,6 +105,8 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { mChildrenTaskInfo.put(taskInfo.taskId, taskInfo); updateChildTaskSurface( taskInfo, mChildrenLeashes.get(taskInfo.taskId), false /* firstAppeared */); mCallbacks.onChildTaskStatusChanged(taskInfo.taskId, true /* present */, taskInfo.isVisible); } else { throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo + "\n mRootTaskInfo: " + mRootTaskInfo); Loading @@ -123,7 +125,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { mChildrenTaskInfo.remove(taskId); mChildrenLeashes.remove(taskId); sendStatusChanged(); mCallbacks.onChildTaskStatusChanged(taskId, false /* present */); mCallbacks.onChildTaskStatusChanged(taskId, false /* present */, taskInfo.isVisible); } else { throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo + "\n mRootTaskInfo: " + mRootTaskInfo); Loading Loading @@ -152,7 +154,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { void onSplitScreenListenerRegistered(SplitScreen.SplitScreenListener listener, @SplitScreen.StageType int stage) { 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); } } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropPolicy.java +7 −5 Original line number Diff line number Diff line Loading @@ -234,8 +234,8 @@ public class DragAndDropPolicy { final UserHandle user = intent.getParcelableExtra(EXTRA_USER); mStarter.startShortcut(packageName, id, stage, position, opts, user); } else { mStarter.startIntent(intent.getParcelableExtra(EXTRA_PENDING_INTENT), stage, position, opts); mStarter.startIntent(intent.getParcelableExtra(EXTRA_PENDING_INTENT), mContext, null, stage, position, opts); } } Loading Loading @@ -295,7 +295,8 @@ public class DragAndDropPolicy { @Nullable Bundle options); void startShortcut(String packageName, String shortcutId, @StageType int stage, @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); void enterSplitScreen(int taskId, boolean leftOrTop); void exitSplitScreen(); Loading Loading @@ -336,10 +337,11 @@ public class DragAndDropPolicy { } @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) { try { intent.send(null, 0, null, null, null, null, options); intent.send(mContext, 0, fillInIntent, null, null, null, options); } catch (PendingIntent.CanceledException e) { Slog.e(TAG, "Failed to launch activity", e); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreen.java +6 −6 Original line number Diff line number Diff line Loading @@ -19,18 +19,17 @@ package com.android.wm.shell.splitscreen; import android.annotation.IntDef; import android.app.ActivityManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.os.Bundle; import android.os.UserHandle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.wm.shell.common.annotations.ExternalThread; import com.android.wm.shell.draganddrop.DragAndDropPolicy; import java.io.PrintWriter; /** * Interface to engage split-screen feature. * TODO: Figure out which of these are actually needed outside of the Shell Loading Loading @@ -87,7 +86,7 @@ public interface SplitScreen extends DragAndDropPolicy.Starter { /** Callback interface for listening to changes in a split-screen stage. */ interface SplitScreenListener { 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. */ Loading Loading @@ -118,6 +117,7 @@ public interface SplitScreen extends DragAndDropPolicy.Starter { @StageType int stage, @StagePosition int position, @Nullable Bundle options); void startShortcut(String packageName, String shortcutId, @StageType int stage, @StagePosition int position, @Nullable Bundle options, UserHandle user); void startIntent(PendingIntent intent, @StageType int stage, @StagePosition int position, @Nullable Bundle options); void startIntent(PendingIntent intent, Context context, @Nullable Intent fillInIntent, @StageType int stage, @StagePosition int position, @Nullable Bundle options); }
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +8 −5 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.app.ActivityTaskManager; import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.LauncherApps; import android.graphics.Rect; import android.os.Bundle; Loading Loading @@ -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) { options = resolveStartStage(stage, position, options); try { intent.send(null, 0, null, null, null, null, options); intent.send(context, 0, fillInIntent, null, null, null, options); } catch (PendingIntent.CanceledException e) { Slog.e(TAG, "Failed to launch activity", e); } Loading Loading @@ -348,10 +350,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter { } @Override public void startIntent(PendingIntent intent, int stage, int position, @Nullable Bundle options) { public void startIntent(PendingIntent intent, Context context, Intent fillInIntent, int stage, int position, @Nullable Bundle options) { mMainExecutor.execute(() -> { SplitScreenController.this.startIntent(intent, stage, position, options); SplitScreenController.this.startIntent(intent, context, fillInIntent, stage, position, options); }); } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +4 −4 Original line number Diff line number Diff line Loading @@ -225,7 +225,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener, } private void onStageChildTaskStatusChanged( StageListenerImpl stageListener, int taskId, boolean present) { StageListenerImpl stageListener, int taskId, boolean present, boolean visible) { int stage; if (present) { Loading @@ -236,7 +236,7 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener, } for (int i = mListeners.size() - 1; i >= 0; --i) { mListeners.get(i).onTaskStageChanged(taskId, stage); mListeners.get(i).onTaskStageChanged(taskId, stage, visible); } } Loading Loading @@ -495,8 +495,8 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener, } @Override public void onChildTaskStatusChanged(int taskId, boolean present) { StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present); public void onChildTaskStatusChanged(int taskId, boolean present, boolean visible) { StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present, visible); } @Override Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +8 −4 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { public interface StageListenerCallbacks { void onRootTaskAppeared(); void onStatusChanged(boolean visible, boolean hasChildren); void onChildTaskStatusChanged(int taskId, boolean present); void onChildTaskStatusChanged(int taskId, boolean present, boolean visible); void onRootTaskVanished(); } private final StageListenerCallbacks mCallbacks; Loading Loading @@ -88,7 +88,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { mChildrenLeashes.put(taskId, leash); mChildrenTaskInfo.put(taskId, taskInfo); updateChildTaskSurface(taskInfo, leash, true /* firstAppeared */); mCallbacks.onChildTaskStatusChanged(taskId, true /* present */); mCallbacks.onChildTaskStatusChanged(taskId, true /* present */, taskInfo.isVisible); } else { throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo + "\n mRootTaskInfo: " + mRootTaskInfo); Loading @@ -105,6 +105,8 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { mChildrenTaskInfo.put(taskInfo.taskId, taskInfo); updateChildTaskSurface( taskInfo, mChildrenLeashes.get(taskInfo.taskId), false /* firstAppeared */); mCallbacks.onChildTaskStatusChanged(taskInfo.taskId, true /* present */, taskInfo.isVisible); } else { throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo + "\n mRootTaskInfo: " + mRootTaskInfo); Loading @@ -123,7 +125,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { mChildrenTaskInfo.remove(taskId); mChildrenLeashes.remove(taskId); sendStatusChanged(); mCallbacks.onChildTaskStatusChanged(taskId, false /* present */); mCallbacks.onChildTaskStatusChanged(taskId, false /* present */, taskInfo.isVisible); } else { throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo + "\n mRootTaskInfo: " + mRootTaskInfo); Loading Loading @@ -152,7 +154,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { void onSplitScreenListenerRegistered(SplitScreen.SplitScreenListener listener, @SplitScreen.StageType int stage) { 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); } } Loading