Merge "Move UidRange to connectivity" am: 1c5e8b1def

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612295

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I672615b0804b9a9de4befa1ba5aea2efb9c962df
This commit is contained in:
Remi NGUYEN VAN
2021-03-02 20:24:20 +00:00
committed by Automerger Merge Worker
2 changed files with 37 additions and 14 deletions

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.net;
/**
* An inclusive range of UIDs.
*
* {@hide}
*/
parcelable UidRange;

View File

@@ -16,8 +16,6 @@
package android.net; package android.net;
import static android.os.UserHandle.PER_USER_RANGE;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -60,6 +58,7 @@ public final class UidRange implements Parcelable {
return UserHandle.getUserHandleForUid(stop).getIdentifier(); return UserHandle.getUserHandleForUid(stop).getIdentifier();
} }
/** Returns whether the UidRange contains the specified UID. */
public boolean contains(int uid) { public boolean contains(int uid) {
return start <= uid && uid <= stop; return start <= uid && uid <= stop;
} }
@@ -72,7 +71,7 @@ public final class UidRange implements Parcelable {
} }
/** /**
* @return {@code true} if this range contains every UID contained by the {@param other} range. * @return {@code true} if this range contains every UID contained by the {@code other} range.
*/ */
public boolean containsRange(UidRange other) { public boolean containsRange(UidRange other) {
return start <= other.start && other.stop <= stop; return start <= other.start && other.stop <= stop;
@@ -118,18 +117,18 @@ public final class UidRange implements Parcelable {
} }
public static final @android.annotation.NonNull Creator<UidRange> CREATOR = public static final @android.annotation.NonNull Creator<UidRange> CREATOR =
new Creator<UidRange>() { new Creator<UidRange>() {
@Override @Override
public UidRange createFromParcel(Parcel in) { public UidRange createFromParcel(Parcel in) {
int start = in.readInt(); int start = in.readInt();
int stop = in.readInt(); int stop = in.readInt();
return new UidRange(start, stop); return new UidRange(start, stop);
} }
@Override @Override
public UidRange[] newArray(int size) { public UidRange[] newArray(int size) {
return new UidRange[size]; return new UidRange[size];
} }
}; };
/** /**