summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2022-03-14 23:41:44 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-03-14 23:41:44 +0000
commitadc12a6263b9700b1a30bd39c64e5d76d6dc5654 (patch)
treea6fa16c286a5f3f9efea9111518440a6cd5cc9d6
parenta4b205e2a5912f96e1eb4dba905f28c9e5d5744e (diff)
parent1ce47bf1294764ea23509d45ab015fbe196e34b6 (diff)
Merge "DO NOT MERGE Restrict PHONE_CALL ops based on TelecomService" into sc-v2-dev
-rw-r--r--services/core/java/com/android/server/policy/AppOpsPolicy.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/policy/AppOpsPolicy.java b/services/core/java/com/android/server/policy/AppOpsPolicy.java
index 8b4690629ec5..e5db2e4dab35 100644
--- a/services/core/java/com/android/server/policy/AppOpsPolicy.java
+++ b/services/core/java/com/android/server/policy/AppOpsPolicy.java
@@ -185,8 +185,13 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat
initializeActivityRecognizersTags();
- // If this device does not have telephony, restrict the phone call ops
- if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ // If this device does not have telephony or microphone features, the TelecomService will
+ // not be started (which sets phone call ops to allow only its package). Therefore, phone
+ // call ops need to be restricted here.
+ PackageManager pm = mContext.getPackageManager();
+ if (!pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
+ && !pm.hasSystemFeature(PackageManager.FEATURE_MICROPHONE)
+ && !pm.hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE)) {
AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class);
appOps.setUserRestrictionForUser(AppOpsManager.OP_PHONE_CALL_MICROPHONE, true, mToken,
null, UserHandle.USER_ALL);