Merge "Passing in the launch cookie for widget broadcast trampolines" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-02-25 00:21:27 +00:00
committed by Android (Google) Code Review
2 changed files with 30 additions and 12 deletions
@@ -41,6 +41,7 @@ import android.hardware.SensorManager;
import android.hardware.devicestate.DeviceStateManager;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.IBinder;
import android.view.Display;
import android.view.View;
import android.view.WindowInsets;
@@ -548,11 +549,26 @@ public abstract class BaseQuickstepLauncher extends Launcher
}
/**
* Adds a new launch cookie for the activity launch of the given {@param info} if supported.
* Adds a new launch cookie for the activity launch if supported.
*
* @param info the item info for the launch
* @param opts the options to set the launchCookie on.
*/
public void addLaunchCookie(ItemInfo info, ActivityOptions opts) {
IBinder launchCookie = getLaunchCookie(info);
if (launchCookie != null) {
opts.setLaunchCookie(launchCookie);
}
}
/**
* Return a new launch cookie for the activity launch if supported.
*
* @param info the item info for the launch
*/
public IBinder getLaunchCookie(ItemInfo info) {
if (info == null) {
return;
return null;
}
switch (info.container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
@@ -566,8 +582,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
break;
}
// Reset any existing launch cookies associated with the cookie
opts.setLaunchCookie(ObjectWrapper.wrap(NO_MATCHING_ID));
return;
return ObjectWrapper.wrap(NO_MATCHING_ID);
}
switch (info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
@@ -578,10 +593,9 @@ public abstract class BaseQuickstepLauncher extends Launcher
break;
default:
// Reset any existing launch cookies associated with the cookie
opts.setLaunchCookie(ObjectWrapper.wrap(NO_MATCHING_ID));
return;
return ObjectWrapper.wrap(NO_MATCHING_ID);
}
opts.setLaunchCookie(ObjectWrapper.wrap(new Integer(info.id)));
return ObjectWrapper.wrap(new Integer(info.id));
}
public void setHintUserWillBeActive() {