summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-13 18:05:57 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-13 18:05:57 +0000
commit6e2c1e2fb469edd6fe8f2825f4a1d8e7aa88de18 (patch)
treec8e4433c1e595a5ab43b89bac4db29ce0ec17f13
parentb1614631b0e785ac9657e368ec1d10efa30b9735 (diff)
parentb9140b1c57d7fd58ff54d14d19062e4e2679f150 (diff)
downloadPermission-6e2c1e2fb469edd6fe8f2825f4a1d8e7aa88de18.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25238863'] into udc-platform-release.android-platform-14.0.0_r7android-platform-14.0.0_r6android-platform-14.0.0_r5android-platform-14.0.0_r4android14-platform-release
Change-Id: Id15c56109243e7a392a40f217ae217a2ddf2ede7
-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);
+ }
}
}