Wenchao Tong | f5ea340 | 2015-03-04 13:26:38 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License |
| 15 | */ |
| 16 | |
| 17 | package com.android.internal.net; |
| 18 | |
| 19 | import android.os.Parcel; |
| 20 | import android.os.Parcelable; |
| 21 | |
Benedict Wong | edcd5ad | 2019-06-12 17:46:15 +0000 | [diff] [blame] | 22 | import java.util.Arrays; |
| 23 | |
Wenchao Tong | f5ea340 | 2015-03-04 13:26:38 -0800 | [diff] [blame] | 24 | /** |
| 25 | * A lightweight container used to carry information of the ongoing VPN. |
| 26 | * Internal use only.. |
| 27 | * |
| 28 | * @hide |
| 29 | */ |
| 30 | public class VpnInfo implements Parcelable { |
| 31 | public int ownerUid; |
| 32 | public String vpnIface; |
Benedict Wong | edcd5ad | 2019-06-12 17:46:15 +0000 | [diff] [blame] | 33 | public String[] underlyingIfaces; |
Wenchao Tong | f5ea340 | 2015-03-04 13:26:38 -0800 | [diff] [blame] | 34 | |
| 35 | @Override |
| 36 | public String toString() { |
Irina Dumitrescu | 18622d3 | 2018-12-05 16:19:47 +0000 | [diff] [blame] | 37 | return "VpnInfo{" |
| 38 | + "ownerUid=" + ownerUid |
| 39 | + ", vpnIface='" + vpnIface + '\'' |
Benedict Wong | edcd5ad | 2019-06-12 17:46:15 +0000 | [diff] [blame] | 40 | + ", underlyingIfaces='" + Arrays.toString(underlyingIfaces) + '\'' |
Irina Dumitrescu | 18622d3 | 2018-12-05 16:19:47 +0000 | [diff] [blame] | 41 | + '}'; |
Wenchao Tong | f5ea340 | 2015-03-04 13:26:38 -0800 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public int describeContents() { |
| 46 | return 0; |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public void writeToParcel(Parcel dest, int flags) { |
| 51 | dest.writeInt(ownerUid); |
| 52 | dest.writeString(vpnIface); |
Benedict Wong | edcd5ad | 2019-06-12 17:46:15 +0000 | [diff] [blame] | 53 | dest.writeStringArray(underlyingIfaces); |
Wenchao Tong | f5ea340 | 2015-03-04 13:26:38 -0800 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | public static final Parcelable.Creator<VpnInfo> CREATOR = new Parcelable.Creator<VpnInfo>() { |
| 57 | @Override |
| 58 | public VpnInfo createFromParcel(Parcel source) { |
| 59 | VpnInfo info = new VpnInfo(); |
| 60 | info.ownerUid = source.readInt(); |
| 61 | info.vpnIface = source.readString(); |
Benedict Wong | edcd5ad | 2019-06-12 17:46:15 +0000 | [diff] [blame] | 62 | info.underlyingIfaces = source.readStringArray(); |
Wenchao Tong | f5ea340 | 2015-03-04 13:26:38 -0800 | [diff] [blame] | 63 | return info; |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public VpnInfo[] newArray(int size) { |
| 68 | return new VpnInfo[size]; |
| 69 | } |
| 70 | }; |
| 71 | } |