summaryrefslogtreecommitdiffstats
path: root/core/java/android/os
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2014-09-03 20:26:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-03 20:26:10 +0000
commitbef1036af781f8defadb2345f256da71e3906bd4 (patch)
tree7403123582abe5bd68fc74e8ff53fe68bc487793 /core/java/android/os
parent6c25708eb5b1980445213b7b30cc9d6dad16b7f1 (diff)
parent0e8d7d63ba439cc0604af7055679dae3d30fdc48 (diff)
downloadframeworks_base-bef1036af781f8defadb2345f256da71e3906bd4.zip
frameworks_base-bef1036af781f8defadb2345f256da71e3906bd4.tar.gz
frameworks_base-bef1036af781f8defadb2345f256da71e3906bd4.tar.bz2
Merge "Add some @SystemApi tags for internal user-related APIs" into lmp-dev
Diffstat (limited to 'core/java/android/os')
-rw-r--r--core/java/android/os/UserHandle.java7
-rw-r--r--core/java/android/os/UserManager.java14
2 files changed, 20 insertions, 1 deletions
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 5ce9d5c..0ff5f6a 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -234,6 +234,7 @@ public final class UserHandle implements Parcelable {
* @return user id of the current process
* @hide
*/
+ @SystemApi
public static final int myUserId() {
return getUserId(Process.myUid());
}
@@ -253,7 +254,11 @@ public final class UserHandle implements Parcelable {
mHandle = h;
}
- /** @hide */
+ /**
+ * Returns the userId stored in this UserHandle.
+ * @hide
+ */
+ @SystemApi
public int getIdentifier() {
return mHandle;
}
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index f793667..59220e1 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -15,6 +15,7 @@
*/
package android.os;
+import android.annotation.SystemApi;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.content.Context;
@@ -424,6 +425,19 @@ public class UserManager {
}
/**
+ * Checks if the calling app is running in a managed profile.
+ * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
+ *
+ * @return whether the caller is in a managed profile.
+ * @hide
+ */
+ @SystemApi
+ public boolean isManagedProfile() {
+ UserInfo user = getUserInfo(UserHandle.myUserId());
+ return user != null ? user.isManagedProfile() : false;
+ }
+
+ /**
* Return whether the given user is actively running. This means that
* the user is in the "started" state, not "stopped" -- it is currently
* allowed to run code through scheduled alarms, receiving broadcasts,