Merge "Adding open/close animartion when launching app-info target" into main

This commit is contained in:
Sunny Goyal
2024-09-11 20:31:34 +00:00
committed by Android (Google) Code Review
7 changed files with 25 additions and 26 deletions
@@ -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();
}