Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f8932b0 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

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

parents c912c8fb cb98fb26
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
+3 −11
Original line number Diff line number Diff line
@@ -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);
    }
+2 −1
Original line number Diff line number Diff line
@@ -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);
+5 −3
Original line number Diff line number Diff line
@@ -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);
        }
+1 −0
Original line number Diff line number Diff line
@@ -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) {
Loading