Merge "Support entering split screen with a shortcut and an intent" into tm-qpr-dev am: ab314be1e4 am: a7fb317875

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21276377

Change-Id: I0752a358e3f14d01a237fc22a8351b02ada2083d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jerry Chang
2023-02-08 08:49:35 +00:00
committed by Automerger Merge Worker
2 changed files with 21 additions and 18 deletions

View File

@@ -262,8 +262,9 @@ public class SplitSelectStateController {
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);
}
}
@@ -272,15 +273,13 @@ public class SplitSelectStateController {
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);
}
@@ -289,15 +288,13 @@ public class SplitSelectStateController {
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);
}
@@ -324,7 +321,7 @@ public class SplitSelectStateController {
}
@Nullable
private ShortcutInfo getShortcutInfo(Intent intent, UserHandle userHandle) {
private ShortcutInfo getShortcutInfo(Intent intent) {
if (intent == null || intent.getPackage() == null) {
return null;
}
@@ -336,7 +333,7 @@ public class SplitSelectStateController {
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());