summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorMakoto Onuki <omakoto@google.com>2015-09-08 18:28:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-09-08 18:28:53 +0000
commit3adba7867a64ea9a5696ca8fd4aa5159f49e0725 (patch)
tree338ed1a0d245f9330f82384b0503599ac79b3017 /core/java/android
parent9086f5405d98d7f09d999bfe7c6a895a2aaf602e (diff)
parent58b684f1cdc52467b71c42cfae18433a19ce7d0b (diff)
Merge "[split system] Tentatively support running DO on meat user"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java22
-rw-r--r--core/java/android/app/admin/IDevicePolicyManager.aidl2
2 files changed, 19 insertions, 5 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 7ffac0a6dc39..ac50699ca110 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -2684,13 +2684,26 @@ public class DevicePolicyManager {
* @throws IllegalArgumentException if the package name is null or invalid
* @throws IllegalStateException If the preconditions mentioned are not met.
*/
- public boolean setDeviceOwner(String packageName) throws IllegalArgumentException,
- IllegalStateException {
+ public boolean setDeviceOwner(String packageName) {
return setDeviceOwner(packageName, null);
}
/**
* @hide
+ */
+ public boolean setDeviceOwner(String packageName, int userId) {
+ return setDeviceOwner(packageName, null, userId);
+ }
+
+ /**
+ * @hide
+ */
+ public boolean setDeviceOwner(String packageName, String ownerName) {
+ return setDeviceOwner(packageName, ownerName, UserHandle.USER_SYSTEM);
+ }
+
+ /**
+ * @hide
* Sets the given package as the device owner. The package must already be installed. There
* must not already be a device owner.
* Only apps with the MANAGE_PROFILE_AND_DEVICE_OWNERS permission and the shell uid can call
@@ -2699,15 +2712,16 @@ public class DevicePolicyManager {
* the caller is the shell uid, and there are no additional users and no accounts.
* @param packageName the package name of the application to be registered as the device owner.
* @param ownerName the human readable name of the institution that owns this device.
+ * @param userId ID of the user on which the device owner runs.
* @return whether the package was successfully registered as the device owner.
* @throws IllegalArgumentException if the package name is null or invalid
* @throws IllegalStateException If the preconditions mentioned are not met.
*/
- public boolean setDeviceOwner(String packageName, String ownerName)
+ public boolean setDeviceOwner(String packageName, String ownerName, int userId)
throws IllegalArgumentException, IllegalStateException {
if (mService != null) {
try {
- return mService.setDeviceOwner(packageName, ownerName);
+ return mService.setDeviceOwner(packageName, ownerName, userId);
} catch (RemoteException re) {
Log.w(TAG, "Failed to set device owner");
}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 376a3d82f7f1..55a21c61f53a 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -113,7 +113,7 @@ interface IDevicePolicyManager {
void reportFailedPasswordAttempt(int userHandle);
void reportSuccessfulPasswordAttempt(int userHandle);
- boolean setDeviceOwner(String packageName, String ownerName);
+ boolean setDeviceOwner(String packageName, String ownerName, int userId);
boolean isDeviceOwner(String packageName);
String getDeviceOwner();
String getDeviceOwnerName();