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

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

Merge "Don't rely on intent to call back from activity tracker" into sc-dev

parents 9c25a4dd 1c2d522d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Intent;
import android.os.Bundle;

import com.android.launcher3.BaseActivity;
import com.android.launcher3.Launcher;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.ActivityTracker;

@@ -37,7 +38,8 @@ public class HotseatEduActivity extends Activity {
                .addCategory(Intent.CATEGORY_HOME)
                .setPackage(getPackageName())
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        new HotseatActivityTracker<>().addToIntent(homeIntent);

        Launcher.ACTIVITY_TRACKER.registerCallback(new HotseatActivityTracker());
        startActivity(homeIntent);
        finish();
    }
+9 −3
Original line number Diff line number Diff line
@@ -349,6 +349,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
        }

        if (mActivity != null) {
            if (mStateCallback.hasStates(STATE_GESTURE_COMPLETED)) {
                // If the activity has restarted between setting the page scroll settling callback
                // and actually receiving the callback, just mark the gesture completed
                mGestureState.setState(STATE_RECENTS_SCROLLING_FINISHED);
                return true;
            }

            // The launcher may have been recreated as a result of device rotation.
            int oldState = mStateCallback.getState() & ~LAUNCHER_UI_STATES;
            initStateCallbacks();
@@ -1717,13 +1724,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,

    /**
     * Registers a callback to run when the activity is ready.
     * @param intent The intent that will be used to start the activity if it doesn't exist already.
     */
    public void initWhenReady(Intent intent) {
    public void initWhenReady() {
        // Preload the plan
        RecentsModel.INSTANCE.get(mContext).getTasks(null);

        mActivityInitListener.register(intent);
        mActivityInitListener.register();
    }

    /**
+2 −3
Original line number Diff line number Diff line
@@ -184,9 +184,7 @@ public class OverviewCommandHelper {
                .newHandler(gestureState, cmd.createTime);
        interactionHandler.setGestureEndCallback(
                () -> onTransitionComplete(cmd, interactionHandler));

        Intent intent = new Intent(interactionHandler.getLaunchIntent());
        interactionHandler.initWhenReady(intent);
        interactionHandler.initWhenReady();

        RecentsAnimationListener recentAnimListener = new RecentsAnimationListener() {
            @Override
@@ -212,6 +210,7 @@ public class OverviewCommandHelper {
            cmd.mActiveCallbacks.addListener(recentAnimListener);
            mTaskAnimationManager.notifyRecentsAnimationState(recentAnimListener);
        } else {
            Intent intent = new Intent(interactionHandler.getLaunchIntent());
            intent.putExtra(INTENT_EXTRA_LOG_TRACE_ID, gestureState.getGestureId());
            cmd.mActiveCallbacks = mTaskAnimationManager.startRecentsAnimation(
                    gestureState, intent, interactionHandler);
+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        ACTIVITY_TRACKER.handleNewIntent(this, intent);
        ACTIVITY_TRACKER.handleNewIntent(this);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -389,8 +389,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
        mInteractionHandler = mHandlerFactory.newHandler(mGestureState, touchTimeMs);
        mInteractionHandler.setGestureEndCallback(this::onInteractionGestureFinished);
        mMotionPauseDetector.setOnMotionPauseListener(mInteractionHandler.getMotionPauseListener());
        Intent intent = new Intent(mInteractionHandler.getLaunchIntent());
        mInteractionHandler.initWhenReady(intent);
        mInteractionHandler.initWhenReady();

        if (mTaskAnimationManager.isRecentsAnimationRunning()) {
            mActiveCallbacks = mTaskAnimationManager.continueRecentsAnimation(mGestureState);
@@ -398,6 +397,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
            mTaskAnimationManager.notifyRecentsAnimationState(mInteractionHandler);
            notifyGestureStarted(true /*isLikelyToStartNewTask*/);
        } else {
            Intent intent = new Intent(mInteractionHandler.getLaunchIntent());
            intent.putExtra(INTENT_EXTRA_LOG_TRACE_ID, mGestureState.getGestureId());
            mActiveCallbacks = mTaskAnimationManager.startRecentsAnimation(mGestureState, intent,
                    mInteractionHandler);
Loading