Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5921,7 +5921,7 @@ package android.app.admin { method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrievePreRebootSecurityLogs(android.content.ComponentName); method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrieveSecurityLogs(android.content.ComponentName); method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean); method public boolean setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String); method public void setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException, java.lang.UnsupportedOperationException; 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) throws android.content.pm.PackageManager.NameNotFoundException; api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -6070,7 +6070,7 @@ package android.app.admin { method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrieveSecurityLogs(android.content.ComponentName); 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 void setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException, java.lang.UnsupportedOperationException; 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) throws android.content.pm.PackageManager.NameNotFoundException; api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5925,7 +5925,7 @@ package android.app.admin { method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrievePreRebootSecurityLogs(android.content.ComponentName); method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrieveSecurityLogs(android.content.ComponentName); method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean); method public boolean setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String); method public void setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException, java.lang.UnsupportedOperationException; 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) throws android.content.pm.PackageManager.NameNotFoundException; core/java/android/app/admin/DevicePolicyManager.java +8 −4 Original line number Diff line number Diff line Loading @@ -2977,17 +2977,21 @@ public class DevicePolicyManager { * @return {@code true} if the package is set as always-on VPN controller; {@code false} * otherwise. * @throws SecurityException if {@code admin} is not a device or a profile owner. * @throws NameNotFoundException if {@code vpnPackage} is not installed. * @throws UnsupportedOperationException if {@code vpnPackage} exists but does not support being * set as always-on, or if always-on VPN is not available. */ public boolean setAlwaysOnVpnPackage(@NonNull ComponentName admin, @Nullable String vpnPackage) { public void setAlwaysOnVpnPackage(@NonNull ComponentName admin, @Nullable String vpnPackage) throws NameNotFoundException, UnsupportedOperationException { if (mService != null) { try { return mService.setAlwaysOnVpnPackage(admin, vpnPackage); if (!mService.setAlwaysOnVpnPackage(admin, vpnPackage)) { throw new NameNotFoundException(vpnPackage); } } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return false; } /** Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −2 Original line number Diff line number Diff line Loading @@ -4357,6 +4357,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } /** * @return {@code true} if the package is installed and set as always-on, {@code false} if it is * not installed and therefore not available. * * @throws SecurityException if the caller is not a profile or device owner. * @throws UnsupportedException if the package does not support being set as always-on. */ @Override public boolean setAlwaysOnVpnPackage(ComponentName admin, String vpnPackage) throws SecurityException { Loading @@ -4367,12 +4374,18 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { final int userId = mInjector.userHandleGetCallingUserId(); final long token = mInjector.binderClearCallingIdentity(); try { if (vpnPackage != null && !isPackageInstalledForUser(vpnPackage, userId)) { return false; } ConnectivityManager connectivityManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); return connectivityManager.setAlwaysOnVpnPackageForUser(userId, vpnPackage); if (!connectivityManager.setAlwaysOnVpnPackageForUser(userId, vpnPackage)) { throw new UnsupportedOperationException(); } } finally { mInjector.binderRestoreCallingIdentity(token); } return true; } @Override Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5921,7 +5921,7 @@ package android.app.admin { method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrievePreRebootSecurityLogs(android.content.ComponentName); method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrieveSecurityLogs(android.content.ComponentName); method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean); method public boolean setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String); method public void setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException, java.lang.UnsupportedOperationException; 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) throws android.content.pm.PackageManager.NameNotFoundException;
api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -6070,7 +6070,7 @@ package android.app.admin { method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrieveSecurityLogs(android.content.ComponentName); 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 void setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException, java.lang.UnsupportedOperationException; 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) throws android.content.pm.PackageManager.NameNotFoundException;
api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5925,7 +5925,7 @@ package android.app.admin { method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrievePreRebootSecurityLogs(android.content.ComponentName); method public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrieveSecurityLogs(android.content.ComponentName); method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean); method public boolean setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String); method public void setAlwaysOnVpnPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException, java.lang.UnsupportedOperationException; 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) throws android.content.pm.PackageManager.NameNotFoundException;
core/java/android/app/admin/DevicePolicyManager.java +8 −4 Original line number Diff line number Diff line Loading @@ -2977,17 +2977,21 @@ public class DevicePolicyManager { * @return {@code true} if the package is set as always-on VPN controller; {@code false} * otherwise. * @throws SecurityException if {@code admin} is not a device or a profile owner. * @throws NameNotFoundException if {@code vpnPackage} is not installed. * @throws UnsupportedOperationException if {@code vpnPackage} exists but does not support being * set as always-on, or if always-on VPN is not available. */ public boolean setAlwaysOnVpnPackage(@NonNull ComponentName admin, @Nullable String vpnPackage) { public void setAlwaysOnVpnPackage(@NonNull ComponentName admin, @Nullable String vpnPackage) throws NameNotFoundException, UnsupportedOperationException { if (mService != null) { try { return mService.setAlwaysOnVpnPackage(admin, vpnPackage); if (!mService.setAlwaysOnVpnPackage(admin, vpnPackage)) { throw new NameNotFoundException(vpnPackage); } } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return false; } /** Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −2 Original line number Diff line number Diff line Loading @@ -4357,6 +4357,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } /** * @return {@code true} if the package is installed and set as always-on, {@code false} if it is * not installed and therefore not available. * * @throws SecurityException if the caller is not a profile or device owner. * @throws UnsupportedException if the package does not support being set as always-on. */ @Override public boolean setAlwaysOnVpnPackage(ComponentName admin, String vpnPackage) throws SecurityException { Loading @@ -4367,12 +4374,18 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { final int userId = mInjector.userHandleGetCallingUserId(); final long token = mInjector.binderClearCallingIdentity(); try { if (vpnPackage != null && !isPackageInstalledForUser(vpnPackage, userId)) { return false; } ConnectivityManager connectivityManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); return connectivityManager.setAlwaysOnVpnPackageForUser(userId, vpnPackage); if (!connectivityManager.setAlwaysOnVpnPackageForUser(userId, vpnPackage)) { throw new UnsupportedOperationException(); } } finally { mInjector.binderRestoreCallingIdentity(token); } return true; } @Override Loading