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

Commit 978f80da authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge changes Iccb78a1e,I19a700bd into main

* changes:
  Replace VISIT_RISKY_URIS with a bugfix flag
  Revert^3 "Visit URIs in intents associated with notifications."
parents c00e8399 58610f3d
Loading
Loading
Loading
Loading
+8 −76
Original line number Diff line number Diff line
@@ -2239,9 +2239,6 @@ public class Notification implements Parcelable
        private void visitUris(@NonNull Consumer<Uri> visitor) {
            visitIconUri(visitor, getIcon());
            if (actionIntent != null) {
                actionIntent.visitUris(visitor);
            }
        }
        @Override
@@ -2957,21 +2954,6 @@ public class Notification implements Parcelable
            }
        }
        // allPendingIntents should contain all associated intents after parcelling, but it may also
        // contain intents added by the app to extras for their own purposes. We only care about
        // checking the intents known and used by system_server, to avoid the confused deputy issue.
        List<PendingIntent> pendingIntents = Arrays.asList(contentIntent, deleteIntent,
                fullScreenIntent);
        for (PendingIntent intent : pendingIntents) {
            if (intent != null) {
                intent.visitUris(visitor);
            }
        }
        if (mBubbleMetadata != null) {
            mBubbleMetadata.visitUris(visitor);
        }
        if (extras != null) {
            visitIconUri(visitor, extras.getParcelable(EXTRA_LARGE_ICON_BIG, Icon.class));
            visitIconUri(visitor, extras.getParcelable(EXTRA_PICTURE_ICON, Icon.class));
@@ -3043,30 +3025,17 @@ public class Notification implements Parcelable
                callPerson.visitUris(visitor);
            }
            visitIconUri(visitor, extras.getParcelable(EXTRA_VERIFICATION_ICON, Icon.class));
            // Extras for MediaStyle.
            PendingIntent deviceIntent = extras.getParcelable(EXTRA_MEDIA_REMOTE_INTENT,
                    PendingIntent.class);
            if (deviceIntent != null) {
                deviceIntent.visitUris(visitor);
        }
            if (extras.containsKey(WearableExtender.EXTRA_WEARABLE_EXTENSIONS)) {
                WearableExtender extender = new WearableExtender(this);
                extender.visitUris(visitor);
            }
            if (extras.containsKey(TvExtender.EXTRA_TV_EXTENDER)) {
                TvExtender extender = new TvExtender(this);
                extender.visitUris(visitor);
        if (mBubbleMetadata != null) {
            visitIconUri(visitor, mBubbleMetadata.getIcon());
        }
            if (extras.containsKey(CarExtender.EXTRA_CAR_EXTENDER)) {
                CarExtender extender = new CarExtender(this);
        if (extras != null && extras.containsKey(WearableExtender.EXTRA_WEARABLE_EXTENSIONS)) {
            WearableExtender extender = new WearableExtender(this);
            extender.visitUris(visitor);
        }
    }
    }
    /**
     * @hide
@@ -11459,16 +11428,6 @@ public class Notification implements Parcelable
            }
        }
        private void visitUris(@NonNull Consumer<Uri> visitor) {
            visitIconUri(visitor, getIcon());
            if (mPendingIntent != null) {
                mPendingIntent.visitUris(visitor);
            }
            if (mDeleteIntent != null) {
                mDeleteIntent.visitUris(visitor);
            }
        }
        /**
         * Builder to construct a {@link BubbleMetadata} object.
         */
@@ -12667,9 +12626,6 @@ public class Notification implements Parcelable
        }
        private void visitUris(@NonNull Consumer<Uri> visitor) {
            if (mDisplayIntent != null) {
                mDisplayIntent.visitUris(visitor);
            }
            for (Action action : mActions) {
                action.visitUris(visitor);
            }
@@ -12829,12 +12785,6 @@ public class Notification implements Parcelable
            return mUnreadConversation;
        }
        private void visitUris(@NonNull Consumer<Uri> visitor) {
            if (mUnreadConversation != null) {
                mUnreadConversation.visitUris(visitor);
            }
        }
        /**
         * A class which holds the unread messages from a conversation.
         */
@@ -12986,16 +12936,7 @@ public class Notification implements Parcelable
                        onRead,
                        participants, b.getLong(KEY_TIMESTAMP));
            }
            private void visitUris(@NonNull Consumer<Uri> visitor) {
                if (mReadPendingIntent != null) {
                    mReadPendingIntent.visitUris(visitor);
                }
                if (mReplyPendingIntent != null) {
                    mReplyPendingIntent.visitUris(visitor);
                }
            }
        }
        };
        /**
         * Builder class for {@link CarExtender.UnreadConversation} objects.
@@ -13318,15 +13259,6 @@ public class Notification implements Parcelable
        public boolean isSuppressShowOverApps() {
            return mSuppressShowOverApps;
        }
        private void visitUris(@NonNull Consumer<Uri> visitor) {
            if (mContentIntent != null) {
                mContentIntent.visitUris(visitor);
            }
            if (mDeleteIntent != null) {
                mDeleteIntent.visitUris(visitor);
            }
        }
    }
    /**
+0 −18
Original line number Diff line number Diff line
@@ -44,8 +44,6 @@ import android.content.IntentSender;
import android.content.pm.PackageManager.ResolveInfoFlagsBits;
import android.content.pm.ParceledListSlice;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -71,7 +69,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.function.Consumer;

/**
 * A description of an Intent and target action to perform with it.  Instances
@@ -1471,21 +1468,6 @@ public final class PendingIntent implements Parcelable {
        return sb.toString();
    }

    /**
     * See {@link Intent#visitUris(Consumer)}.
     *
     * @hide
     */
    public void visitUris(@NonNull Consumer<Uri> visitor) {
        if (android.app.Flags.visitRiskyUris()) {
            Intent intent = Binder.withCleanCallingIdentity(this::getIntent);

            if (intent != null) {
                intent.visitUris(visitor);
            }
        }
    }

    /** @hide */
    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
+1 −1
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ public final class Person implements Parcelable {
     */
    public void visitUris(@NonNull Consumer<Uri> visitor) {
        visitor.accept(getIconUri());
        if (Flags.visitRiskyUris()) {
        if (Flags.visitPersonUri()) {
            if (mUri != null && !mUri.isEmpty()) {
                visitor.accept(Uri.parse(mUri));
            }
+5 −2
Original line number Diff line number Diff line
@@ -46,10 +46,13 @@ flag {
}

flag {
  name: "visit_risky_uris"
  name: "visit_person_uri"
  namespace: "systemui"
  description: "Guards the security fix that ensures all URIs in intents and Person.java are valid"
  description: "Guards the security fix that ensures all URIs Person.java are valid"
  bug: "281044385"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

# vvv Prototypes for using app icons in notifications vvv
+0 −22
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.function.Consumer;
/**
 * An intent is an abstract description of an operation to be performed.  It
@@ -8330,27 +8329,6 @@ public class Intent implements Parcelable, Cloneable {
        }
    }
    /**
     * Note all {@link Uri} that are referenced internally, with the expectation that Uri permission
     * grants will need to be issued to ensure the recipient of this object is able to render its
     * contents.
     * See b/281044385 for more context and examples about what happens when this isn't done
     * correctly.
     *
     * @hide
     */
    public void visitUris(@NonNull Consumer<Uri> visitor) {
        if (android.app.Flags.visitRiskyUris()) {
            visitor.accept(mData);
            if (mSelector != null) {
                mSelector.visitUris(visitor);
            }
            if (mOriginalIntent != null) {
                mOriginalIntent.visitUris(visitor);
            }
        }
    }
    public static Intent getIntentOld(String uri) throws URISyntaxException {
        Intent intent = getIntentOld(uri, 0);
        intent.mLocalFlags |= LOCAL_FLAG_FROM_URI;
Loading