summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pranav Madapurmath <pmadapurmath@google.com> 2024-02-05 21:56:45 -0800
committer Pranav Madapurmath <pmadapurmath@google.com> 2024-02-07 10:13:06 -0800
commit63490381927a80d6a65b34c97c970a3fdae0aaee (patch)
tree391ee283592348fbb51027bf3c837d86dca1fdee
parent6892184b02d5f7a5b6f320731e37bd6b83da4fb9 (diff)
Resolve API feedback TelecomManager#isInSelfManagedCall
As part of the mainline work, feedback has given to change the hasCrossUserAccess param to better match the description. The INTERACT_ACROSS_USERS permission has also been made an optional parameter which is enforced when the user handle passed in doesn't match the calling user or when the detectForAllUsers parameter is set to true. Bug: 323958718 Bug: 311773409 Test: atest SelfManagedConnectionServiceTest Change-Id: I96c04249e6320bde355a1efeddf0374048b84198
-rw-r--r--core/api/system-current.txt2
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java16
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomService.aidl2
3 files changed, 11 insertions, 9 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 66e03db5923b..c632062a9d6c 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -13841,7 +13841,7 @@ package android.telecom {
method @Deprecated public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsForPackage();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(String);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall();
- method @FlaggedApi("com.android.server.telecom.flags.telecom_resolve_hidden_dependencies") @RequiresPermission(allOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.INTERACT_ACROSS_USERS}) public boolean isInSelfManagedCall(@NonNull String, @NonNull android.os.UserHandle, boolean);
+ method @FlaggedApi("com.android.server.telecom.flags.telecom_resolve_hidden_dependencies") @RequiresPermission(allOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.INTERACT_ACROSS_USERS}, conditional=true) public boolean isInSelfManagedCall(@NonNull String, @NonNull android.os.UserHandle, boolean);
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle);
field public static final String ACTION_CURRENT_TTY_MODE_CHANGED = "android.telecom.action.CURRENT_TTY_MODE_CHANGED";
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index e62bd90807d1..3daa0143f244 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -2753,23 +2753,25 @@ public class TelecomManager {
*
* @param packageName the package name of the app to check calls for.
* @param userHandle the user handle on which to check for calls.
- * @param hasCrossUserAccess indicates if calls should be detected across all users.
+ * @param detectForAllUsers indicates if calls should be detected across all users. If it is
+ * set to {@code true}, and the caller has the ability to interact
+ * across users, the userHandle parameter is disregarded.
* @return {@code true} if there are ongoing calls, {@code false} otherwise.
+ * @throws SecurityException if detectForAllUsers is true or userHandle is not the calling user
+ * and the caller does not grant the ability to interact across users.
* @hide
*/
@SystemApi
@FlaggedApi(Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES)
- @RequiresPermission(allOf = {
- android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
- Manifest.permission.INTERACT_ACROSS_USERS
- })
+ @RequiresPermission(allOf = {Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
+ Manifest.permission.INTERACT_ACROSS_USERS}, conditional = true)
public boolean isInSelfManagedCall(@NonNull String packageName,
- @NonNull UserHandle userHandle, boolean hasCrossUserAccess) {
+ @NonNull UserHandle userHandle, boolean detectForAllUsers) {
ITelecomService service = getTelecomService();
if (service != null) {
try {
return service.isInSelfManagedCall(packageName, userHandle,
- mContext.getOpPackageName(), hasCrossUserAccess);
+ mContext.getOpPackageName(), detectForAllUsers);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException isInSelfManagedCall: " + e);
e.rethrowFromSystemServer();
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 412e8273b5e6..7dba799e1057 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -395,7 +395,7 @@ interface ITelecomService {
* @see TelecomServiceImpl#isInSelfManagedCall
*/
boolean isInSelfManagedCall(String packageName, in UserHandle userHandle,
- String callingPackage, boolean hasCrossUserAccess);
+ String callingPackage, boolean detectForAllUsers);
/**
* @see TelecomServiceImpl#addCall