FileDocCategorySizeDatePackage
VpnConfig.javaAPI DocAndroid 5.1 API7469Thu Mar 12 22:22:10 GMT 2015com.android.internal.net

VpnConfig

public class VpnConfig extends Object implements android.os.Parcelable
A simple container used to carry information in VpnBuilder, VpnDialogs, and com.android.server.connectivity.Vpn. Internal use only.
hide

Fields Summary
public static final String
SERVICE_INTERFACE
public static final String
DIALOGS_PACKAGE
public static final String
LEGACY_VPN
public String
user
public String
interfaze
public String
session
public int
mtu
public List
addresses
public List
routes
public List
dnsServers
public List
searchDomains
public List
allowedApplications
public List
disallowedApplications
public android.app.PendingIntent
configureIntent
public long
startTime
public boolean
legacy
public boolean
blocking
public boolean
allowBypass
public boolean
allowIPv4
public boolean
allowIPv6
public android.net.Network[]
underlyingNetworks
public static final Parcelable.Creator
CREATOR
Constructors Summary
Methods Summary
public voidaddLegacyAddresses(java.lang.String addressesStr)

        if (addressesStr.trim().equals("")) {
            return;
        }
        String[] addresses = addressesStr.trim().split(" ");
        for (String address : addresses) {
            //each address is ip/prefix
            LinkAddress addr = new LinkAddress(address);
            this.addresses.add(addr);
            updateAllowedFamilies(addr.getAddress());
        }
    
public voidaddLegacyRoutes(java.lang.String routesStr)

        if (routesStr.trim().equals("")) {
            return;
        }
        String[] routes = routesStr.trim().split(" ");
        for (String route : routes) {
            //each route is ip/prefix
            RouteInfo info = new RouteInfo(new IpPrefix(route), null);
            this.routes.add(info);
            updateAllowedFamilies(info.getDestination().getAddress());
        }
    
public intdescribeContents()

        return 0;
    
public static android.content.IntentgetIntentForConfirmation()


        
        Intent intent = new Intent();
        ComponentName componentName = ComponentName.unflattenFromString(
                Resources.getSystem().getString(
                        com.android.internal.R.string.config_customVpnConfirmDialogComponent));
        intent.setClassName(componentName.getPackageName(), componentName.getClassName());
        return intent;
    
public static android.app.PendingIntentgetIntentForStatusPanel(android.content.Context context)
NOTE: This should only be used for legacy VPN.

        Intent intent = new Intent();
        intent.setClassName(DIALOGS_PACKAGE, DIALOGS_PACKAGE + ".ManageDialog");
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY |
                Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        return PendingIntent.getActivityAsUser(context, 0, intent, 0, null, UserHandle.CURRENT);
    
public static java.lang.CharSequencegetVpnLabel(android.content.Context context, java.lang.String packageName)

        PackageManager pm = context.getPackageManager();
        Intent intent = new Intent(SERVICE_INTERFACE);
        intent.setPackage(packageName);
        List<ResolveInfo> services = pm.queryIntentServices(intent, 0 /* flags */);
        if (services != null && services.size() == 1) {
            // This app contains exactly one VPN service. Call loadLabel, which will attempt to
            // load the service's label, and fall back to the app label if none is present.
            return services.get(0).loadLabel(pm);
        } else {
            return pm.getApplicationInfo(packageName, 0).loadLabel(pm);
        }
    
public voidupdateAllowedFamilies(java.net.InetAddress address)


        
        if (address instanceof Inet4Address) {
            allowIPv4 = true;
        } else {
            allowIPv6 = true;
        }
    
public voidwriteToParcel(android.os.Parcel out, int flags)

        out.writeString(user);
        out.writeString(interfaze);
        out.writeString(session);
        out.writeInt(mtu);
        out.writeTypedList(addresses);
        out.writeTypedList(routes);
        out.writeStringList(dnsServers);
        out.writeStringList(searchDomains);
        out.writeStringList(allowedApplications);
        out.writeStringList(disallowedApplications);
        out.writeParcelable(configureIntent, flags);
        out.writeLong(startTime);
        out.writeInt(legacy ? 1 : 0);
        out.writeInt(blocking ? 1 : 0);
        out.writeInt(allowBypass ? 1 : 0);
        out.writeInt(allowIPv4 ? 1 : 0);
        out.writeInt(allowIPv6 ? 1 : 0);
        out.writeTypedArray(underlyingNetworks, flags);