Merge "Add user privacy sensitivity APIs." into sc-dev

This commit is contained in:
Hai Zhang
2021-05-19 23:00:17 +00:00
committed by Android (Google) Code Review
2 changed files with 36 additions and 0 deletions

View File

@@ -31958,6 +31958,7 @@ package android.os {
method public long getUserCreationTime(android.os.UserHandle);
method public android.os.UserHandle getUserForSerialNumber(long);
method @NonNull @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", android.Manifest.permission.GET_ACCOUNTS_PRIVILEGED, "android.permission.CREATE_USERS"}, conditional=true) public String getUserName();
method public int getUserPrivacySensitivity();
method public java.util.List<android.os.UserHandle> getUserProfiles();
method public android.os.Bundle getUserRestrictions();
method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public android.os.Bundle getUserRestrictions(android.os.UserHandle);
@@ -32038,6 +32039,8 @@ package android.os {
field public static final String DISALLOW_USER_SWITCH = "no_user_switch";
field public static final String ENSURE_VERIFY_APPS = "ensure_verify_apps";
field public static final String KEY_RESTRICTIONS_PENDING = "restrictions_pending";
field public static final int PRIVACY_SENSITIVITY_DEFAULT = 0; // 0x0
field public static final int PRIVACY_SENSITIVITY_LOCATION = 1; // 0x1
field public static final int QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED = 1; // 0x1
field public static final int USER_CREATION_FAILED_NOT_PERMITTED = 1; // 0x1
field public static final int USER_CREATION_FAILED_NO_MORE_USERS = 2; // 0x2

View File

@@ -188,6 +188,28 @@ public class UserManager {
QUIET_MODE_DISABLE_DONT_ASK_CREDENTIAL})
public @interface QuietModeFlag {}
/**
* Flag returned by {@link #getUserPrivacySensitivity} to indicate that the user isn't
* particularly sensitive about a certain aspect of privacy.
*/
public static final int PRIVACY_SENSITIVITY_DEFAULT = 0x0;
/**
* Flag returned by {@link #getUserPrivacySensitivity} to indicate that the user is sensitive
* about location privacy.
*/
public static final int PRIVACY_SENSITIVITY_LOCATION = 0x1;
/**
* List of flags available for the {@link #getUserPrivacySensitivity} method.
* @hide
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag = true, prefix = { "PRIVACY_SENSITIVITY_" }, value = {
PRIVACY_SENSITIVITY_DEFAULT,
PRIVACY_SENSITIVITY_LOCATION})
public @interface PrivacySensitivityFlag {}
/**
* @hide
* No user restriction.
@@ -3937,6 +3959,17 @@ public class UserManager {
}
}
/**
* Get the privacy sensitivity of the user.
*
* @return the privacy sensitivity of the user
*/
@PrivacySensitivityFlag
public int getUserPrivacySensitivity() {
// TODO: Add actual implementation.
return PRIVACY_SENSITIVITY_DEFAULT;
}
/**
* Returns whether the given user has a badge (generally to put on profiles' icons).
*