diff options
| author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-01-27 11:47:34 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-01-27 11:47:34 +0000 |
| commit | f9dbe61693e377c609ee3ccdc51d166aa9d38bb4 (patch) | |
| tree | 5f2c00897fbee0fc8113e55d9343ed0c97a1a50a /core/java/android | |
| parent | da932b4a453f9fbe3e212aa18d93816d71d9477e (diff) | |
| parent | fa528b2d2014c8ab3e6f468eeb15df1f3a04b417 (diff) | |
Merge "[FUI03] No-op refactoring of VpnInfo"
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/net/IConnectivityManager.aidl | 2 | ||||
| -rw-r--r-- | core/java/android/net/INetworkStatsService.aidl | 2 | ||||
| -rw-r--r-- | core/java/android/net/VpnInfo.aidl | 19 | ||||
| -rw-r--r-- | core/java/android/net/VpnInfo.java | 86 |
4 files changed, 107 insertions, 2 deletions
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl index 6fecee632d62..719783163ab9 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -31,6 +31,7 @@ import android.net.NetworkRequest; import android.net.NetworkState; import android.net.ProxyInfo; import android.net.UidRange; +import android.net.VpnInfo; import android.net.QosSocketInfo; import android.os.Bundle; import android.os.IBinder; @@ -43,7 +44,6 @@ import android.os.ResultReceiver; import com.android.connectivity.aidl.INetworkAgent; import com.android.internal.net.LegacyVpnInfo; import com.android.internal.net.VpnConfig; -import com.android.internal.net.VpnInfo; import com.android.internal.net.VpnProfile; /** diff --git a/core/java/android/net/INetworkStatsService.aidl b/core/java/android/net/INetworkStatsService.aidl index 1a3dc974480c..d5aede71011f 100644 --- a/core/java/android/net/INetworkStatsService.aidl +++ b/core/java/android/net/INetworkStatsService.aidl @@ -23,11 +23,11 @@ import android.net.NetworkState; import android.net.NetworkStats; import android.net.NetworkStatsHistory; import android.net.NetworkTemplate; +import android.net.VpnInfo; import android.net.netstats.provider.INetworkStatsProvider; import android.net.netstats.provider.INetworkStatsProviderCallback; import android.os.IBinder; import android.os.Messenger; -import com.android.internal.net.VpnInfo; /** {@hide} */ interface INetworkStatsService { diff --git a/core/java/android/net/VpnInfo.aidl b/core/java/android/net/VpnInfo.aidl new file mode 100644 index 000000000000..8bcaa81f3992 --- /dev/null +++ b/core/java/android/net/VpnInfo.aidl @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2015 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; + +parcelable VpnInfo; diff --git a/core/java/android/net/VpnInfo.java b/core/java/android/net/VpnInfo.java new file mode 100644 index 000000000000..cf58c570f21f --- /dev/null +++ b/core/java/android/net/VpnInfo.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2015 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; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.Arrays; + +/** + * A lightweight container used to carry information of the ongoing VPN. + * Internal use only. + * + * @hide + */ +public class VpnInfo implements Parcelable { + public final int ownerUid; + @Nullable + public final String vpnIface; + @Nullable + public final String[] underlyingIfaces; + + public VpnInfo(int ownerUid, @Nullable String vpnIface, @Nullable String[] underlyingIfaces) { + this.ownerUid = ownerUid; + this.vpnIface = vpnIface; + this.underlyingIfaces = underlyingIfaces; + } + + private VpnInfo(@NonNull Parcel in) { + this.ownerUid = in.readInt(); + this.vpnIface = in.readString(); + this.underlyingIfaces = in.createStringArray(); + } + + @Override + public String toString() { + return "VpnInfo{" + + "ownerUid=" + ownerUid + + ", vpnIface='" + vpnIface + '\'' + + ", underlyingIfaces='" + Arrays.toString(underlyingIfaces) + '\'' + + '}'; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeInt(ownerUid); + dest.writeString(vpnIface); + dest.writeStringArray(underlyingIfaces); + } + + @NonNull + public static final Parcelable.Creator<VpnInfo> CREATOR = new Parcelable.Creator<VpnInfo>() { + @NonNull + @Override + public VpnInfo createFromParcel(@NonNull Parcel in) { + return new VpnInfo(in); + } + + @NonNull + @Override + public VpnInfo[] newArray(int size) { + return new VpnInfo[size]; + } + }; +} |
