diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-06-30 23:27:58 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-06-30 23:27:58 +0000 |
commit | b1614631b0e785ac9657e368ec1d10efa30b9735 (patch) | |
tree | d302dd0f7526f45a60e38d0dfd5fbf3f6925382e | |
parent | e7f7ed4c0eb388af6f4f188d3c6443ccbca4068b (diff) | |
parent | a124075288ce385123efe7478cea776234be079b (diff) | |
download | Permission-b1614631b0e785ac9657e368ec1d10efa30b9735.tar.gz |
Merge cherrypicks of ['googleplex-android-review.googlesource.com/23845005'] into udc-release.android-vts-14.0_r1android-security-14.0.0_r4android-security-14.0.0_r3android-security-14.0.0_r2android-platform-14.0.0_r3android-platform-14.0.0_r2android-platform-14.0.0_r1android-cts-14.0_r1android-14.0.0_r28android-14.0.0_r2android-14.0.0_r15android-14.0.0_r14android-14.0.0_r13android-14.0.0_r1android14-s2-releaseandroid14-s1-releaseandroid14-release
Change-Id: I68f39a729a6b45ed1a66518c0fa0e0bd6c01eb34
-rw-r--r-- | PermissionController/role-controller/java/com/android/role/controller/behavior/SmsRoleBehavior.java | 17 |
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; |