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

Commit 0fcdd8b5 authored by Nate Myren's avatar Nate Myren
Browse files

Replace sDefaultToken with new token

This ensures that multiple AttributionSources do not share a single
default token. Also adds permission owners to AttributionSource

Bug: 190657833
Test: presubmit
Change-Id: Ibdca7d2d4112bb39e11279889e98a36b53795aa2
parent 454be31e
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ import java.util.Set;
public final class AttributionSource implements Parcelable {
    private static final String DESCRIPTOR = "android.content.AttributionSource";

    private static final Binder sDefaultToken = new Binder(DESCRIPTOR);

    private final @NonNull AttributionSourceState mAttributionSourceState;

@@ -100,7 +99,7 @@ public final class AttributionSource implements Parcelable {
    @TestApi
    public AttributionSource(int uid, @Nullable String packageName,
            @Nullable String attributionTag) {
        this(uid, packageName, attributionTag, sDefaultToken);
        this(uid, packageName, attributionTag, new Binder(DESCRIPTOR));
    }

    /** @hide */
@@ -135,7 +134,7 @@ public final class AttributionSource implements Parcelable {

    AttributionSource(int uid, @Nullable String packageName, @Nullable String attributionTag,
            @Nullable String[] renouncedPermissions, @Nullable AttributionSource next) {
        this(uid, packageName, attributionTag, sDefaultToken, renouncedPermissions, next);
        this(uid, packageName, attributionTag, new Binder(DESCRIPTOR), renouncedPermissions, next);
    }

    AttributionSource(int uid, @Nullable String packageName, @Nullable String attributionTag,
@@ -640,7 +639,7 @@ public final class AttributionSource implements Parcelable {
                mAttributionSourceState.next = null;
            }

            mAttributionSourceState.token = sDefaultToken;
            mAttributionSourceState.token = new Binder(DESCRIPTOR);

            if (mAttributionSourceState.next == null) {
                // The NDK aidl backend doesn't support null parcelable arrays.
+1 −0
Original line number Diff line number Diff line
@@ -13,3 +13,4 @@ per-file ContentCaptureOptions* = file:/core/java/android/service/contentcapture
per-file LocusId* = file:/core/java/android/service/contentcapture/OWNERS
per-file ComponentCallbacksController = file:/services/core/java/com/android/server/wm/OWNERS
per-file ComponentCallbacksController = charlesccchen@google.com
per-file AttributionSource* = file:/core/java/android/permission/OWNERS