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

Commit ede31cad authored by Benedict Wong's avatar Benedict Wong Committed by Gerrit Code Review
Browse files

Merge "Add separate user consent for Platform VPNs"

parents a656dd88 526e7dd0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ interface IConnectivityManager

    boolean prepareVpn(String oldPackage, String newPackage, int userId);

    void setVpnPackageAuthorization(String packageName, int userId, boolean authorized);
    void setVpnPackageAuthorization(String packageName, int userId, int vpnType);

    ParcelFileDescriptor establishVpn(in VpnConfig config);

+16 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.net;

import static com.android.internal.util.Preconditions.checkNotNull;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.Activity;
@@ -30,6 +31,8 @@ import android.os.RemoteException;
import com.android.internal.net.VpnProfile;

import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.GeneralSecurityException;

/**
@@ -47,6 +50,18 @@ import java.security.GeneralSecurityException;
 * @see Ikev2VpnProfile
 */
public class VpnManager {
    /** Type representing a lack of VPN @hide */
    public static final int TYPE_VPN_NONE = -1;
    /** VPN service type code @hide */
    public static final int TYPE_VPN_SERVICE = 1;
    /** Platform VPN type code @hide */
    public static final int TYPE_VPN_PLATFORM = 2;

    /** @hide */
    @IntDef(value = {TYPE_VPN_NONE, TYPE_VPN_SERVICE, TYPE_VPN_PLATFORM})
    @Retention(RetentionPolicy.SOURCE)
    public @interface VpnType {}

    @NonNull private final Context mContext;
    @NonNull private final IConnectivityManager mService;

@@ -54,7 +69,7 @@ public class VpnManager {
        final Intent intent = new Intent();
        final ComponentName componentName = ComponentName.unflattenFromString(
                Resources.getSystem().getString(
                        com.android.internal.R.string.config_customVpnConfirmDialogComponent));
                        com.android.internal.R.string.config_platformVpnConfirmDialogComponent));
        intent.setComponent(componentName);
        return intent;
    }
+1 −1
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@ public class VpnService extends Service {
            if (!cm.prepareVpn(packageName, null, userId)) {
                cm.prepareVpn(null, packageName, userId);
            }
            cm.setVpnPackageAuthorization(packageName, userId, true);
            cm.setVpnPackageAuthorization(packageName, userId, VpnManager.TYPE_VPN_SERVICE);
        } catch (RemoteException e) {
            // ignore
        }
+5 −1
Original line number Diff line number Diff line
@@ -2708,7 +2708,11 @@
    <string name="config_customAdbPublicKeyConfirmationSecondaryUserComponent"
            >com.android.systemui/com.android.systemui.usb.UsbDebuggingSecondaryUserActivity</string>

    <!-- Name of the dialog that is used to request the user's consent to VPN connection -->
    <!-- Name of the dialog that is used to request the user's consent for a Platform VPN -->
    <string name="config_platformVpnConfirmDialogComponent" translatable="false"
            >com.android.vpndialogs/com.android.vpndialogs.PlatformVpnConfirmDialog</string>

    <!-- Name of the dialog that is used to request the user's consent for a VpnService VPN -->
    <string name="config_customVpnConfirmDialogComponent" translatable="false"
            >com.android.vpndialogs/com.android.vpndialogs.ConfirmDialog</string>

+1 −0
Original line number Diff line number Diff line
@@ -2233,6 +2233,7 @@
  <java-symbol type="string" name="config_customAdbPublicKeyConfirmationSecondaryUserComponent" />
  <java-symbol type="string" name="config_customVpnConfirmDialogComponent" />
  <java-symbol type="string" name="config_customVpnAlwaysOnDisconnectedDialogComponent" />
  <java-symbol type="string" name="config_platformVpnConfirmDialogComponent" />
  <java-symbol type="string" name="config_carrierAppInstallDialogComponent" />
  <java-symbol type="string" name="config_defaultNetworkScorerPackageName" />
  <java-symbol type="string" name="config_persistentDataPackageName" />
Loading