summaryrefslogtreecommitdiffstats
path: root/core/java/android/os
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2015-04-18 02:01:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-18 02:01:18 +0000
commiteab852cb34cec4f83662db076d2339dbb97532e9 (patch)
treebf3d2fd86430902757e0f3f7891fc9ad890538e5 /core/java/android/os
parent928bfc4e1cf3e440c9fdf346ddf0e18db4cc8850 (diff)
parent5760e1786bcc2feac9d1c2c784520aa4d6cf8cb8 (diff)
downloadframeworks_base-eab852cb34cec4f83662db076d2339dbb97532e9.zip
frameworks_base-eab852cb34cec4f83662db076d2339dbb97532e9.tar.gz
frameworks_base-eab852cb34cec4f83662db076d2339dbb97532e9.tar.bz2
Merge "Add isSystemUser API"
Diffstat (limited to 'core/java/android/os')
-rw-r--r--core/java/android/os/UserManager.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index b9e307f..44eb1ed 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -466,9 +466,9 @@ public class UserManager {
}
/**
- * Returns the user handle for the user that the calling process is running on.
+ * Returns the user handle for the user that this process is running under.
*
- * @return the user handle of the user making this call.
+ * @return the user handle of this process.
* @hide
*/
public int getUserHandle() {
@@ -505,6 +505,17 @@ public class UserManager {
}
/**
+ * Used to check if this process is running under the system user. The system user
+ * is the initial user that is implicitly created on first boot and hosts most of the
+ * system services.
+ *
+ * @return whether this process is running under the system user.
+ */
+ public boolean isSystemUser() {
+ return UserHandle.myUserId() == UserHandle.USER_OWNER;
+ }
+
+ /**
* Used to check if the user making this call is linked to another user. Linked users may have
* a reduced number of available apps, app restrictions and account restrictions.
* @return whether the user making this call is a linked user