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

Commit aa1569c4 authored by Austin Borger's avatar Austin Borger
Browse files

AttributionSource: Deprecate setNext, add new setNextAttributionSource

setNext accepts a null argument, which is problematic from a security
standpoint. The utility of this is pretty much nonexistent and can lead
to check-for-null vulnerabilities. This patch deprecates setNext and
adds a new setNextAttributionSource which does the same thing, but does
not accept null arguments.

Bug: 271291107
Test: CTS test
Change-Id: If512274a3a477a71982178323cd4fd63ad1609e3
parent 83fd58ad
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -9703,7 +9703,8 @@ package android.content {
    ctor public AttributionSource.Builder(@NonNull android.content.AttributionSource);
    ctor public AttributionSource.Builder(@NonNull android.content.AttributionSource);
    method @NonNull public android.content.AttributionSource build();
    method @NonNull public android.content.AttributionSource build();
    method @NonNull public android.content.AttributionSource.Builder setAttributionTag(@Nullable String);
    method @NonNull public android.content.AttributionSource.Builder setAttributionTag(@Nullable String);
    method @NonNull public android.content.AttributionSource.Builder setNext(@Nullable android.content.AttributionSource);
    method @Deprecated @NonNull public android.content.AttributionSource.Builder setNext(@Nullable android.content.AttributionSource);
    method @NonNull public android.content.AttributionSource.Builder setNextAttributionSource(@NonNull android.content.AttributionSource);
    method @NonNull public android.content.AttributionSource.Builder setPackageName(@Nullable String);
    method @NonNull public android.content.AttributionSource.Builder setPackageName(@Nullable String);
    method @NonNull public android.content.AttributionSource.Builder setPid(int);
    method @NonNull public android.content.AttributionSource.Builder setPid(int);
  }
  }
+14 −0
Original line number Original line Diff line number Diff line
@@ -662,7 +662,10 @@ public final class AttributionSource implements Parcelable {


        /**
        /**
         * The next app to receive the permission protected data.
         * The next app to receive the permission protected data.
         *
         * @deprecated Use {@link setNextAttributionSource} instead.
         */
         */
        @Deprecated
        public @NonNull Builder setNext(@Nullable AttributionSource value) {
        public @NonNull Builder setNext(@Nullable AttributionSource value) {
            checkNotUsed();
            checkNotUsed();
            mBuilderFieldsSet |= 0x20;
            mBuilderFieldsSet |= 0x20;
@@ -671,6 +674,17 @@ public final class AttributionSource implements Parcelable {
            return this;
            return this;
        }
        }


        /**
         * The next app to receive the permission protected data.
         */
        public @NonNull Builder setNextAttributionSource(@NonNull AttributionSource value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x20;
            mAttributionSourceState.next =
                    new AttributionSourceState[]{value.mAttributionSourceState};
            return this;
        }

        /** Builds the instance. This builder should not be touched after calling this! */
        /** Builds the instance. This builder should not be touched after calling this! */
        public @NonNull AttributionSource build() {
        public @NonNull AttributionSource build() {
            checkNotUsed();
            checkNotUsed();