summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-30 23:27:58 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-30 23:27:58 +0000
commitb1614631b0e785ac9657e368ec1d10efa30b9735 (patch)
treed302dd0f7526f45a60e38d0dfd5fbf3f6925382e
parente7f7ed4c0eb388af6f4f188d3c6443ccbca4068b (diff)
parenta124075288ce385123efe7478cea776234be079b (diff)
downloadPermission-b1614631b0e785ac9657e368ec1d10efa30b9735.tar.gz
Change-Id: I68f39a729a6b45ed1a66518c0fa0e0bd6c01eb34
-rw-r--r--PermissionController/role-controller/java/com/android/role/controller/behavior/SmsRoleBehavior.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/PermissionController/role-controller/java/com/android/role/controller/behavior/SmsRoleBehavior.java b/PermissionController/role-controller/java/com/android/role/controller/behavior/SmsRoleBehavior.java
index a9062c93b..c1186a930 100644
--- a/PermissionController/role-controller/java/com/android/role/controller/behavior/SmsRoleBehavior.java
+++ b/PermissionController/role-controller/java/com/android/role/controller/behavior/SmsRoleBehavior.java
@@ -16,6 +16,8 @@
package com.android.role.controller.behavior;
+import android.app.admin.DevicePolicyManager;
+import android.app.admin.ManagedSubscriptionsPolicy;
import android.content.Context;
import android.os.Process;
import android.os.UserHandle;
@@ -60,6 +62,21 @@ public class SmsRoleBehavior implements RoleBehavior {
if (UserUtils.isCloneProfile(user, context)) {
return false;
}
+
+ // If work profile telephony is not enabled, there is no reason for sms role to be
+ // available in work profile. Given that you can't send or receive work message without
+ // work profile telephony being enabled.
+ // Also when work profile telephony gets enabled, dialer/sms app gets installed in to
+ // work profile, which would trigger this function and hence sms role getting
+ // enabled at the right point of time.
+ if (UserUtils.isManagedProfile(user, context)) {
+ DevicePolicyManager devicePolicyManager = context.getSystemService(
+ DevicePolicyManager.class);
+ if (devicePolicyManager.getManagedSubscriptionsPolicy().getPolicyType()
+ != ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS) {
+ return false;
+ }
+ }
} else {
if (UserUtils.isProfile(user, context)) {
return false;