summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorAlex Kershaw <alexkershaw@google.com>2020-11-29 18:21:57 +0000
committerAlex Kershaw <alexkershaw@google.com>2021-01-06 13:08:42 +0000
commit72704403aabf41e2807cc67388faafdf4457f924 (patch)
treec4147b2a1cdfbd56a6133cab04774e0193c7d4bc /core/java/android
parent6bcc71b13609f0d598ab3208b2a4fd90019e574d (diff)
[RESTRICT AUTOMERGE] Make WPMS look for DOs and POs in the correct calling user
Currently, it will always look in user 0 since it uses the DPM from mContext, which will always be from user 0 as WPMS is in the system server process. Extend DPMI to provide the necessary external helper API. This is preferable to just using createContextAsUser before getting the DPM instance since it avoids a second binding. Fixes: 144048540 Fixes: 172682826 Bug: 153995973 Bug: 174642338 Test: atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testSetWallpaper_disallowed Change-Id: I52b71000fac31ff6725ddded58206f69b263ae33 (cherry picked from commit 5b36ee3f1d2c60473f4c30161cca6a62cd9ea71f)
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/admin/DevicePolicyManagerInternal.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManagerInternal.java b/core/java/android/app/admin/DevicePolicyManagerInternal.java
index 62ac84b2b1e6..d24694faff93 100644
--- a/core/java/android/app/admin/DevicePolicyManagerInternal.java
+++ b/core/java/android/app/admin/DevicePolicyManagerInternal.java
@@ -16,6 +16,7 @@
package android.app.admin;
+import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.content.ComponentName;
import android.content.Intent;
@@ -221,6 +222,7 @@ public abstract class DevicePolicyManagerInternal {
/**
* Returns the profile owner component for the given user, or {@code null} if there is not one.
*/
+ @Nullable
public abstract ComponentName getProfileOwnerAsUser(int userHandle);
/**
@@ -234,4 +236,9 @@ public abstract class DevicePolicyManagerInternal {
* {@link #supportsResetOp(int)} is true.
*/
public abstract void resetOp(int op, String packageName, @UserIdInt int userId);
+
+ /**
+ * Returns whether the given package is a device owner or a profile owner in the calling user.
+ */
+ public abstract boolean isDeviceOrProfileOwnerInCallingUser(String packageName);
}