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

Commit 435fbc69 authored by Louis Chang's avatar Louis Chang Committed by Automerger Merge Worker
Browse files

Merge "Sending TaskFragment token to client for the launching activity" into...

Merge "Sending TaskFragment token to client for the launching activity" into sc-v2-dev am: 3acc328b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15407674

Change-Id: Iab5ddf47b82b128674ec3cc6c1017cf8417689af
parents 6bf41e24 3acc328b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -530,6 +530,8 @@ 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 TaskFragment that embedded this activity.
        @Nullable public IBinder mTaskFragmentToken;
        int ident;
        @UnsupportedAppUsage
        Intent intent;
@@ -623,7 +625,8 @@ 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 shareableActivityToken, boolean launchedFromBubble,
                IBinder taskFragmentToken) {
            this.token = token;
            this.assistToken = assistToken;
            this.shareableActivityToken = shareableActivityToken;
@@ -645,6 +648,7 @@ public final class ActivityThread extends ClientTransactionHandler
            mActivityOptions = activityOptions;
            mPendingFixedRotationAdjustments = fixedRotationAdjustments;
            mLaunchedFromBubble = launchedFromBubble;
            mTaskFragmentToken = taskFragmentToken;
            init();
        }

+13 −7
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ 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.
@@ -86,7 +87,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
                mOverrideConfig, mCompatInfo, mReferrer, mVoiceInteractor, mState, mPersistentState,
                mPendingResults, mPendingNewIntents, mActivityOptions, mIsForward, mProfilerInfo,
                client, mAssistToken, mFixedRotationAdjustments, mShareableActivityToken,
                mLaunchedFromBubble);
                mLaunchedFromBubble, mTaskFragmentToken);
        client.addLaunchingActivity(token, r);
        client.updateProcessState(mProcState, false);
        client.updatePendingConfiguration(mCurConfig);
@@ -124,7 +125,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
            boolean isForward, ProfilerInfo profilerInfo, IBinder assistToken,
            IActivityClientController activityClientController,
            FixedRotationAdjustments fixedRotationAdjustments, IBinder shareableActivityToken,
            boolean launchedFromBubble) {
            boolean launchedFromBubble, IBinder taskFragmentToken) {
        LaunchActivityItem instance = ObjectPool.obtain(LaunchActivityItem.class);
        if (instance == null) {
            instance = new LaunchActivityItem();
@@ -133,7 +134,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
                voiceInteractor, procState, state, persistentState, pendingResults,
                pendingNewIntents, activityOptions, isForward, profilerInfo, assistToken,
                activityClientController, fixedRotationAdjustments, shareableActivityToken,
                launchedFromBubble);
                launchedFromBubble, taskFragmentToken);

        return instance;
    }
@@ -141,7 +142,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, false, null, null, null, null, null, false, null);
        ObjectPool.recycle(this);
    }

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

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

    public static final @NonNull Creator<LaunchActivityItem> CREATOR =
@@ -229,7 +232,8 @@ 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(mShareableActivityToken, other.mShareableActivityToken)
                && Objects.equals(mTaskFragmentToken, other.mTaskFragmentToken);
    }

    @Override
@@ -252,6 +256,7 @@ 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;
    }

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

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

        LaunchActivityItemBuilder setIntent(Intent intent) {
            mIntent = intent;
@@ -213,13 +214,18 @@ 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);
                    mShareableActivityToken, mLaunchedFromBubble, mTaskFragmentToken);
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ public class TransactionParcelTests {
                .setPendingNewIntents(referrerIntentList()).setIsForward(true)
                .setAssistToken(new Binder()).setFixedRotationAdjustments(fixedRotationAdjustments)
                .setShareableActivityToken(new Binder())
                .setTaskFragmentToken(new Binder())
                .build();

        writeAndPrepareForReading(item);
Loading