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

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

Merge "Prevent set intent on non-leaf tasks" into sc-dev am: 5dc6029d

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I20d91fe3d750616ad93a80566671ef26b08b8842
parents b7982ccc 5dc6029d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -307,6 +307,7 @@ message TaskProto {
    optional bool animating_bounds = 26 [deprecated = true];
    optional float minimize_amount = 27;
    optional bool created_by_organizer = 28;
    optional string affinity = 29;
}

/* represents ActivityRecordProto */
+6 −11
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ import static com.android.server.wm.Task.ActivityState.RESUMED;
import static com.android.server.wm.Task.ActivityState.STARTED;
import static com.android.server.wm.Task.ActivityState.STOPPING;
import static com.android.server.wm.TaskProto.ACTIVITY_TYPE;
import static com.android.server.wm.TaskProto.AFFINITY;
import static com.android.server.wm.TaskProto.BOUNDS;
import static com.android.server.wm.TaskProto.CREATED_BY_ORGANIZER;
import static com.android.server.wm.TaskProto.DISPLAY_ID;
@@ -1244,27 +1245,20 @@ class Task extends WindowContainer<WindowContainer> {
        mCallingFeatureId = r.launchedFromFeatureId;
        setIntent(intent != null ? intent : r.intent, info != null ? info : r.info);
        setLockTaskAuth(r);

        final WindowContainer parent = getParent();
        if (parent != null) {
            final Task t = parent.asTask();
            if (t != null) {
                t.setIntent(r);
            }
        }
    }

    /** Sets the original intent, _without_ updating the calling uid or package. */
    private void setIntent(Intent _intent, ActivityInfo info) {
        final boolean isLeaf = isLeafTask();
        if (!isLeafTask()) return;

        if (intent == null) {
            mNeverRelinquishIdentity =
                    (info.flags & FLAG_RELINQUISH_TASK_IDENTITY) == 0;
        } else if (mNeverRelinquishIdentity && isLeaf) {
        } else if (mNeverRelinquishIdentity) {
            return;
        }

        affinity = isLeaf ? info.taskAffinity : null;
        affinity = info.taskAffinity;
        if (intent == null) {
            // If this task already has an intent associated with it, don't set the root
            // affinity -- we don't want it changing after initially set, but the initially
@@ -7809,6 +7803,7 @@ class Task extends WindowContainer<WindowContainer> {
        }

        proto.write(CREATED_BY_ORGANIZER, mCreatedByOrganizer);
        proto.write(AFFINITY, affinity);

        proto.end(token);
    }