Merge "Support entering split screen with a shortcut and an intent" into tm-qpr-dev
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 2200b35..139e923 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -628,14 +628,20 @@
}
}
- public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, Bundle options1,
- PendingIntent pendingIntent2, Bundle options2,
- @SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio,
- RemoteAnimationAdapter adapter, InstanceId instanceId) {
+ /**
+ * Starts a pair of intents or shortcuts in split-screen using legacy transition. Passing a
+ * non-null shortcut info means to start the app as a shortcut.
+ */
+ public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1,
+ @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
+ PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2,
+ @Nullable Bundle options2, @SplitConfigurationOptions.StagePosition int sidePosition,
+ float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
if (mSystemUiProxy != null) {
try {
- mSplitScreen.startIntentsWithLegacyTransition(pendingIntent1, options1,
- pendingIntent2, options2, sidePosition, splitRatio, adapter, instanceId);
+ mSplitScreen.startIntentsWithLegacyTransition(pendingIntent1, shortcutInfo1,
+ options1, pendingIntent2, shortcutInfo2, options2, sidePosition, splitRatio,
+ adapter, instanceId);
} catch (RemoteException e) {
Log.w(TAG, "Failed call startIntentsWithLegacyTransition");
}
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
index e5d54d7..1b2bfc9 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
@@ -261,8 +261,9 @@
getOppositeStagePosition(stagePosition), splitRatio, adapter,
shellInstanceId);
} else {
- mSystemUiProxy.startIntentsWithLegacyTransition(getPendingIntent(intent1),
- options1.toBundle(), getPendingIntent(intent2), null /* options2 */,
+ mSystemUiProxy.startIntentsWithLegacyTransition(
+ getPendingIntent(intent1), getShortcutInfo(intent1), options1.toBundle(),
+ getPendingIntent(intent2), getShortcutInfo(intent2), null /* options2 */,
stagePosition, splitRatio, adapter, shellInstanceId);
}
}
@@ -271,15 +272,13 @@
private void launchIntentOrShortcut(Intent intent, ActivityOptions options1, int taskId,
@StagePosition int stagePosition, float splitRatio, RemoteTransition remoteTransition,
@Nullable InstanceId shellInstanceId) {
- PendingIntent pendingIntent = getPendingIntent(intent);
- final ShortcutInfo shortcutInfo = getShortcutInfo(intent,
- pendingIntent.getCreatorUserHandle());
+ final ShortcutInfo shortcutInfo = getShortcutInfo(intent);
if (shortcutInfo != null) {
mSystemUiProxy.startShortcutAndTask(shortcutInfo,
options1.toBundle(), taskId, null /* options2 */, stagePosition,
splitRatio, remoteTransition, shellInstanceId);
} else {
- mSystemUiProxy.startIntentAndTask(pendingIntent, options1.toBundle(), taskId,
+ mSystemUiProxy.startIntentAndTask(getPendingIntent(intent), options1.toBundle(), taskId,
null /* options2 */, stagePosition, splitRatio, remoteTransition,
shellInstanceId);
}
@@ -288,15 +287,13 @@
private void launchIntentOrShortcutLegacy(Intent intent, ActivityOptions options1, int taskId,
@StagePosition int stagePosition, float splitRatio, RemoteAnimationAdapter adapter,
@Nullable InstanceId shellInstanceId) {
- PendingIntent pendingIntent = getPendingIntent(intent);
- final ShortcutInfo shortcutInfo = getShortcutInfo(intent,
- pendingIntent.getCreatorUserHandle());
+ final ShortcutInfo shortcutInfo = getShortcutInfo(intent);
if (shortcutInfo != null) {
mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(shortcutInfo,
options1.toBundle(), taskId, null /* options2 */, stagePosition,
splitRatio, adapter, shellInstanceId);
} else {
- mSystemUiProxy.startIntentAndTaskWithLegacyTransition(pendingIntent,
+ mSystemUiProxy.startIntentAndTaskWithLegacyTransition(getPendingIntent(intent),
options1.toBundle(), taskId, null /* options2 */, stagePosition, splitRatio,
adapter, shellInstanceId);
}
@@ -322,7 +319,7 @@
}
@Nullable
- private ShortcutInfo getShortcutInfo(Intent intent, UserHandle userHandle) {
+ private ShortcutInfo getShortcutInfo(Intent intent) {
if (intent == null || intent.getPackage() == null) {
return null;
}
@@ -334,7 +331,7 @@
try {
final Context context = mContext.createPackageContextAsUser(
- intent.getPackage(), 0 /* flags */, userHandle);
+ intent.getPackage(), 0 /* flags */, mUser);
return new ShortcutInfo.Builder(context, shortcutId).build();
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Failed to create a ShortcutInfo for " + intent.getPackage());