Stop using netd parcelables in the framework.
The only actual users of these classes are in services.jar, not in frameworks.jar. The only reason the framework depends on them is that the code that converts to and from stable parcelables is currently in the framework. Move that code to services and cut the dependency. These classes aren't used in the networkstack app so they don't need to be in shared. They also can't be in shared because the classes are not in the SDK. So put the conversion functions directly inside their only user (NetworkManagementService). Also remove the jarjar rules that rename the classes for use by the NetworkStack app. This does not actually remove the dependency from the build file, that will be done in a future CL. Bug: 128804404 Test: builds, boots Test: atest FrameworksNetTests android.net.cts.ConnectivityManagerTest HostsideVpnTests Change-Id: I027d50ba56091f5558f45e6e08f32e5912b2a82a Merged-In: I027d50ba56091f5558f45e6e08f32e5912b2a82a
This commit is contained in:
@@ -19,14 +19,17 @@ package android.net;
|
|||||||
import static android.os.UserHandle.PER_USER_RANGE;
|
import static android.os.UserHandle.PER_USER_RANGE;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An inclusive range of UIDs.
|
* An inclusive range of UIDs.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final class UidRange extends UidRangeParcel {
|
public final class UidRange implements Parcelable {
|
||||||
private UidRange() {}
|
public final int start;
|
||||||
|
public final int stop;
|
||||||
|
|
||||||
public UidRange(int startUid, int stopUid) {
|
public UidRange(int startUid, int stopUid) {
|
||||||
if (startUid < 0) throw new IllegalArgumentException("Invalid start UID.");
|
if (startUid < 0) throw new IllegalArgumentException("Invalid start UID.");
|
||||||
if (stopUid < 0) throw new IllegalArgumentException("Invalid stop UID.");
|
if (stopUid < 0) throw new IllegalArgumentException("Invalid stop UID.");
|
||||||
@@ -86,18 +89,28 @@ public final class UidRange extends UidRangeParcel {
|
|||||||
return start + "-" + stop;
|
return start + "-" + stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Implement the Parcelable interface
|
||||||
* DO NOT override "writeToParcel" and "readFromParcel" in this class.
|
// TODO: Consider making this class no longer parcelable, since all users are likely in the
|
||||||
* The parceling code is autogenerated by the superclass.
|
// system server.
|
||||||
*/
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeInt(start);
|
||||||
|
dest.writeInt(stop);
|
||||||
|
}
|
||||||
|
|
||||||
public static final Creator<UidRange> CREATOR =
|
public static final Creator<UidRange> CREATOR =
|
||||||
new Creator<UidRange>() {
|
new Creator<UidRange>() {
|
||||||
@Override
|
@Override
|
||||||
public UidRange createFromParcel(Parcel in) {
|
public UidRange createFromParcel(Parcel in) {
|
||||||
UidRange obj = new UidRange();
|
int start = in.readInt();
|
||||||
obj.readFromParcel(in);
|
int stop = in.readInt();
|
||||||
return obj;
|
|
||||||
|
return new UidRange(start, stop);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public UidRange[] newArray(int size) {
|
public UidRange[] newArray(int size) {
|
||||||
|
|||||||
Reference in New Issue
Block a user