1 /* 2 * Copyright (C) 2011 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.app.PendingIntent; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 /** 24 * A simple container used to carry information of the ongoing legacy VPN. 25 * Internal use only. 26 * 27 * @hide 28 */ 29 public class LegacyVpnInfo implements Parcelable { 30 public static final int STATE_DISCONNECTED = 0; 31 public static final int STATE_INITIALIZING = 1; 32 public static final int STATE_CONNECTING = 2; 33 public static final int STATE_CONNECTED = 3; 34 public static final int STATE_TIMEOUT = 4; 35 public static final int STATE_FAILED = 5; 36 37 public String key; 38 public int state = -1; 39 public PendingIntent intent; 40 41 @Override describeContents()42 public int describeContents() { 43 return 0; 44 } 45 46 @Override writeToParcel(Parcel out, int flags)47 public void writeToParcel(Parcel out, int flags) { 48 out.writeString(key); 49 out.writeInt(state); 50 out.writeParcelable(intent, flags); 51 } 52 53 public static final Parcelable.Creator<LegacyVpnInfo> CREATOR = 54 new Parcelable.Creator<LegacyVpnInfo>() { 55 @Override 56 public LegacyVpnInfo createFromParcel(Parcel in) { 57 LegacyVpnInfo info = new LegacyVpnInfo(); 58 info.key = in.readString(); 59 info.state = in.readInt(); 60 info.intent = in.readParcelable(null); 61 return info; 62 } 63 64 @Override 65 public LegacyVpnInfo[] newArray(int size) { 66 return new LegacyVpnInfo[size]; 67 } 68 }; 69 } 70