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 
22 /**
23  * A lightweight container used to carry information of the ongoing VPN.
24  * Internal use only..
25  *
26  * @hide
27  */
28 public class VpnInfo implements Parcelable {
29     public int ownerUid;
30     public String vpnIface;
31     public String primaryUnderlyingIface;
32 
33     @Override
toString()34     public String toString() {
35         return "VpnInfo{"
36                 + "ownerUid=" + ownerUid
37                 + ", vpnIface='" + vpnIface + '\''
38                 + ", primaryUnderlyingIface='" + primaryUnderlyingIface + '\''
39                 + '}';
40     }
41 
42     @Override
describeContents()43     public int describeContents() {
44         return 0;
45     }
46 
47     @Override
writeToParcel(Parcel dest, int flags)48     public void writeToParcel(Parcel dest, int flags) {
49         dest.writeInt(ownerUid);
50         dest.writeString(vpnIface);
51         dest.writeString(primaryUnderlyingIface);
52     }
53 
54     public static final Parcelable.Creator<VpnInfo> CREATOR = new Parcelable.Creator<VpnInfo>() {
55         @Override
56         public VpnInfo createFromParcel(Parcel source) {
57             VpnInfo info = new VpnInfo();
58             info.ownerUid = source.readInt();
59             info.vpnIface = source.readString();
60             info.primaryUnderlyingIface = source.readString();
61             return info;
62         }
63 
64         @Override
65         public VpnInfo[] newArray(int size) {
66             return new VpnInfo[size];
67         }
68     };
69 }
70