Merge "Restrict PHONE_CALL ops based on TelecomService" into tm-dev am: 68c29dc3ff

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17200774

Change-Id: Ia957ae8fe22c97130c482fc38e18f3e014f8a4bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alex Stetson
2022-04-05 19:48:05 +00:00
committed by Automerger Merge Worker

View File

@@ -187,8 +187,12 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat
initializeActivityRecognizersTags(); initializeActivityRecognizersTags();
// If this device does not have telephony, restrict the phone call ops // Restrict phone call ops if the TelecomService will not start (conditioned on having
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { // FEATURE_MICROPHONE, FEATURE_TELECOM, or FEATURE_TELEPHONY).
PackageManager pm = mContext.getPackageManager();
if (!pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
&& !pm.hasSystemFeature(PackageManager.FEATURE_MICROPHONE)
&& !pm.hasSystemFeature(PackageManager.FEATURE_TELECOM)) {
AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class); AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class);
appOps.setUserRestrictionForUser(AppOpsManager.OP_PHONE_CALL_MICROPHONE, true, mToken, appOps.setUserRestrictionForUser(AppOpsManager.OP_PHONE_CALL_MICROPHONE, true, mToken,
null, UserHandle.USER_ALL); null, UserHandle.USER_ALL);