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

Commit 9b212379 authored by Yisroel Forta's avatar Yisroel Forta Committed by Android (Google) Code Review
Browse files

Merge "Ensure AppStartInfo Intent does not contain large objects" into main

parents 43b19a4a 08b1e8f9
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -416,11 +416,34 @@ public final class ApplicationStartInfo implements Parcelable {

    /**
     * @see #getStartIntent
     *
     * <p class="note"> Note: This method will clone the provided intent and ensure that the cloned
     * intent doesn't contain any large objects like bitmaps in its extras by stripping it in the
     * least aggressive acceptable way for the individual intent.</p>
     *
     * @hide
     */
    public void setIntent(Intent startIntent) {
        if (startIntent != null) {
            if (startIntent.canStripForHistory()) {
                // If maybeStripForHistory will return a lightened version, do that.
                mStartIntent = startIntent.maybeStripForHistory();
            } else if (startIntent.getExtras() != null) {
                // If maybeStripForHistory would not return a lightened version and extras is
                // non-null then extras contains un-parcelled data. Use cloneFilter to strip data
                // more aggressively.
                mStartIntent = startIntent.cloneFilter();
            } else {
                // Finally, if maybeStripForHistory would not return a lightened version and extras
                // is null then do a regular clone so we don't leak the intent.
                mStartIntent = new Intent(startIntent);
            }

            // If the newly cloned intent has an original intent, clear that as we don't need it and
            // can't guarantee it doesn't need to be stripped as well.
            if (mStartIntent.getOriginalIntent() != null) {
                mStartIntent.setOriginalIntent(null);
            }
        }
    }