summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Xiaohui Chen <xiaohuic@google.com> 2015-10-12 15:56:25 -0700
committer Xiaohui Chen <xiaohuic@google.com> 2015-10-15 12:09:32 -0700
commit1fa7680c9cd2d6a8ae44ce9e90f2ba5dee47b219 (patch)
tree819472d485937077699ffe645f673fcb7e56bc2a
parent32ab05c846366c19d148562c9feb5366d1018f37 (diff)
Add UserHandle.isSystem() api
This is added in order to deprecate the isOwner() api. Bug: 24869636 Change-Id: I80a7a5559525faf261b9d9c7a8593e6ff5db4b22
-rw-r--r--api/system-current.txt3
-rw-r--r--core/java/android/os/UserHandle.java13
2 files changed, 14 insertions, 2 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 5e1aa419870d..9318c02a7082 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -25741,7 +25741,8 @@ package android.os {
ctor public UserHandle(android.os.Parcel);
method public int describeContents();
method public int getIdentifier();
- method public boolean isOwner();
+ method public deprecated boolean isOwner();
+ method public boolean isSystem();
method public static int myUserId();
method public static android.os.UserHandle readFromParcel(android.os.Parcel);
method public void writeToParcel(android.os.Parcel, int);
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 796addc4c3bc..95da438bc869 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -270,13 +270,24 @@ public final class UserHandle implements Parcelable {
* Returns true if this UserHandle refers to the owner user; false otherwise.
* @return true if this UserHandle refers to the owner user; false otherwise.
* @hide
- * TODO: find an alternative to this Api.
+ * @deprecated please use {@link #isSystem()} or check for
+ * {@link android.content.pm.UserInfo#isPrimary()}
+ * {@link android.content.pm.UserInfo#isAdmin()} based on your particular use case.
*/
@SystemApi
public boolean isOwner() {
return this.equals(OWNER);
}
+ /**
+ * @return true if this UserHandle refers to the system user; false otherwise.
+ * @hide
+ */
+ @SystemApi
+ public boolean isSystem() {
+ return this.equals(SYSTEM);
+ }
+
/** @hide */
public UserHandle(int h) {
mHandle = h;