diff options
| author | 2021-06-30 23:57:00 +0000 | |
|---|---|---|
| committer | 2021-06-30 23:57:00 +0000 | |
| commit | f56767128cb3406aa87fa87981dc9d73ccfae3a9 (patch) | |
| tree | 88a2aae90fd802e6edfd4d1ca3c9fbdc5309d5df | |
| parent | 88a62d67c1be55e627ed905dc05093a89345b9de (diff) | |
| parent | 224fcc1d160a4d662c6c9bd394670137f614736a (diff) | |
Merge "On non-telephony devices, restrict PHONE_CALL ops" into sc-dev
| -rw-r--r-- | services/core/java/com/android/server/policy/AppOpsPolicy.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/policy/AppOpsPolicy.java b/services/core/java/com/android/server/policy/AppOpsPolicy.java index 7689f5f5fd65..18c45e494c9b 100644 --- a/services/core/java/com/android/server/policy/AppOpsPolicy.java +++ b/services/core/java/com/android/server/policy/AppOpsPolicy.java @@ -32,6 +32,7 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.location.LocationManagerInternal; import android.net.Uri; +import android.os.Binder; import android.os.IBinder; import android.os.PackageTagsList; import android.os.Process; @@ -72,6 +73,9 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat private final Object mLock = new Object(); @NonNull + private final IBinder mToken = new Binder(); + + @NonNull private final Context mContext; @NonNull @@ -180,6 +184,15 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat }, UserHandle.SYSTEM); initializeActivityRecognizersTags(); + + // If this device does not have telephony, restrict the phone call ops + if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { + AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class); + appOps.setUserRestrictionForUser(AppOpsManager.OP_PHONE_CALL_MICROPHONE, true, mToken, + null, UserHandle.USER_ALL); + appOps.setUserRestrictionForUser(AppOpsManager.OP_PHONE_CALL_CAMERA, true, mToken, + null, UserHandle.USER_ALL); + } } private static boolean isHotwordDetectionServiceRequired(PackageManager pm) { |