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

Commit 6dc12402 authored by Louis Chang's avatar Louis Chang
Browse files

Removing TaskFragment token from LaunchActivityItem

The token was needed because the TaskFragment info may not
sent to the organizer before activity created.

The token is no longer necessary because the TaskFragment
info is now ensured to be updated before activity created.

Bug: 200303250
Test: wm presubmit
Change-Id: I69a42fa35efde4fc7f37ab50334de5de146da90d
parent 2bc0ca24
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -526,9 +526,6 @@ public final class ActivityThread extends ClientTransactionHandler
        // A reusable token for other purposes, e.g. content capture, translation. It shouldn't be
        // used without security checks
        public IBinder shareableActivityToken;
        // The token of the initial TaskFragment that embedded this activity. Do not rely on it
        // after creation because the activity could be reparented.
        @Nullable public IBinder mInitialTaskFragmentToken;
        int ident;
        @UnsupportedAppUsage
        Intent intent;
@@ -622,8 +619,7 @@ public final class ActivityThread extends ClientTransactionHandler
                List<ReferrerIntent> pendingNewIntents, ActivityOptions activityOptions,
                boolean isForward, ProfilerInfo profilerInfo, ClientTransactionHandler client,
                IBinder assistToken, FixedRotationAdjustments fixedRotationAdjustments,
                IBinder shareableActivityToken, boolean launchedFromBubble,
                IBinder initialTaskFragmentToken) {
                IBinder shareableActivityToken, boolean launchedFromBubble) {
            this.token = token;
            this.assistToken = assistToken;
            this.shareableActivityToken = shareableActivityToken;
@@ -645,7 +641,6 @@ public final class ActivityThread extends ClientTransactionHandler
            mActivityOptions = activityOptions;
            mPendingFixedRotationAdjustments = fixedRotationAdjustments;
            mLaunchedFromBubble = launchedFromBubble;
            mInitialTaskFragmentToken = initialTaskFragmentToken;
            init();
        }

+7 −13
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ public class LaunchActivityItem extends ClientTransactionItem {
    private IBinder mAssistToken;
    private IBinder mShareableActivityToken;
    private boolean mLaunchedFromBubble;
    private IBinder mTaskFragmentToken;
    /**
     * It is only non-null if the process is the first time to launch activity. It is only an
     * optimization for quick look up of the interface so the field is ignored for comparison.
@@ -87,7 +86,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
                mOverrideConfig, mCompatInfo, mReferrer, mVoiceInteractor, mState, mPersistentState,
                mPendingResults, mPendingNewIntents, mActivityOptions, mIsForward, mProfilerInfo,
                client, mAssistToken, mFixedRotationAdjustments, mShareableActivityToken,
                mLaunchedFromBubble, mTaskFragmentToken);
                mLaunchedFromBubble);
        client.addLaunchingActivity(token, r);
        client.updateProcessState(mProcState, false);
        client.updatePendingConfiguration(mCurConfig);
@@ -125,7 +124,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
            boolean isForward, ProfilerInfo profilerInfo, IBinder assistToken,
            IActivityClientController activityClientController,
            FixedRotationAdjustments fixedRotationAdjustments, IBinder shareableActivityToken,
            boolean launchedFromBubble, IBinder taskFragmentToken) {
            boolean launchedFromBubble) {
        LaunchActivityItem instance = ObjectPool.obtain(LaunchActivityItem.class);
        if (instance == null) {
            instance = new LaunchActivityItem();
@@ -134,7 +133,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
                voiceInteractor, procState, state, persistentState, pendingResults,
                pendingNewIntents, activityOptions, isForward, profilerInfo, assistToken,
                activityClientController, fixedRotationAdjustments, shareableActivityToken,
                launchedFromBubble, taskFragmentToken);
                launchedFromBubble);

        return instance;
    }
@@ -142,7 +141,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
    @Override
    public void recycle() {
        setValues(this, null, 0, null, null, null, null, null, null, 0, null, null, null, null,
                null, false, null, null, null, null, null, false, null);
                null, false, null, null, null, null, null, false);
        ObjectPool.recycle(this);
    }

@@ -173,7 +172,6 @@ public class LaunchActivityItem extends ClientTransactionItem {
        dest.writeTypedObject(mFixedRotationAdjustments, flags);
        dest.writeStrongBinder(mShareableActivityToken);
        dest.writeBoolean(mLaunchedFromBubble);
        dest.writeStrongBinder(mTaskFragmentToken);
    }

    /** Read from Parcel. */
@@ -192,8 +190,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
                in.readStrongBinder(),
                IActivityClientController.Stub.asInterface(in.readStrongBinder()),
                in.readTypedObject(FixedRotationAdjustments.CREATOR), in.readStrongBinder(),
                in.readBoolean(),
                in.readStrongBinder());
                in.readBoolean());
    }

    public static final @NonNull Creator<LaunchActivityItem> CREATOR =
@@ -232,8 +229,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
                && Objects.equals(mProfilerInfo, other.mProfilerInfo)
                && Objects.equals(mAssistToken, other.mAssistToken)
                && Objects.equals(mFixedRotationAdjustments, other.mFixedRotationAdjustments)
                && Objects.equals(mShareableActivityToken, other.mShareableActivityToken)
                && Objects.equals(mTaskFragmentToken, other.mTaskFragmentToken);
                && Objects.equals(mShareableActivityToken, other.mShareableActivityToken);
    }

    @Override
@@ -256,7 +252,6 @@ public class LaunchActivityItem extends ClientTransactionItem {
        result = 31 * result + Objects.hashCode(mAssistToken);
        result = 31 * result + Objects.hashCode(mFixedRotationAdjustments);
        result = 31 * result + Objects.hashCode(mShareableActivityToken);
        result = 31 * result + Objects.hashCode(mTaskFragmentToken);
        return result;
    }

@@ -306,7 +301,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
            ActivityOptions activityOptions, boolean isForward, ProfilerInfo profilerInfo,
            IBinder assistToken, IActivityClientController activityClientController,
            FixedRotationAdjustments fixedRotationAdjustments, IBinder shareableActivityToken,
            boolean launchedFromBubble, IBinder taskFragmentToken) {
            boolean launchedFromBubble) {
        instance.mIntent = intent;
        instance.mIdent = ident;
        instance.mInfo = info;
@@ -328,6 +323,5 @@ public class LaunchActivityItem extends ClientTransactionItem {
        instance.mFixedRotationAdjustments = fixedRotationAdjustments;
        instance.mShareableActivityToken = shareableActivityToken;
        instance.mLaunchedFromBubble = launchedFromBubble;
        instance.mTaskFragmentToken = taskFragmentToken;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ public class ObjectPoolTests {
                .setPendingResults(resultInfoList()).setPendingNewIntents(referrerIntentList())
                .setIsForward(true).setAssistToken(assistToken)
                .setShareableActivityToken(shareableActivityToken)
                .setTaskFragmentToken(new Binder()).build();
                .build();

        LaunchActivityItem emptyItem = new LaunchActivityItemBuilder().build();
        LaunchActivityItem item = itemSupplier.get();
+1 −7
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ class TestUtils {
        private IBinder mShareableActivityToken;
        private FixedRotationAdjustments mFixedRotationAdjustments;
        private boolean mLaunchedFromBubble;
        private IBinder mTaskFragmentToken;

        LaunchActivityItemBuilder setIntent(Intent intent) {
            mIntent = intent;
@@ -214,18 +213,13 @@ class TestUtils {
            return this;
        }

        LaunchActivityItemBuilder setTaskFragmentToken(IBinder taskFragmentToken) {
            mTaskFragmentToken = taskFragmentToken;
            return this;
        }

        LaunchActivityItem build() {
            return LaunchActivityItem.obtain(mIntent, mIdent, mInfo,
                    mCurConfig, mOverrideConfig, mCompatInfo, mReferrer, mVoiceInteractor,
                    mProcState, mState, mPersistentState, mPendingResults, mPendingNewIntents,
                    mActivityOptions, mIsForward, mProfilerInfo, mAssistToken,
                    null /* activityClientController */, mFixedRotationAdjustments,
                    mShareableActivityToken, mLaunchedFromBubble, mTaskFragmentToken);
                    mShareableActivityToken, mLaunchedFromBubble);
        }
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -209,7 +209,6 @@ public class TransactionParcelTests {
                .setPendingNewIntents(referrerIntentList()).setIsForward(true)
                .setAssistToken(new Binder()).setFixedRotationAdjustments(fixedRotationAdjustments)
                .setShareableActivityToken(new Binder())
                .setTaskFragmentToken(new Binder())
                .build();

        writeAndPrepareForReading(item);
Loading