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

Commit c335e905 authored by Soonil Nagarkar's avatar Soonil Nagarkar Committed by Android (Google) Code Review
Browse files

Merge "Add API for immutable PendingIntents"

parents 352aab51 0773220f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6140,6 +6140,7 @@ package android.app {
    method public android.content.IntentSender getIntentSender();
    method public static android.app.PendingIntent getService(android.content.Context, int, @NonNull android.content.Intent, int);
    method @Deprecated public String getTargetPackage();
    method public boolean isImmutable();
    method @Nullable public static android.app.PendingIntent readPendingIntentOrNullFromParcel(@NonNull android.os.Parcel);
    method public void send() throws android.app.PendingIntent.CanceledException;
    method public void send(int) throws android.app.PendingIntent.CanceledException;
+1 −0
Original line number Diff line number Diff line
@@ -6140,6 +6140,7 @@ package android.app {
    method public android.content.IntentSender getIntentSender();
    method public static android.app.PendingIntent getService(android.content.Context, int, @NonNull android.content.Intent, int);
    method @Deprecated public String getTargetPackage();
    method public boolean isImmutable();
    method @Nullable public static android.app.PendingIntent readPendingIntentOrNullFromParcel(@NonNull android.os.Parcel);
    method public void send() throws android.app.PendingIntent.CanceledException;
    method public void send(int) throws android.app.PendingIntent.CanceledException;
+1 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@ interface IActivityManager {
    @UnsupportedAppUsage
    void unregisterProcessObserver(in IProcessObserver observer);
    boolean isIntentSenderTargetedToPackage(in IIntentSender sender);
    boolean isIntentSenderImmutable(in IIntentSender sender);
    @UnsupportedAppUsage
    void updatePersistentConfiguration(in Configuration values);
    void updatePersistentConfigurationWithAttribution(in Configuration values,
+12 −0
Original line number Diff line number Diff line
@@ -1144,6 +1144,18 @@ public final class PendingIntent implements Parcelable {
        }
    }

    /**
     * Check if this PendingIntent is marked with {@link #FLAG_IMMUTABLE}.
     */
    public boolean isImmutable() {
        try {
            return ActivityManager.getService()
                    .isIntentSenderImmutable(mTarget);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * @hide
     * Check whether this PendingIntent will launch an Activity.
+9 −0
Original line number Diff line number Diff line
@@ -4889,6 +4889,15 @@ public class ActivityManagerService extends IActivityManager.Stub
        return false;
    }
    @Override
    public boolean isIntentSenderImmutable(IIntentSender pendingResult) {
        if (pendingResult instanceof PendingIntentRecord) {
            final PendingIntentRecord res = (PendingIntentRecord) pendingResult;
            return (res.key.flags & PendingIntent.FLAG_IMMUTABLE) != 0;
        }
        return false;
    }
    @Override
    public boolean isIntentSenderAnActivity(IIntentSender pendingResult) {
        if (!(pendingResult instanceof PendingIntentRecord)) {