summaryrefslogtreecommitdiff
path: root/telecomm/java/android/telecom/TelecomManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm/java/android/telecom/TelecomManager.java')
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java56
1 files changed, 51 insertions, 5 deletions
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 27af16b66a11..8f5be784256e 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -811,15 +811,17 @@ public class TelecomManager {
* <p>
* Apps must be prepared for this method to return {@code null}, indicating that there currently
* exists no user-chosen default {@code PhoneAccount}.
+ * <p>
+ * The default dialer has access to use this method.
*
* @return The user outgoing phone account selected by the user.
- * @hide
*/
- @UnsupportedAppUsage
+ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() {
try {
if (isServiceConnected()) {
- return getTelecomService().getUserSelectedOutgoingPhoneAccount();
+ return getTelecomService().getUserSelectedOutgoingPhoneAccount(
+ mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#getUserSelectedOutgoingPhoneAccount", e);
@@ -828,10 +830,14 @@ public class TelecomManager {
}
/**
- * Sets the user-chosen default for making outgoing phone calls.
+ * Sets the user-chosen default {@link PhoneAccountHandle} for making outgoing phone calls.
+ *
+ * @param accountHandle The {@link PhoneAccountHandle} which will be used by default for making
+ * outgoing voice calls.
* @hide
*/
- @UnsupportedAppUsage
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ @SystemApi
public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
try {
if (isServiceConnected()) {
@@ -1416,8 +1422,14 @@ public class TelecomManager {
*
* @return {@code true} if there is a call which will be rejected or terminated, {@code false}
* otherwise.
+ * @deprecated Companion apps for wearable devices should use the {@link InCallService} API
+ * instead. Apps performing call screening should use the {@link CallScreeningService} API
+ * instead.
*/
+
+
@RequiresPermission(Manifest.permission.ANSWER_PHONE_CALLS)
+ @Deprecated
public boolean endCall() {
try {
if (isServiceConnected()) {
@@ -1438,11 +1450,15 @@ public class TelecomManager {
*
* Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} or
* {@link android.Manifest.permission#ANSWER_PHONE_CALLS}
+ *
+ * @deprecated Companion apps for wearable devices should use the {@link InCallService} API
+ * instead.
*/
//TODO: L-release - need to convert all invocation of ITelecmmService#answerRingingCall to use
// this method (clockwork & gearhead).
@RequiresPermission(anyOf =
{Manifest.permission.ANSWER_PHONE_CALLS, Manifest.permission.MODIFY_PHONE_STATE})
+ @Deprecated
public void acceptRingingCall() {
try {
if (isServiceConnected()) {
@@ -1461,9 +1477,12 @@ public class TelecomManager {
* {@link android.Manifest.permission#ANSWER_PHONE_CALLS}
*
* @param videoState The desired video state to answer the call with.
+ * @deprecated Companion apps for wearable devices should use the {@link InCallService} API
+ * instead.
*/
@RequiresPermission(anyOf =
{Manifest.permission.ANSWER_PHONE_CALLS, Manifest.permission.MODIFY_PHONE_STATE})
+ @Deprecated
public void acceptRingingCall(int videoState) {
try {
if (isServiceConnected()) {
@@ -1982,6 +2001,33 @@ public class TelecomManager {
}
/**
+ * Called by the default dialer to report to Telecom when the user has marked a previous
+ * incoming call as a nuisance call or not.
+ * <p>
+ * Where the user has chosen a {@link CallScreeningService} to fill the call screening role,
+ * Telecom will notify that {@link CallScreeningService} of the user's report.
+ * <p>
+ * Requires that the caller is the default dialer app.
+ *
+ * @param handle The phone number of an incoming call which the user is reporting as either a
+ * nuisance of non-nuisance call.
+ * @param isNuisanceCall {@code true} if the user is reporting the call as a nuisance call,
+ * {@code false} if the user is reporting the call as a non-nuisance call.
+ */
+ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
+ public void reportNuisanceCallStatus(@NonNull Uri handle, boolean isNuisanceCall) {
+ ITelecomService service = getTelecomService();
+ if (service != null) {
+ try {
+ service.reportNuisanceCallStatus(handle, isNuisanceCall,
+ mContext.getOpPackageName());
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecomService#showCallScreen", e);
+ }
+ }
+ }
+
+ /**
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
* @hide