summaryrefslogtreecommitdiff
path: root/telecomm/java
diff options
context:
space:
mode:
authorShuo Qian <shuoq@google.com>2021-03-01 18:57:21 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-03-01 18:57:21 +0000
commita63d1250106f8c225fb985f1f42c5863bdb5080c (patch)
tree7c269536ef0cf1a1b0b6544bc67a74eba4b48334 /telecomm/java
parentdc8de2ce5aa52d0e0d537ca2593be69cb9c47934 (diff)
parentb7cc3c61066e5019e79a3b7dc80d0193e39f23de (diff)
Merge "Companion InCallService API review" am: b7cc3c6106
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607479 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ib967a0256b39150a190dc4cb7b8b7f7a00d3fdd7
Diffstat (limited to 'telecomm/java')
-rw-r--r--telecomm/java/android/telecom/InCallService.java18
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java27
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomService.aidl4
3 files changed, 34 insertions, 15 deletions
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index 07de61759d59..0ff288b1ac63 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -138,6 +138,24 @@ import java.util.List;
* }
* }
* }
+ *
+ * </pre>
+ * <p id="companionInCallService">
+ * <h3>Access to InCallService for Wearable Devices</h3>
+ * <ol>
+ * If your app is a third-party companion app and wants to access InCallService APIs, what your
+ * app could do are:
+ * <p>
+ * <ol>
+ * <li> Declare MANAGE_ONGOING_CALLS permission in your manifest
+ * <li> Associate with a physical wearable device via the
+ * {@link android.companion.CompanionDeviceManager} API as a companion app. See:
+ * https://developer.android.com/guide/topics/connectivity/companion-device-pairing
+ * <li> Implement this InCallService with BIND_INCALL_SERVICE permission
+ * </ol>
+ * </ol>
+ * <p>
+ *
* </pre>
* <p id="incomingCallNotification">
* <h3>Showing the Incoming Call Notification</h3>
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 422dc9574d18..746e72a0bde3 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -1657,24 +1657,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;
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 6dc096daf4ea..5afac2ec239a 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -179,9 +179,9 @@ interface ITelecomService {
boolean isInCall(String callingPackage, String callingFeatureId);
/**
- * @see TelecomServiceImpl#hasCompanionInCallServiceAccess
+ * @see TelecomServiceImpl#hasManageOngoingCallsPermission
*/
- boolean hasCompanionInCallServiceAccess(String callingPackage);
+ boolean hasManageOngoingCallsPermission(String callingPackage);
/**
* @see TelecomServiceImpl#isInManagedCall