diff --git a/core/api/current.txt b/core/api/current.txt index 03ce368fe70e2..8cb7787dc7fe0 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -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 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 diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 224cd84bc777a..5848d2f1af2cb 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -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). *