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

Commit b68d2d5b authored by Robin Lee's avatar Robin Lee Committed by Android (Google) Code Review
Browse files

Merge "Always-on app VPNs"

parents 051782fd 244ce8ef
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5781,6 +5781,7 @@ package android.app.admin {
    method public int enableSystemApp(android.content.ComponentName, android.content.Intent);
    method public java.lang.String[] getAccountTypesWithManagementDisabled();
    method public java.util.List<android.content.ComponentName> getActiveAdmins();
    method public java.lang.String getAlwaysOnVpnPackage(android.content.ComponentName);
    method public android.os.Bundle getApplicationRestrictions(android.content.ComponentName, java.lang.String);
    method public java.lang.String getApplicationRestrictionsManagingPackage(android.content.ComponentName);
    method public boolean getAutoTimeRequired();
@@ -5845,6 +5846,7 @@ package android.app.admin {
    method public boolean removeUser(android.content.ComponentName, android.os.UserHandle);
    method public boolean resetPassword(java.lang.String, int);
    method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean);
    method public boolean setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String);
    method public boolean setApplicationHidden(android.content.ComponentName, java.lang.String, boolean);
    method public void setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle);
    method public void setApplicationRestrictionsManagingPackage(android.content.ComponentName, java.lang.String);
+2 −0
Original line number Diff line number Diff line
@@ -5915,6 +5915,7 @@ package android.app.admin {
    method public int enableSystemApp(android.content.ComponentName, android.content.Intent);
    method public java.lang.String[] getAccountTypesWithManagementDisabled();
    method public java.util.List<android.content.ComponentName> getActiveAdmins();
    method public java.lang.String getAlwaysOnVpnPackage(android.content.ComponentName);
    method public android.os.Bundle getApplicationRestrictions(android.content.ComponentName, java.lang.String);
    method public java.lang.String getApplicationRestrictionsManagingPackage(android.content.ComponentName);
    method public boolean getAutoTimeRequired();
@@ -5988,6 +5989,7 @@ package android.app.admin {
    method public boolean resetPassword(java.lang.String, int);
    method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean);
    method public deprecated boolean setActiveProfileOwner(android.content.ComponentName, java.lang.String) throws java.lang.IllegalArgumentException;
    method public boolean setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String);
    method public boolean setApplicationHidden(android.content.ComponentName, java.lang.String, boolean);
    method public void setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle);
    method public void setApplicationRestrictionsManagingPackage(android.content.ComponentName, java.lang.String);
+2 −0
Original line number Diff line number Diff line
@@ -5783,6 +5783,7 @@ package android.app.admin {
    method public int enableSystemApp(android.content.ComponentName, android.content.Intent);
    method public java.lang.String[] getAccountTypesWithManagementDisabled();
    method public java.util.List<android.content.ComponentName> getActiveAdmins();
    method public java.lang.String getAlwaysOnVpnPackage(android.content.ComponentName);
    method public android.os.Bundle getApplicationRestrictions(android.content.ComponentName, java.lang.String);
    method public java.lang.String getApplicationRestrictionsManagingPackage(android.content.ComponentName);
    method public boolean getAutoTimeRequired();
@@ -5847,6 +5848,7 @@ package android.app.admin {
    method public boolean removeUser(android.content.ComponentName, android.os.UserHandle);
    method public boolean resetPassword(java.lang.String, int);
    method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean);
    method public boolean setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String);
    method public boolean setApplicationHidden(android.content.ComponentName, java.lang.String, boolean);
    method public void setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle);
    method public void setApplicationRestrictionsManagingPackage(android.content.ComponentName, java.lang.String);
+47 −0
Original line number Diff line number Diff line
@@ -2450,6 +2450,53 @@ public class DevicePolicyManager {
        return null;
    }

    /**
     * Called by a device or profile owner to configure an always-on VPN connection through a
     * specific application for the current user.
     * This connection is automatically granted and persisted after a reboot.
     *
     * <p>The designated package should declare a {@link android.net.VpnService} in its
     *    manifest guarded by {@link android.Manifest.permission#BIND_VPN_SERVICE},
     *    otherwise the call will fail.
     *
     * @param vpnPackage The package name for an installed VPN app on the device, or {@code null}
     *                   to remove an existing always-on VPN configuration.
     *
     * @return {@code true} if the package is set as always-on VPN controller;
     *         {@code false} otherwise.
     */
    public boolean setAlwaysOnVpnPackage(@NonNull ComponentName admin,
            @Nullable String vpnPackage) {
        if (mService != null) {
            try {
                return mService.setAlwaysOnVpnPackage(admin, vpnPackage);
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
        }
        return false;
    }

    /**
     * Called by a device or profile owner to read the name of the package administering an
     * always-on VPN connection for the current user.
     * If there is no such package, or the always-on VPN is provided by the system instead
     * of by an application, {@code null} will be returned.
     *
     * @return Package name of VPN controller responsible for always-on VPN,
     *         or {@code null} if none is set.
     */
    public String getAlwaysOnVpnPackage(@NonNull ComponentName admin) {
        if (mService != null) {
            try {
                return mService.getAlwaysOnVpnPackage(admin);
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
        }
        return null;
    }

    /**
     * Called by an application that is administering the device to disable all cameras
     * on the device, for this user. After setting this, no applications running as this user
+3 −0
Original line number Diff line number Diff line
@@ -144,6 +144,9 @@ interface IDevicePolicyManager {
    void setCertInstallerPackage(in ComponentName who, String installerPackage);
    String getCertInstallerPackage(in ComponentName who);

    boolean setAlwaysOnVpnPackage(in ComponentName who, String vpnPackage);
    String getAlwaysOnVpnPackage(in ComponentName who);

    void addPersistentPreferredActivity(in ComponentName admin, in IntentFilter filter, in ComponentName activity);
    void clearPackagePersistentPreferredActivities(in ComponentName admin, String packageName);

Loading