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 import java.util.Arrays; 23 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; 33 public String[] underlyingIfaces; 34 35 @Override toString()36 public String toString() { 37 return "VpnInfo{" 38 + "ownerUid=" + ownerUid 39 + ", vpnIface='" + vpnIface + '\'' 40 + ", underlyingIfaces='" + Arrays.toString(underlyingIfaces) + '\'' 41 + '}'; 42 } 43 44 @Override describeContents()45 public int describeContents() { 46 return 0; 47 } 48 49 @Override writeToParcel(Parcel dest, int flags)50 public void writeToParcel(Parcel dest, int flags) { 51 dest.writeInt(ownerUid); 52 dest.writeString(vpnIface); 53 dest.writeStringArray(underlyingIfaces); 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(); 62 info.underlyingIfaces = source.readStringArray(); 63 return info; 64 } 65 66 @Override 67 public VpnInfo[] newArray(int size) { 68 return new VpnInfo[size]; 69 } 70 }; 71 } 72