Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 116ee10b authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Always-on VPN." into jb-mr1-dev

parents e45ca31a 69ddab45
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -17,10 +17,9 @@
package android.app;
package android.app;


import android.content.Context;
import android.content.Context;
import android.os.Binder;
import android.os.RemoteException;
import android.os.Handler;
import android.os.Handler;
import android.os.IBinder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.util.Log;
import android.util.Log;


@@ -88,6 +87,11 @@ public class NotificationManager
        mContext = context;
        mContext = context;
    }
    }


    /** {@hide} */
    public static NotificationManager from(Context context) {
        return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    }

    /**
    /**
     * Post a notification to be shown in the status bar. If a notification with
     * Post a notification to be shown in the status bar. If a notification with
     * the same id has already been posted by your application and has not yet been canceled, it
     * the same id has already been posted by your application and has not yet been canceled, it
+9 −0
Original line number Original line Diff line number Diff line
@@ -912,4 +912,13 @@ public class ConnectivityManager {
            return false;
            return false;
        }
        }
    }
    }

    /** {@hide} */
    public boolean updateLockdownVpn() {
        try {
            return mService.updateLockdownVpn();
        } catch (RemoteException e) {
            return false;
        }
    }
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -122,4 +122,6 @@ interface IConnectivityManager
    void startLegacyVpn(in VpnProfile profile);
    void startLegacyVpn(in VpnProfile profile);


    LegacyVpnInfo getLegacyVpnInfo();
    LegacyVpnInfo getLegacyVpnInfo();

    boolean updateLockdownVpn();
}
}
+31 −0
Original line number Original line Diff line number Diff line
@@ -18,7 +18,10 @@ package com.android.internal.net;


import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;


import java.net.InetAddress;
import java.nio.charset.Charsets;
import java.nio.charset.Charsets;


/**
/**
@@ -31,6 +34,8 @@ import java.nio.charset.Charsets;
 * @hide
 * @hide
 */
 */
public class VpnProfile implements Cloneable, Parcelable {
public class VpnProfile implements Cloneable, Parcelable {
    private static final String TAG = "VpnProfile";

    // Match these constants with R.array.vpn_types.
    // Match these constants with R.array.vpn_types.
    public static final int TYPE_PPTP = 0;
    public static final int TYPE_PPTP = 0;
    public static final int TYPE_L2TP_IPSEC_PSK = 1;
    public static final int TYPE_L2TP_IPSEC_PSK = 1;
@@ -124,6 +129,32 @@ public class VpnProfile implements Cloneable, Parcelable {
        return builder.toString().getBytes(Charsets.UTF_8);
        return builder.toString().getBytes(Charsets.UTF_8);
    }
    }


    /**
     * Test if profile is valid for lockdown, which requires IPv4 address for
     * both server and DNS. Server hostnames would require using DNS before
     * connection.
     */
    public boolean isValidLockdownProfile() {
        try {
            InetAddress.parseNumericAddress(server);

            for (String dnsServer : dnsServers.split(" +")) {
                InetAddress.parseNumericAddress(this.dnsServers);
            }
            if (TextUtils.isEmpty(dnsServers)) {
                Log.w(TAG, "DNS required");
                return false;
            }

            // Everything checked out above
            return true;

        } catch (IllegalArgumentException e) {
            Log.w(TAG, "Invalid address", e);
            return false;
        }
    }

    @Override
    @Override
    public void writeToParcel(Parcel out, int flags) {
    public void writeToParcel(Parcel out, int flags) {
        out.writeString(key);
        out.writeString(key);
+5 −0
Original line number Original line Diff line number Diff line
@@ -1442,6 +1442,7 @@
  <java-symbol type="drawable" name="stat_sys_tether_usb" />
  <java-symbol type="drawable" name="stat_sys_tether_usb" />
  <java-symbol type="drawable" name="stat_sys_throttled" />
  <java-symbol type="drawable" name="stat_sys_throttled" />
  <java-symbol type="drawable" name="vpn_connected" />
  <java-symbol type="drawable" name="vpn_connected" />
  <java-symbol type="drawable" name="vpn_disconnected" />
  <java-symbol type="id" name="ask_checkbox" />
  <java-symbol type="id" name="ask_checkbox" />
  <java-symbol type="id" name="compat_checkbox" />
  <java-symbol type="id" name="compat_checkbox" />
  <java-symbol type="id" name="original_app_icon" />
  <java-symbol type="id" name="original_app_icon" />
@@ -1557,6 +1558,10 @@
  <java-symbol type="string" name="vpn_text_long" />
  <java-symbol type="string" name="vpn_text_long" />
  <java-symbol type="string" name="vpn_title" />
  <java-symbol type="string" name="vpn_title" />
  <java-symbol type="string" name="vpn_title_long" />
  <java-symbol type="string" name="vpn_title_long" />
  <java-symbol type="string" name="vpn_lockdown_connecting" />
  <java-symbol type="string" name="vpn_lockdown_connected" />
  <java-symbol type="string" name="vpn_lockdown_error" />
  <java-symbol type="string" name="vpn_lockdown_reset" />
  <java-symbol type="string" name="wallpaper_binding_label" />
  <java-symbol type="string" name="wallpaper_binding_label" />
  <java-symbol type="style" name="Theme.Dialog.AppError" />
  <java-symbol type="style" name="Theme.Dialog.AppError" />
  <java-symbol type="style" name="Theme.Toast" />
  <java-symbol type="style" name="Theme.Toast" />
Loading