Loading api/current.txt +12 −0 Original line number Diff line number Diff line Loading @@ -4337,6 +4337,7 @@ package android.app.admin { method public boolean hasGrantedPolicy(android.content.ComponentName, int); method public boolean isActivePasswordSufficient(); method public boolean isAdminActive(android.content.ComponentName); method public boolean isDeviceOwner(java.lang.String); method public void lockNow(); method public void removeActiveAdmin(android.content.ComponentName); method public boolean resetPassword(java.lang.String, int); Loading Loading @@ -16788,9 +16789,20 @@ package android.os { method public int getUserCount(); method public android.os.UserHandle getUserForSerialNumber(long); method public java.lang.String getUserName(); method public android.os.Bundle getUserRestrictions(); method public android.os.Bundle getUserRestrictions(android.os.UserHandle); method public boolean isUserAGoat(); method public boolean isUserRestricted(); method public boolean isUserRunning(android.os.UserHandle); method public boolean isUserRunningOrStopping(android.os.UserHandle); method public void setUserRestriction(java.lang.String, boolean); method public void setUserRestrictions(android.os.Bundle); method public void setUserRestrictions(android.os.Bundle, android.os.UserHandle); field public static final java.lang.String DISALLOW_CONFIG_WIFI = "no_config_wifi"; field public static final java.lang.String DISALLOW_INSTALL_APPS = "no_install_apps"; field public static final java.lang.String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location"; field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps"; } public abstract class Vibrator { core/java/android/app/admin/DevicePolicyManager.java +53 −0 Original line number Diff line number Diff line Loading @@ -1513,4 +1513,57 @@ public class DevicePolicyManager { } } } /** * @hide * Sets the given package as the device owner. The package must already be installed and there * shouldn't be an existing device owner registered, for this call to succeed. Also, this * method must be called before the device is provisioned. * @param packageName the package name of the application to be registered as the device owner. * @return whether the package was successfully registered as the device owner. * @throws IllegalArgumentException if the package name is null or invalid * @throws IllegalStateException if a device owner is already registered or the device has * already been provisioned. */ public boolean setDeviceOwner(String packageName) throws IllegalArgumentException, IllegalStateException { if (mService != null) { try { return mService.setDeviceOwner(packageName); } catch (RemoteException re) { Log.w(TAG, "Failed to set device owner"); } } return false; } /** * Used to determine if a particular package has been registered as a Device Owner admin. * Device Owner admins cannot be deactivated by the user unless the Device Owner itself allows * it. And Device Owner packages cannot be uninstalled, once registered. * @param packageName the package name to check against the registered device owner. * @return whether or not the package is registered as the Device Owner. */ public boolean isDeviceOwner(String packageName) { if (mService != null) { try { return mService.isDeviceOwner(packageName); } catch (RemoteException re) { Log.w(TAG, "Failed to check device owner"); } } return false; } /** @hide */ public String getDeviceOwner() { if (mService != null) { try { return mService.getDeviceOwner(); } catch (RemoteException re) { Log.w(TAG, "Failed to get device owner"); } } return null; } } core/java/android/app/admin/IDevicePolicyManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -97,4 +97,8 @@ interface IDevicePolicyManager { int numbers, int symbols, int nonletter, int userHandle); void reportFailedPasswordAttempt(int userHandle); void reportSuccessfulPasswordAttempt(int userHandle); boolean setDeviceOwner(String packageName); boolean isDeviceOwner(String packageName); String getDeviceOwner(); } core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ interface IUserManager { Bitmap getUserIcon(int userHandle); List<UserInfo> getUsers(boolean excludeDying); UserInfo getUserInfo(int userHandle); boolean isRestricted(); void setGuestEnabled(boolean enable); boolean isGuestEnabled(); void wipeUser(int userHandle); Loading core/java/android/os/UserManager.java +70 −23 Original line number Diff line number Diff line Loading @@ -37,48 +37,56 @@ public class UserManager { private final Context mContext; /** * @hide * Key for user restrictions. Specifies if a user is allowed to add or remove accounts. * Key for user restrictions. Specifies if a user is disallowed from adding and removing * accounts. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_MODIFY_ACCOUNTS = "modify_accounts"; public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; /** * @hide * Key for user restrictions. Specifies if a user is allowed to change Wi-Fi access points. * Key for user restrictions. Specifies if a user is disallowed from changing Wi-Fi * access points. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_CONFIG_WIFI = "config_wifi"; public static final String DISALLOW_CONFIG_WIFI = "no_config_wifi"; /** * @hide * Key for user restrictions. Specifies if a user is allowed to install applications. * Key for user restrictions. Specifies if a user is disallowed from installing applications. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_INSTALL_APPS = "install_apps"; public static final String DISALLOW_INSTALL_APPS = "no_install_apps"; /** * @hide * Key for user restrictions. Specifies if a user is allowed to uninstall applications. * Key for user restrictions. Specifies if a user is disallowed from uninstalling applications. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_UNINSTALL_APPS = "uninstall_apps"; public static final String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps"; /** @hide * * Key for user restrictions. Specifies if a user is allowed to toggle location sharing. /** * Key for user restrictions. Specifies if a user is disallowed from toggling location sharing. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_CONFIG_LOCATION_ACCESS = "config_location_access"; public static final String DISALLOW_SHARE_LOCATION = "no_share_location"; /** @hide */ public UserManager(Context context, IUserManager service) { Loading Loading @@ -129,11 +137,14 @@ public class UserManager { } /** * @hide * Used to check if the user making this call is a restricted user. Restricted users may have * application restrictions imposed on them. All apps should default to the most restrictive * version, unless they have specific restrictions available through a call to * {@link Context#getApplicationRestrictions()}. */ public boolean isUserRestricted() { try { return mService.getUserInfo(getUserHandle()).isRestricted(); return mService.isRestricted(); } catch (RemoteException re) { Log.w(TAG, "Could not check if user restricted ", re); return false; Loading Loading @@ -189,12 +200,19 @@ public class UserManager { } } /** @hide */ /** * Returns the user-wide restrictions imposed on this user. * @return a Bundle containing all the restrictions. */ public Bundle getUserRestrictions() { return getUserRestrictions(Process.myUserHandle()); } /** @hide */ /** * Returns the user-wide restrictions imposed on the user specified by <code>userHandle</code>. * @param userHandle the UserHandle of the user for whom to retrieve the restrictions. * @return a Bundle containing all the restrictions. */ public Bundle getUserRestrictions(UserHandle userHandle) { try { return mService.getUserRestrictions(userHandle.getIdentifier()); Loading @@ -204,12 +222,21 @@ public class UserManager { } } /** @hide */ /** * Sets all the user-wide restrictions for this user. * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission. * @param restrictions the Bundle containing all the restrictions. */ public void setUserRestrictions(Bundle restrictions) { setUserRestrictions(restrictions, Process.myUserHandle()); } /** @hide */ /** * Sets all the user-wide restrictions for the specified user. * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission. * @param restrictions the Bundle containing all the restrictions. * @param userHandle the UserHandle of the user for whom to set the restrictions. */ public void setUserRestrictions(Bundle restrictions, UserHandle userHandle) { try { mService.setUserRestrictions(restrictions, userHandle.getIdentifier()); Loading @@ -218,7 +245,27 @@ public class UserManager { } } /** @hide */ /** * Sets the value of a specific restriction. * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission. * @param key the key of the restriction * @param value the value for the restriction * @param userHandle the user whose restriction is to be changed. */ public void setUserRestriction(String key, boolean value) { Bundle bundle = getUserRestrictions(); bundle.putBoolean(key, value); setUserRestrictions(bundle); } /** * @hide * Sets the value of a specific restriction on a specific user. * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission. * @param key the key of the restriction * @param value the value for the restriction * @param userHandle the user whose restriction is to be changed. */ public void setUserRestriction(String key, boolean value, UserHandle userHandle) { Bundle bundle = getUserRestrictions(userHandle); bundle.putBoolean(key, value); Loading Loading @@ -467,7 +514,7 @@ public class UserManager { * @hide */ public boolean isLocationSharingToggleAllowed() { return getUserRestrictions().getBoolean(ALLOW_CONFIG_LOCATION_ACCESS); return !getUserRestrictions().getBoolean(DISALLOW_SHARE_LOCATION, false); } /** Loading Loading
api/current.txt +12 −0 Original line number Diff line number Diff line Loading @@ -4337,6 +4337,7 @@ package android.app.admin { method public boolean hasGrantedPolicy(android.content.ComponentName, int); method public boolean isActivePasswordSufficient(); method public boolean isAdminActive(android.content.ComponentName); method public boolean isDeviceOwner(java.lang.String); method public void lockNow(); method public void removeActiveAdmin(android.content.ComponentName); method public boolean resetPassword(java.lang.String, int); Loading Loading @@ -16788,9 +16789,20 @@ package android.os { method public int getUserCount(); method public android.os.UserHandle getUserForSerialNumber(long); method public java.lang.String getUserName(); method public android.os.Bundle getUserRestrictions(); method public android.os.Bundle getUserRestrictions(android.os.UserHandle); method public boolean isUserAGoat(); method public boolean isUserRestricted(); method public boolean isUserRunning(android.os.UserHandle); method public boolean isUserRunningOrStopping(android.os.UserHandle); method public void setUserRestriction(java.lang.String, boolean); method public void setUserRestrictions(android.os.Bundle); method public void setUserRestrictions(android.os.Bundle, android.os.UserHandle); field public static final java.lang.String DISALLOW_CONFIG_WIFI = "no_config_wifi"; field public static final java.lang.String DISALLOW_INSTALL_APPS = "no_install_apps"; field public static final java.lang.String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location"; field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps"; } public abstract class Vibrator {
core/java/android/app/admin/DevicePolicyManager.java +53 −0 Original line number Diff line number Diff line Loading @@ -1513,4 +1513,57 @@ public class DevicePolicyManager { } } } /** * @hide * Sets the given package as the device owner. The package must already be installed and there * shouldn't be an existing device owner registered, for this call to succeed. Also, this * method must be called before the device is provisioned. * @param packageName the package name of the application to be registered as the device owner. * @return whether the package was successfully registered as the device owner. * @throws IllegalArgumentException if the package name is null or invalid * @throws IllegalStateException if a device owner is already registered or the device has * already been provisioned. */ public boolean setDeviceOwner(String packageName) throws IllegalArgumentException, IllegalStateException { if (mService != null) { try { return mService.setDeviceOwner(packageName); } catch (RemoteException re) { Log.w(TAG, "Failed to set device owner"); } } return false; } /** * Used to determine if a particular package has been registered as a Device Owner admin. * Device Owner admins cannot be deactivated by the user unless the Device Owner itself allows * it. And Device Owner packages cannot be uninstalled, once registered. * @param packageName the package name to check against the registered device owner. * @return whether or not the package is registered as the Device Owner. */ public boolean isDeviceOwner(String packageName) { if (mService != null) { try { return mService.isDeviceOwner(packageName); } catch (RemoteException re) { Log.w(TAG, "Failed to check device owner"); } } return false; } /** @hide */ public String getDeviceOwner() { if (mService != null) { try { return mService.getDeviceOwner(); } catch (RemoteException re) { Log.w(TAG, "Failed to get device owner"); } } return null; } }
core/java/android/app/admin/IDevicePolicyManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -97,4 +97,8 @@ interface IDevicePolicyManager { int numbers, int symbols, int nonletter, int userHandle); void reportFailedPasswordAttempt(int userHandle); void reportSuccessfulPasswordAttempt(int userHandle); boolean setDeviceOwner(String packageName); boolean isDeviceOwner(String packageName); String getDeviceOwner(); }
core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ interface IUserManager { Bitmap getUserIcon(int userHandle); List<UserInfo> getUsers(boolean excludeDying); UserInfo getUserInfo(int userHandle); boolean isRestricted(); void setGuestEnabled(boolean enable); boolean isGuestEnabled(); void wipeUser(int userHandle); Loading
core/java/android/os/UserManager.java +70 −23 Original line number Diff line number Diff line Loading @@ -37,48 +37,56 @@ public class UserManager { private final Context mContext; /** * @hide * Key for user restrictions. Specifies if a user is allowed to add or remove accounts. * Key for user restrictions. Specifies if a user is disallowed from adding and removing * accounts. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_MODIFY_ACCOUNTS = "modify_accounts"; public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; /** * @hide * Key for user restrictions. Specifies if a user is allowed to change Wi-Fi access points. * Key for user restrictions. Specifies if a user is disallowed from changing Wi-Fi * access points. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_CONFIG_WIFI = "config_wifi"; public static final String DISALLOW_CONFIG_WIFI = "no_config_wifi"; /** * @hide * Key for user restrictions. Specifies if a user is allowed to install applications. * Key for user restrictions. Specifies if a user is disallowed from installing applications. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_INSTALL_APPS = "install_apps"; public static final String DISALLOW_INSTALL_APPS = "no_install_apps"; /** * @hide * Key for user restrictions. Specifies if a user is allowed to uninstall applications. * Key for user restrictions. Specifies if a user is disallowed from uninstalling applications. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_UNINSTALL_APPS = "uninstall_apps"; public static final String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps"; /** @hide * * Key for user restrictions. Specifies if a user is allowed to toggle location sharing. /** * Key for user restrictions. Specifies if a user is disallowed from toggling location sharing. * The default value is <code>false</code>. * <p/> * Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ public static final String ALLOW_CONFIG_LOCATION_ACCESS = "config_location_access"; public static final String DISALLOW_SHARE_LOCATION = "no_share_location"; /** @hide */ public UserManager(Context context, IUserManager service) { Loading Loading @@ -129,11 +137,14 @@ public class UserManager { } /** * @hide * Used to check if the user making this call is a restricted user. Restricted users may have * application restrictions imposed on them. All apps should default to the most restrictive * version, unless they have specific restrictions available through a call to * {@link Context#getApplicationRestrictions()}. */ public boolean isUserRestricted() { try { return mService.getUserInfo(getUserHandle()).isRestricted(); return mService.isRestricted(); } catch (RemoteException re) { Log.w(TAG, "Could not check if user restricted ", re); return false; Loading Loading @@ -189,12 +200,19 @@ public class UserManager { } } /** @hide */ /** * Returns the user-wide restrictions imposed on this user. * @return a Bundle containing all the restrictions. */ public Bundle getUserRestrictions() { return getUserRestrictions(Process.myUserHandle()); } /** @hide */ /** * Returns the user-wide restrictions imposed on the user specified by <code>userHandle</code>. * @param userHandle the UserHandle of the user for whom to retrieve the restrictions. * @return a Bundle containing all the restrictions. */ public Bundle getUserRestrictions(UserHandle userHandle) { try { return mService.getUserRestrictions(userHandle.getIdentifier()); Loading @@ -204,12 +222,21 @@ public class UserManager { } } /** @hide */ /** * Sets all the user-wide restrictions for this user. * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission. * @param restrictions the Bundle containing all the restrictions. */ public void setUserRestrictions(Bundle restrictions) { setUserRestrictions(restrictions, Process.myUserHandle()); } /** @hide */ /** * Sets all the user-wide restrictions for the specified user. * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission. * @param restrictions the Bundle containing all the restrictions. * @param userHandle the UserHandle of the user for whom to set the restrictions. */ public void setUserRestrictions(Bundle restrictions, UserHandle userHandle) { try { mService.setUserRestrictions(restrictions, userHandle.getIdentifier()); Loading @@ -218,7 +245,27 @@ public class UserManager { } } /** @hide */ /** * Sets the value of a specific restriction. * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission. * @param key the key of the restriction * @param value the value for the restriction * @param userHandle the user whose restriction is to be changed. */ public void setUserRestriction(String key, boolean value) { Bundle bundle = getUserRestrictions(); bundle.putBoolean(key, value); setUserRestrictions(bundle); } /** * @hide * Sets the value of a specific restriction on a specific user. * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission. * @param key the key of the restriction * @param value the value for the restriction * @param userHandle the user whose restriction is to be changed. */ public void setUserRestriction(String key, boolean value, UserHandle userHandle) { Bundle bundle = getUserRestrictions(userHandle); bundle.putBoolean(key, value); Loading Loading @@ -467,7 +514,7 @@ public class UserManager { * @hide */ public boolean isLocationSharingToggleAllowed() { return getUserRestrictions().getBoolean(ALLOW_CONFIG_LOCATION_ACCESS); return !getUserRestrictions().getBoolean(DISALLOW_SHARE_LOCATION, false); } /** Loading