Companion InCallService API review
Test: atest; make docs Bug: 179116441 Change-Id: Id75e727f6c3fc42132a80f7258bf790be79acf19 Merged-In: Id75e727f6c3fc42132a80f7258bf790be79acf19
This commit is contained in:
@@ -40249,7 +40249,7 @@ package android.telecom {
|
|||||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle);
|
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle);
|
||||||
method public boolean hasCompanionInCallServiceAccess();
|
method public boolean hasManageOngoingCallsPermission();
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInCall();
|
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInCall();
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInManagedCall();
|
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInManagedCall();
|
||||||
method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
|
method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
|
||||||
|
|||||||
@@ -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>
|
* </pre>
|
||||||
* <p id="incomingCallNotification">
|
* <p id="incomingCallNotification">
|
||||||
* <h3>Showing the Incoming Call Notification</h3>
|
* <h3>Showing the Incoming Call Notification</h3>
|
||||||
|
|||||||
@@ -1702,22 +1702,22 @@ public class TelecomManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the caller has {@link InCallService} access for companion apps.
|
* 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
|
||||||
* A companion app is an app associated with a physical wearable device via the
|
* via the {@link android.companion.CompanionDeviceManager} API as a companion app. If the
|
||||||
* {@link android.companion.CompanionDeviceManager} API.
|
* 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
|
* @return {@code true} if the caller has {@link InCallService} access for
|
||||||
* companion app; {@code false} otherwise.
|
* companion app; {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean hasCompanionInCallServiceAccess() {
|
public boolean hasManageOngoingCallsPermission() {
|
||||||
ITelecomService service = getTelecomService();
|
ITelecomService service = getTelecomService();
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
try {
|
try {
|
||||||
return service.hasCompanionInCallServiceAccess(
|
return service.hasManageOngoingCallsPermission(
|
||||||
mContext.getOpPackageName());
|
mContext.getOpPackageName());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "RemoteException calling hasCompanionInCallServiceAccess().", e);
|
Log.e(TAG, "RemoteException calling hasManageOngoingCallsPermission().", e);
|
||||||
if (!isSystemProcess()) {
|
if (!isSystemProcess()) {
|
||||||
e.rethrowAsRuntimeException();
|
e.rethrowAsRuntimeException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,9 +179,9 @@ interface ITelecomService {
|
|||||||
boolean isInCall(String callingPackage, String callingFeatureId);
|
boolean isInCall(String callingPackage, String callingFeatureId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see TelecomServiceImpl#hasCompanionInCallServiceAccess
|
* @see TelecomServiceImpl#hasManageOngoingCallsPermission
|
||||||
*/
|
*/
|
||||||
boolean hasCompanionInCallServiceAccess(String callingPackage);
|
boolean hasManageOngoingCallsPermission(String callingPackage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see TelecomServiceImpl#isInManagedCall
|
* @see TelecomServiceImpl#isInManagedCall
|
||||||
|
|||||||
Reference in New Issue
Block a user