Merge "Adding open/close animartion when launching app-info target" into main
This commit is contained in:
@@ -320,7 +320,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
* @return ActivityOptions with remote animations that controls how the window of the opening
|
||||
* targets are displayed.
|
||||
*/
|
||||
public ActivityOptionsWrapper getActivityLaunchOptions(View v) {
|
||||
public ActivityOptionsWrapper getActivityLaunchOptions(View v, ItemInfo itemInfo) {
|
||||
boolean fromRecents = isLaunchingFromRecents(v, null /* targets */);
|
||||
RunnableList onEndCallback = new RunnableList();
|
||||
|
||||
@@ -350,7 +350,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
IBinder cookie = mAppLaunchRunner.supportsReturnTransition()
|
||||
? ((ContainerAnimationRunner) mAppLaunchRunner).getCookie() : null;
|
||||
addLaunchCookie(cookie, (ItemInfo) v.getTag(), options);
|
||||
addLaunchCookie(cookie, itemInfo, options);
|
||||
|
||||
// Register the return animation so it can be triggered on back from the app to home.
|
||||
maybeRegisterAppReturnTransition(v);
|
||||
|
||||
@@ -22,7 +22,6 @@ 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;
|
||||
@@ -34,7 +33,6 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.util.ActivityOptionsWrapper;
|
||||
import com.android.launcher3.util.StableViewInfo;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
||||
|
||||
/** Provides a Quickstep specific animation when launching an activity from an app widget. */
|
||||
@@ -67,13 +65,7 @@ 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 info) {
|
||||
launchCookie = StableViewInfo.toLaunchCookie(info);
|
||||
activityOptions.options.setLaunchCookie(launchCookie);
|
||||
}
|
||||
.getActivityLaunchOptions(hostView, (ItemInfo) hostView.getTag());
|
||||
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.
|
||||
@@ -82,7 +74,7 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler {
|
||||
.registerRemoteAnimationForNextActivityStart(
|
||||
pendingIntent.getCreatorPackage(),
|
||||
activityOptions.options.getRemoteAnimationAdapter(),
|
||||
launchCookie);
|
||||
activityOptions.options.getLaunchCookie());
|
||||
} catch (RemoteException e) {
|
||||
// Do nothing.
|
||||
}
|
||||
@@ -93,7 +85,7 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler {
|
||||
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
|
||||
options = Pair.create(options.first, activityOptions.options);
|
||||
if (pendingIntent.isActivity()) {
|
||||
logAppLaunch(itemInfo);
|
||||
logAppLaunch(hostView.getTag());
|
||||
}
|
||||
return RemoteViews.startPendingIntent(hostView, pendingIntent, options);
|
||||
}
|
||||
|
||||
@@ -1190,7 +1190,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
@Override
|
||||
public ActivityOptionsWrapper getActivityLaunchOptions(View v, @Nullable ItemInfo item) {
|
||||
ActivityOptionsWrapper activityOptions = mAppTransitionManager.getActivityLaunchOptions(v);
|
||||
ActivityOptionsWrapper activityOptions = mAppTransitionManager.getActivityLaunchOptions(
|
||||
v, item != null ? item : (ItemInfo) v.getTag());
|
||||
if (mLastTouchUpTime > 0) {
|
||||
activityOptions.options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_LAUNCHER,
|
||||
mLastTouchUpTime);
|
||||
|
||||
@@ -7,7 +7,6 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP;
|
||||
import static com.android.launcher3.widget.picker.model.data.WidgetPickerDataUtils.findAllWidgetsForPackageUser;
|
||||
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -35,6 +34,7 @@ import com.android.launcher3.allapps.PrivateProfileManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.util.ActivityOptionsWrapper;
|
||||
import com.android.launcher3.util.ApiWrapper;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.InstantAppResolver;
|
||||
@@ -184,10 +184,12 @@ public abstract class SystemShortcut<T extends ActivityContext> extends ItemInfo
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismissTaskMenuView();
|
||||
Rect sourceBounds = Utilities.getViewBounds(view);
|
||||
ActivityOptionsWrapper options = mTarget.getActivityLaunchOptions(view, mItemInfo);
|
||||
// Dismiss the taskMenu when the app launch animation is complete
|
||||
options.onEndCallback.add(this::dismissTaskMenuView);
|
||||
PackageManagerHelper.startDetailsActivityForInfo(view.getContext(), mItemInfo,
|
||||
sourceBounds, ActivityOptions.makeBasic().toBundle());
|
||||
sourceBounds, options.toBundle());
|
||||
mTarget.getStatsLogManager().logger().withItemInfo(mItemInfo)
|
||||
.log(LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.os.Bundle;
|
||||
public class ActivityOptionsWrapper {
|
||||
|
||||
public final ActivityOptions options;
|
||||
// Called when the app launch animation is complete
|
||||
public final RunnableList onEndCallback;
|
||||
|
||||
public ActivityOptionsWrapper(ActivityOptions options, RunnableList onEndCallback) {
|
||||
|
||||
@@ -212,7 +212,7 @@ public class PackageManagerHelper implements SafeCloseable{
|
||||
if (info instanceof ItemInfoWithIcon appInfo
|
||||
&& (appInfo.runtimeStatusFlags & FLAG_INSTALL_SESSION_ACTIVE) != 0) {
|
||||
context.startActivity(ApiWrapper.INSTANCE.get(context).getAppMarketActivityIntent(
|
||||
appInfo.getTargetComponent().getPackageName(), Process.myUserHandle()));
|
||||
appInfo.getTargetComponent().getPackageName(), Process.myUserHandle()), opts);
|
||||
return;
|
||||
}
|
||||
ComponentName componentName = null;
|
||||
|
||||
@@ -253,11 +253,14 @@ public class FloatingIconView extends FrameLayout implements
|
||||
public static void getLocationBoundsForView(Launcher launcher, View v, boolean isOpening,
|
||||
RectF outRect, Rect outViewBounds) {
|
||||
boolean ignoreTransform = !isOpening;
|
||||
if (v instanceof BubbleTextHolder) {
|
||||
v = ((BubbleTextHolder) v).getBubbleText();
|
||||
if (v instanceof DeepShortcutView dsv) {
|
||||
v = dsv.getIconView();
|
||||
ignoreTransform = false;
|
||||
} else if (v.getParent() instanceof DeepShortcutView) {
|
||||
v = ((DeepShortcutView) v.getParent()).getIconView();
|
||||
} else if (v.getParent() instanceof DeepShortcutView dsv) {
|
||||
v = dsv.getIconView();
|
||||
ignoreTransform = false;
|
||||
} else if (v instanceof BubbleTextHolder bth) {
|
||||
v = bth.getBubbleText();
|
||||
ignoreTransform = false;
|
||||
}
|
||||
if (v == null) {
|
||||
@@ -298,10 +301,10 @@ public class FloatingIconView extends FrameLayout implements
|
||||
|
||||
Drawable badge = null;
|
||||
if (info instanceof SystemShortcut) {
|
||||
if (originalView instanceof ImageView) {
|
||||
drawable = ((ImageView) originalView).getDrawable();
|
||||
} else if (originalView instanceof DeepShortcutView) {
|
||||
drawable = ((DeepShortcutView) originalView).getIconView().getBackground();
|
||||
if (originalView instanceof ImageView iv) {
|
||||
drawable = iv.getDrawable();
|
||||
} else if (originalView instanceof DeepShortcutView dsv) {
|
||||
drawable = dsv.getIconView().getBackground();
|
||||
} else {
|
||||
drawable = originalView.getBackground();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user