Passing in the launch cookie for widget broadcast trampolines

The launch cookie can now be transfered via the broadcast

Fixes: 220290671
Test: add Photos widget, return properly to widget
Change-Id: Ibfe9e5232317837f3111459212a4b016b5828ef4
This commit is contained in:
Selim Cinek
2022-02-18 14:24:39 +01:00
parent e424f57dcb
commit 46c8678447
2 changed files with 30 additions and 12 deletions

View File

@@ -21,6 +21,7 @@ import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.util.Pair;
@@ -58,6 +59,12 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler {
Pair<Intent, ActivityOptions> options = remoteResponse.getLaunchOptions(view);
ActivityOptionsWrapper activityOptions = mLauncher.getAppTransitionManager()
.getActivityLaunchOptions(hostView);
Object itemInfo = hostView.getTag();
IBinder launchCookie = null;
if (itemInfo instanceof ItemInfo) {
launchCookie = mLauncher.getLaunchCookie((ItemInfo) itemInfo);
activityOptions.options.setLaunchCookie(launchCookie);
}
if (Utilities.ATLEAST_S && !pendingIntent.isActivity()) {
// In the event this pending intent eventually launches an activity, i.e. a trampoline,
// use the Quickstep transition animation.
@@ -65,17 +72,14 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler {
ActivityTaskManager.getService()
.registerRemoteAnimationForNextActivityStart(
pendingIntent.getCreatorPackage(),
activityOptions.options.getRemoteAnimationAdapter());
activityOptions.options.getRemoteAnimationAdapter(),
launchCookie);
} catch (RemoteException e) {
// Do nothing.
}
}
activityOptions.options.setPendingIntentLaunchFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_EMPTY);
Object itemInfo = hostView.getTag();
if (itemInfo instanceof ItemInfo) {
mLauncher.addLaunchCookie((ItemInfo) itemInfo, activityOptions.options);
}
options = Pair.create(options.first, activityOptions.options);
if (pendingIntent.isActivity()) {
logAppLaunch(itemInfo);