From e96b5668b35b14b98e18a4d64d7aadb7fa071f7f Mon Sep 17 00:00:00 2001 From: Ricardo Correa Date: Fri, 10 Jan 2020 14:30:03 -0800 Subject: [PATCH] Include an AppOp to allow dialer role app to record and play audio into calls This change includes an AppOp that will be used to grant access to telephony call audio (RX and TX) to the default dialer application (assigned to the Dialer role). A new permission was created so only apps that also require this permission will be granted. It will also be used to keep track of usage (audit). Test: Compilation and manual verification Bug: 135197853 Change-Id: I5d042f667ca5fe64f8048b8aff7b98f51b3c1500 --- api/current.txt | 1 + api/system-current.txt | 1 + core/java/android/app/AppOpsManager.java | 16 +++++++++++++++- core/java/android/app/AsyncNotedAppOp.java | 4 ++-- core/res/AndroidManifest.xml | 9 +++++++++ core/res/res/values/strings.xml | 5 +++++ 6 files changed, 33 insertions(+), 3 deletions(-) diff --git a/api/current.txt b/api/current.txt index 7bfd9a403ae96..847341d55b6cd 100644 --- a/api/current.txt +++ b/api/current.txt @@ -9,6 +9,7 @@ package android { ctor public Manifest.permission(); field public static final String ACCEPT_HANDOVER = "android.permission.ACCEPT_HANDOVER"; field public static final String ACCESS_BACKGROUND_LOCATION = "android.permission.ACCESS_BACKGROUND_LOCATION"; + field public static final String ACCESS_CALL_AUDIO = "android.permission.ACCESS_CALL_AUDIO"; field public static final String ACCESS_CHECKIN_PROPERTIES = "android.permission.ACCESS_CHECKIN_PROPERTIES"; field public static final String ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION"; field public static final String ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION"; diff --git a/api/system-current.txt b/api/system-current.txt index 773cd4d1cf040..891256e1def81 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -375,6 +375,7 @@ package android.app { method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setUidMode(String, int, int); field public static final String OPSTR_ACCEPT_HANDOVER = "android:accept_handover"; field public static final String OPSTR_ACCESS_ACCESSIBILITY = "android:access_accessibility"; + field public static final String OPSTR_ACCESS_CALL_AUDIO = "android:access_call_audio"; field public static final String OPSTR_ACCESS_NOTIFICATIONS = "android:access_notifications"; field public static final String OPSTR_ACTIVATE_VPN = "android:activate_vpn"; field public static final String OPSTR_ASSIST_SCREENSHOT = "android:assist_screenshot"; diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index f6bbc6824e710..176a12c5d9527 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -995,10 +995,12 @@ public class AppOpsManager { public static final int OP_ACTIVATE_PLATFORM_VPN = 94; /** @hide */ public static final int OP_LOADER_USAGE_STATS = 95; + /** @hide Access telephony call audio */ + public static final int OP_ACCESS_CALL_AUDIO = 96; /** @hide */ @UnsupportedAppUsage - public static final int _NUM_OP = 96; + public static final int _NUM_OP = 97; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -1289,6 +1291,9 @@ public class AppOpsManager { @SystemApi public static final String OPSTR_MANAGE_EXTERNAL_STORAGE = "android:manage_external_storage"; + /** @hide Access telephony call audio */ + @SystemApi + public static final String OPSTR_ACCESS_CALL_AUDIO = "android:access_call_audio"; /** @hide Communicate cross-profile within the same profile group. */ @SystemApi @@ -1378,6 +1383,7 @@ public class AppOpsManager { OP_MANAGE_EXTERNAL_STORAGE, OP_INTERACT_ACROSS_PROFILES, OP_LOADER_USAGE_STATS, + OP_ACCESS_CALL_AUDIO, }; /** @@ -1485,6 +1491,7 @@ public class AppOpsManager { OP_INTERACT_ACROSS_PROFILES, //INTERACT_ACROSS_PROFILES OP_ACTIVATE_PLATFORM_VPN, // ACTIVATE_PLATFORM_VPN OP_LOADER_USAGE_STATS, // LOADER_USAGE_STATS + OP_ACCESS_CALL_AUDIO, // ACCESS_CALL_AUDIO }; /** @@ -1587,6 +1594,7 @@ public class AppOpsManager { OPSTR_INTERACT_ACROSS_PROFILES, OPSTR_ACTIVATE_PLATFORM_VPN, OPSTR_LOADER_USAGE_STATS, + OPSTR_ACCESS_CALL_AUDIO, }; /** @@ -1690,6 +1698,7 @@ public class AppOpsManager { "INTERACT_ACROSS_PROFILES", "ACTIVATE_PLATFORM_VPN", "LOADER_USAGE_STATS", + "ACCESS_CALL_AUDIO", }; /** @@ -1794,6 +1803,7 @@ public class AppOpsManager { android.Manifest.permission.INTERACT_ACROSS_PROFILES, null, // no permission for OP_ACTIVATE_PLATFORM_VPN android.Manifest.permission.LOADER_USAGE_STATS, + Manifest.permission.ACCESS_CALL_AUDIO, }; /** @@ -1898,6 +1908,7 @@ public class AppOpsManager { null, // INTERACT_ACROSS_PROFILES null, // ACTIVATE_PLATFORM_VPN null, // LOADER_USAGE_STATS + null, // ACCESS_CALL_AUDIO }; /** @@ -2001,6 +2012,7 @@ public class AppOpsManager { false, // INTERACT_ACROSS_PROFILES false, // ACTIVATE_PLATFORM_VPN false, // LOADER_USAGE_STATS + false, // ACCESS_CALL_AUDIO }; /** @@ -2103,6 +2115,7 @@ public class AppOpsManager { AppOpsManager.MODE_DEFAULT, // INTERACT_ACROSS_PROFILES AppOpsManager.MODE_IGNORED, // ACTIVATE_PLATFORM_VPN AppOpsManager.MODE_DEFAULT, // LOADER_USAGE_STATS + AppOpsManager.MODE_DEFAULT, // ACCESS_CALL_AUDIO }; /** @@ -2209,6 +2222,7 @@ public class AppOpsManager { false, // INTERACT_ACROSS_PROFILES false, // ACTIVATE_PLATFORM_VPN false, // LOADER_USAGE_STATS + false, // ACCESS_CALL_AUDIO }; /** diff --git a/core/java/android/app/AsyncNotedAppOp.java b/core/java/android/app/AsyncNotedAppOp.java index 130e2ecdcc834..6b1afdad82df7 100644 --- a/core/java/android/app/AsyncNotedAppOp.java +++ b/core/java/android/app/AsyncNotedAppOp.java @@ -256,10 +256,10 @@ public final class AsyncNotedAppOp implements Parcelable { }; @DataClass.Generated( - time = 1580158740502L, + time = 1581728574427L, codegenVersion = "1.0.14", sourceFile = "frameworks/base/core/java/android/app/AsyncNotedAppOp.java", - inputSignatures = "private final @android.annotation.IntRange(from=0L, to=95L) int mOpCode\nprivate final @android.annotation.IntRange(from=0L) int mNotingUid\nprivate final @android.annotation.Nullable java.lang.String mFeatureId\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.annotation.IntRange(from=0L) long mTime\npublic @android.annotation.NonNull java.lang.String getOp()\nclass AsyncNotedAppOp extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genHiddenConstructor=true)") + inputSignatures = "private final @android.annotation.IntRange(from=0L, to=96L) int mOpCode\nprivate final @android.annotation.IntRange(from=0L) int mNotingUid\nprivate final @android.annotation.Nullable java.lang.String mFeatureId\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.annotation.IntRange(from=0L) long mTime\npublic @android.annotation.NonNull java.lang.String getOp()\nclass AsyncNotedAppOp extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genHiddenConstructor=true)") @Deprecated private void __metadata() {} diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index b2047ad819fc8..28d6a10bca687 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1197,6 +1197,15 @@ android:description="@string/permdesc_acceptHandovers" android:protectionLevel="dangerous" /> + + + diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index e6a93e550a5fa..d513e2b5a9e55 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -5364,4 +5364,9 @@ We couldn\u2019t find any apps Switch on work + + + Record or play audio in telephony calls + + Allows this app, when assigned as default dialer application, to record or play audio in telephony calls.