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

Commit 3e113fef authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Add logs for starting the home activity directly" into main

parents 0282c107 642559bb
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
import com.android.quickstep.util.TransformParams;
@@ -151,19 +152,20 @@ public class FallbackSwipeHandler extends
            return new FallbackPipToHomeAnimationFactory();
        }
        mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration);
        startHomeIntent(mActiveAnimationFactory, runningTaskTarget);
        startHomeIntent(mActiveAnimationFactory, runningTaskTarget, "FallbackSwipeHandler-home");
        return mActiveAnimationFactory;
    }

    private void startHomeIntent(
            @Nullable FallbackHomeAnimationFactory gestureContractAnimationFactory,
            @Nullable RemoteAnimationTarget runningTaskTarget) {
            @Nullable RemoteAnimationTarget runningTaskTarget,
            @NonNull String reason) {
        ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0);
        Intent intent = new Intent(mGestureState.getHomeIntent());
        if (gestureContractAnimationFactory != null && runningTaskTarget != null) {
            gestureContractAnimationFactory.addGestureContract(intent, runningTaskTarget.taskInfo);
        }
        startHomeIntentSafely(mContext, intent, options.toBundle());
        startHomeIntentSafely(mContext, intent, options.toBundle(), reason);
    }

    @Override
@@ -185,8 +187,8 @@ public class FallbackSwipeHandler extends
            // the PiP task appearing.
            recentsCallback = () -> {
                callback.run();
                startHomeIntent(
                        null /* gestureContractAnimationFactory */, null /* runningTaskTarget */);
                startHomeIntent(null /* gestureContractAnimationFactory */,
                        null /* runningTaskTarget */, "FallbackSwipeHandler-resumeLauncher");
            };
        } else {
            recentsCallback = callback;
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.util.RunnableList;
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -220,6 +221,7 @@ public class OverviewCommandHelper {
                return true;
            }
            if (cmd.type == TYPE_HOME) {
                ActiveGestureLog.INSTANCE.addLog("OverviewCommandHelper.executeCommand(TYPE_HOME)");
                mService.startActivity(mOverviewComponentObserver.getHomeIntent());
                return true;
            }
+8 −3
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import androidx.annotation.Nullable;

import com.android.launcher3.R;
import com.android.launcher3.util.SimpleBroadcastReceiver;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.systemui.shared.system.PackageManagerWrapper;

import java.io.PrintWriter;
@@ -276,20 +277,24 @@ public final class OverviewComponentObserver {
    /**
     * Starts the intent for the current home activity.
     */
    public static void startHomeIntentSafely(@NonNull Context context, @Nullable Bundle options) {
    public static void startHomeIntentSafely(@NonNull Context context, @Nullable Bundle options,
            @NonNull String reason) {
        RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(context);
        OverviewComponentObserver observer = new OverviewComponentObserver(context, deviceState);
        Intent intent = observer.getHomeIntent();
        observer.onDestroy();
        deviceState.destroy();
        startHomeIntentSafely(context, intent, options);
        startHomeIntentSafely(context, intent, options, reason);
    }

    /**
     * Starts the intent for the current home activity.
     */
    public static void startHomeIntentSafely(
            @NonNull Context context, @NonNull Intent homeIntent, @Nullable Bundle options) {
            @NonNull Context context, @NonNull Intent homeIntent, @Nullable Bundle options,
            @NonNull String reason) {
        ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
                "OverviewComponentObserver.startHomeIntent: ").append(reason));
        try {
            context.startActivity(homeIntent, options);
        } catch (NullPointerException | ActivityNotFoundException | SecurityException e) {
+2 −1
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ import java.util.List;
 * See {@link com.android.quickstep.views.RecentsView}.
 */
public final class RecentsActivity extends StatefulActivity<RecentsState> {
    private static final String TAG = "RecentsActivity";

    public static final ActivityTracker<RecentsActivity> ACTIVITY_TRACKER =
            new ActivityTracker<>();
@@ -427,7 +428,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
                new RemoteAnimationAdapter(runner, HOME_APPEAR_DURATION, 0),
                new RemoteTransition(runner.toRemoteTransition(), getIApplicationThread(),
                        "StartHomeFromRecents"));
        startHomeIntentSafely(this, options.toBundle());
        startHomeIntentSafely(this, options.toBundle(), TAG);
    }

    private final RemoteAnimationFactory mAnimationToHomeFactory =
+1 −0
Original line number Diff line number Diff line
@@ -1299,6 +1299,7 @@ public class TouchInteractionService extends Service {
        Log.i(TAG, "preloadOverview: forSUWAllSet=" + forSUWAllSet
                + ", isHomeAndOverviewSame=" + mOverviewComponentObserver.isHomeAndOverviewSame());

        ActiveGestureLog.INSTANCE.addLog("preloadRecentsAnimation");
        mTaskAnimationManager.preloadRecentsAnimation(overviewIntent);
    }

Loading