summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-15 02:48:03 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-15 02:48:03 +0000
commit4d19f98b5ed3feee64d47d93c68770fa8d440230 (patch)
treed434e39230d34f895348f9bce97fd228101a0e7e
parent11ee410147d2f37b12051b143b78c050e52546e5 (diff)
parentcecdb11b278c53ef9276f0206c6a3bc95a30f9c8 (diff)
downloadPermission-android14-qpr1-release.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25238863'] into udc-qpr1-release.android-14.0.0_r27android-14.0.0_r26android-14.0.0_r25android-14.0.0_r24android-14.0.0_r23android-14.0.0_r22android14-qpr1-release
Change-Id: I1c7f7a964b670238d2db85bfeb6e0cf8bf746318
-rw-r--r--PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceAppStreamingRoleBehavior.java13
-rw-r--r--PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceComputerRoleBehavior.java13
-rw-r--r--PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceGlassesRoleBehavior.java13
-rw-r--r--PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceWatchRoleBehavior.java13
4 files changed, 44 insertions, 8 deletions
diff --git a/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceAppStreamingRoleBehavior.java b/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceAppStreamingRoleBehavior.java
index 131690fd7..1c57efd01 100644
--- a/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceAppStreamingRoleBehavior.java
+++ b/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceAppStreamingRoleBehavior.java
@@ -17,12 +17,15 @@
package com.android.role.controller.behavior;
import android.content.Context;
+import android.os.Process;
+import android.os.UserHandle;
import androidx.annotation.NonNull;
import com.android.role.controller.model.Role;
import com.android.role.controller.model.RoleBehavior;
import com.android.role.controller.util.NotificationUtils;
+import com.android.role.controller.util.UserUtils;
/**
* Class for behavior of the "App Streaming" Companion device profile role.
@@ -31,11 +34,17 @@ public class CompanionDeviceAppStreamingRoleBehavior implements RoleBehavior {
@Override
public void grant(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- NotificationUtils.grantNotificationAccessForPackage(context, packageName);
+ UserHandle user = Process.myUserHandle();
+ if (!UserUtils.isManagedProfile(user, context)) {
+ NotificationUtils.grantNotificationAccessForPackage(context, packageName);
+ }
}
@Override
public void revoke(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- NotificationUtils.revokeNotificationAccessForPackage(context, packageName);
+ UserHandle user = Process.myUserHandle();
+ if (!UserUtils.isManagedProfile(user, context)) {
+ NotificationUtils.revokeNotificationAccessForPackage(context, packageName);
+ }
}
}
diff --git a/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceComputerRoleBehavior.java b/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceComputerRoleBehavior.java
index c59d5e58d..c5de0d848 100644
--- a/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceComputerRoleBehavior.java
+++ b/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceComputerRoleBehavior.java
@@ -17,12 +17,15 @@
package com.android.role.controller.behavior;
import android.content.Context;
+import android.os.Process;
+import android.os.UserHandle;
import androidx.annotation.NonNull;
import com.android.role.controller.model.Role;
import com.android.role.controller.model.RoleBehavior;
import com.android.role.controller.util.NotificationUtils;
+import com.android.role.controller.util.UserUtils;
/**
* Class for behavior of the "Computer" Companion device profile role.
@@ -31,11 +34,17 @@ public class CompanionDeviceComputerRoleBehavior implements RoleBehavior {
@Override
public void grant(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- NotificationUtils.grantNotificationAccessForPackage(context, packageName);
+ UserHandle user = Process.myUserHandle();
+ if (!UserUtils.isManagedProfile(user, context)) {
+ NotificationUtils.grantNotificationAccessForPackage(context, packageName);
+ }
}
@Override
public void revoke(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- NotificationUtils.revokeNotificationAccessForPackage(context, packageName);
+ UserHandle user = Process.myUserHandle();
+ if (!UserUtils.isManagedProfile(user, context)) {
+ NotificationUtils.revokeNotificationAccessForPackage(context, packageName);
+ }
}
}
diff --git a/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceGlassesRoleBehavior.java b/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceGlassesRoleBehavior.java
index 2e4691b9c..5988cd4b6 100644
--- a/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceGlassesRoleBehavior.java
+++ b/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceGlassesRoleBehavior.java
@@ -17,12 +17,15 @@
package com.android.role.controller.behavior;
import android.content.Context;
+import android.os.Process;
+import android.os.UserHandle;
import androidx.annotation.NonNull;
import com.android.role.controller.model.Role;
import com.android.role.controller.model.RoleBehavior;
import com.android.role.controller.util.NotificationUtils;
+import com.android.role.controller.util.UserUtils;
/**
* Class for behavior of the "glasses" Companion device profile role.
@@ -31,11 +34,17 @@ public class CompanionDeviceGlassesRoleBehavior implements RoleBehavior {
@Override
public void grant(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- NotificationUtils.grantNotificationAccessForPackage(context, packageName);
+ UserHandle user = Process.myUserHandle();
+ if (!UserUtils.isManagedProfile(user, context)) {
+ NotificationUtils.grantNotificationAccessForPackage(context, packageName);
+ }
}
@Override
public void revoke(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- NotificationUtils.revokeNotificationAccessForPackage(context, packageName);
+ UserHandle user = Process.myUserHandle();
+ if (!UserUtils.isManagedProfile(user, context)) {
+ NotificationUtils.revokeNotificationAccessForPackage(context, packageName);
+ }
}
}
diff --git a/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceWatchRoleBehavior.java b/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceWatchRoleBehavior.java
index 233c0d92e..7f5d68b14 100644
--- a/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceWatchRoleBehavior.java
+++ b/PermissionController/role-controller/java/com/android/role/controller/behavior/CompanionDeviceWatchRoleBehavior.java
@@ -17,12 +17,15 @@
package com.android.role.controller.behavior;
import android.content.Context;
+import android.os.Process;
+import android.os.UserHandle;
import androidx.annotation.NonNull;
import com.android.role.controller.model.Role;
import com.android.role.controller.model.RoleBehavior;
import com.android.role.controller.util.NotificationUtils;
+import com.android.role.controller.util.UserUtils;
/**
* Class for behavior of the "watch" Companion device profile role.
@@ -31,11 +34,17 @@ public class CompanionDeviceWatchRoleBehavior implements RoleBehavior {
@Override
public void grant(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- NotificationUtils.grantNotificationAccessForPackage(context, packageName);
+ UserHandle user = Process.myUserHandle();
+ if (!UserUtils.isManagedProfile(user, context)) {
+ NotificationUtils.grantNotificationAccessForPackage(context, packageName);
+ }
}
@Override
public void revoke(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- NotificationUtils.revokeNotificationAccessForPackage(context, packageName);
+ UserHandle user = Process.myUserHandle();
+ if (!UserUtils.isManagedProfile(user, context)) {
+ NotificationUtils.revokeNotificationAccessForPackage(context, packageName);
+ }
}
}