summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorYan Zhu <yanzhuyan@google.com>2021-06-06 23:36:18 -0700
committerYan Zhu <yanzhuyan@google.com>2021-06-15 10:21:55 -0700
commit421dcbaca58eb544ba35f1ca07d424e009d1369f (patch)
tree161ad16c13ac9bc0440fd1220a80c7257f2e3a1b /core/java/android
parent8699bf30999da0311d2f931916a6697357746383 (diff)
Improve restriction for BugreportManagerService for multi-user
For provisioned device - Remove the check for the current user is the same as the primary user - Check for whether the caller is device owner and the current user is affiliated with the device Bug: 185426804 Test: manual test with AAOS build with device owner setup and request bugreport from TestDPC Change-Id: I78066979fd54b480433ef9ba5144ca666c601591
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java14
-rw-r--r--core/java/android/app/admin/IDevicePolicyManager.aidl3
2 files changed, 15 insertions, 2 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 52c58e162289..b5b7dbdff172 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -11871,7 +11871,19 @@ public class DevicePolicyManager {
public boolean isAffiliatedUser() {
throwIfParentInstance("isAffiliatedUser");
try {
- return mService.isAffiliatedUser();
+ return mService.isCallingUserAffiliated();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * @hide
+ * Returns whether target user is affiliated with the device.
+ */
+ public boolean isAffiliatedUser(@UserIdInt int userId) {
+ try {
+ return mService.isAffiliatedUser(userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index db2fc0d19b4c..b6c48a1c057b 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -390,7 +390,8 @@ interface IDevicePolicyManager {
void setAffiliationIds(in ComponentName admin, in List<String> ids);
List<String> getAffiliationIds(in ComponentName admin);
- boolean isAffiliatedUser();
+ boolean isCallingUserAffiliated();
+ boolean isAffiliatedUser(int userId);
void setSecurityLoggingEnabled(in ComponentName admin, String packageName, boolean enabled);
boolean isSecurityLoggingEnabled(in ComponentName admin, String packageName);