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

Commit 5ee249a6 authored by Martin Brabham's avatar Martin Brabham Committed by android-build-merger
Browse files

DO NOT MERGE: ScanFilter: Fix argument sanitization logic. am: 9fae71bd

am: 61e97e2798

Change-Id: I52e4d64bd64672992f3f68585ae6949f57446f2e
parents 57f46875 9fae71bd
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -590,6 +590,9 @@ public final class ScanFilter implements Parcelable {
        public @NonNull Builder setServiceSolicitationUuid(
        public @NonNull Builder setServiceSolicitationUuid(
                @Nullable ParcelUuid serviceSolicitationUuid) {
                @Nullable ParcelUuid serviceSolicitationUuid) {
            mServiceSolicitationUuid = serviceSolicitationUuid;
            mServiceSolicitationUuid = serviceSolicitationUuid;
            if (serviceSolicitationUuid == null) {
                mServiceSolicitationUuidMask = null;
            }
            return this;
            return this;
        }
        }


@@ -600,13 +603,16 @@ public final class ScanFilter implements Parcelable {
         * indicate a match is needed for the bit in {@code serviceSolicitationUuid}, and 0 to
         * indicate a match is needed for the bit in {@code serviceSolicitationUuid}, and 0 to
         * ignore that bit.
         * ignore that bit.
         *
         *
         * @param serviceSolicitationUuid can only be null if solicitationUuidMask is null.
         * @param solicitationUuidMask can be null or a mask with no restriction.
         *
         * @throws IllegalArgumentException If {@code serviceSolicitationUuid} is {@code null} but
         * @throws IllegalArgumentException If {@code serviceSolicitationUuid} is {@code null} but
         *             {@code serviceSolicitationUuidMask} is not {@code null}.
         *             {@code serviceSolicitationUuidMask} is not {@code null}.
         */
         */
        public @NonNull Builder setServiceSolicitationUuid(
        public @NonNull Builder setServiceSolicitationUuid(
                @Nullable ParcelUuid serviceSolicitationUuid,
                @Nullable ParcelUuid serviceSolicitationUuid,
                @Nullable ParcelUuid solicitationUuidMask) {
                @Nullable ParcelUuid solicitationUuidMask) {
            if (mServiceSolicitationUuidMask != null && mServiceSolicitationUuid == null) {
            if (solicitationUuidMask != null && serviceSolicitationUuid == null) {
                throw new IllegalArgumentException(
                throw new IllegalArgumentException(
                        "SolicitationUuid is null while SolicitationUuidMask is not null!");
                        "SolicitationUuid is null while SolicitationUuidMask is not null!");
            }
            }