diff options
author | Shuo Qian <shuoq@google.com> | 2021-03-01 16:46:36 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-03-01 16:46:36 +0000 |
commit | b7cc3c61066e5019e79a3b7dc80d0193e39f23de (patch) | |
tree | f6e431ac42325c65ee6c0568d11652e60a9b5f9d /telecomm/java/android/telecom/TelecomManager.java | |
parent | 19f7526c3e20af7514bb7bb49cd0c4c72ace1b60 (diff) | |
parent | 7a2b711b0036bfef45fab07bd15eba5f869393e2 (diff) |
Merge "Companion InCallService API review"
Diffstat (limited to 'telecomm/java/android/telecom/TelecomManager.java')
-rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 3f8b68305914..b0b5ba7a1d78 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -1649,24 +1649,25 @@ public class TelecomManager { } /** - * Returns whether the caller has {@link InCallService} access for companion apps. - * - * A companion app is an app associated with a physical wearable device via the - * {@link android.companion.CompanionDeviceManager} API. + * Returns whether the caller has {@link android.Manifest.permission#MANAGE_ONGOING_CALLS} + * permission. The permission can be obtained by associating with a physical wearable device + * via the {@link android.companion.CompanionDeviceManager} API as a companion app. If the + * caller app has the permission, it has {@link InCallService} access to manage ongoing calls. * * @return {@code true} if the caller has {@link InCallService} access for * companion app; {@code false} otherwise. */ - public boolean hasCompanionInCallServiceAccess() { - try { - if (isServiceConnected()) { - return getTelecomService().hasCompanionInCallServiceAccess( + public boolean hasManageOngoingCallsPermission() { + ITelecomService service = getTelecomService(); + if (service != null) { + try { + return service.hasManageOngoingCallsPermission( mContext.getOpPackageName()); - } - } catch (RemoteException e) { - Log.e(TAG, "RemoteException calling hasCompanionInCallServiceAccess().", e); - if (!isSystemProcess()) { - e.rethrowAsRuntimeException(); + } catch (RemoteException e) { + Log.e(TAG, "RemoteException calling hasManageOngoingCallsPermission().", e); + if (!isSystemProcess()) { + e.rethrowAsRuntimeException(); + } } } return false; |