Merge change 4147 into donut

* changes:
  On the way of refactoring out SingleServerProfile.java.
This commit is contained in:
Android (Google) Code Review
2009-06-14 23:41:33 -07:00
3 changed files with 27 additions and 23 deletions

View File

@@ -20,8 +20,8 @@ import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.net.vpn.SingleServerProfile;
import android.net.vpn.VpnManager;
import android.net.vpn.VpnProfile;
import android.net.vpn.VpnState;
import android.os.FileObserver;
import android.os.SystemProperties;
@@ -38,7 +38,7 @@ import java.util.List;
/**
* The service base class for managing a type of VPN connection.
*/
abstract class VpnService<E extends SingleServerProfile> {
abstract class VpnService<E extends VpnProfile> {
private static final int NOTIFICATION_ID = 1;
private static final String PROFILES_ROOT = VpnManager.PROFILES_PATH + "/";
public static final String DEFAULT_CONFIG_PATH = "/etc";

View File

@@ -23,25 +23,4 @@ import android.os.Parcel;
* {@hide}
*/
public abstract class SingleServerProfile extends VpnProfile {
private String mServerName;
public void setServerName(String name) {
mServerName = name;
}
public String getServerName() {
return mServerName;
}
@Override
protected void readFromParcel(Parcel in) {
super.readFromParcel(in);
mServerName = in.readString();
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
super.writeToParcel(parcel, flags);
parcel.writeString(mServerName);
}
}

View File

@@ -31,8 +31,10 @@ public abstract class VpnProfile implements Parcelable, Serializable {
private static final long serialVersionUID = 1L;
private String mName; // unique display name
private String mId; // unique identifier
private String mServerName; // VPN server name
private String mDomainSuffices; // space separated list
private String mRouteList; // space separated list
private String mSavedUsername;
private boolean mIsCustomized;
private transient VpnState mState = VpnState.IDLE;
@@ -57,6 +59,17 @@ public abstract class VpnProfile implements Parcelable, Serializable {
return mId;
}
/**
* Sets the name of the VPN server. Used for DNS lookup.
*/
public void setServerName(String name) {
mServerName = name;
}
public String getServerName() {
return mServerName;
}
/**
* Sets the domain suffices for DNS resolution.
*
@@ -84,6 +97,14 @@ public abstract class VpnProfile implements Parcelable, Serializable {
return mRouteList;
}
public void setSavedUsername(String name) {
mSavedUsername = name;
}
public String getSavedUsername() {
return mSavedUsername;
}
public void setState(VpnState state) {
mState = state;
}
@@ -116,8 +137,10 @@ public abstract class VpnProfile implements Parcelable, Serializable {
protected void readFromParcel(Parcel in) {
mName = in.readString();
mId = in.readString();
mServerName = in.readString();
mDomainSuffices = in.readString();
mRouteList = in.readString();
mSavedUsername = in.readString();
}
public static final Parcelable.Creator<VpnProfile> CREATOR =
@@ -142,8 +165,10 @@ public abstract class VpnProfile implements Parcelable, Serializable {
parcel.writeInt(mIsCustomized ? 1 : 0);
parcel.writeString(mName);
parcel.writeString(mId);
parcel.writeString(mServerName);
parcel.writeString(mDomainSuffices);
parcel.writeString(mRouteList);
parcel.writeString(mSavedUsername);
}
public int describeContents() {