summaryrefslogtreecommitdiffstats
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.java87
1 files changed, 70 insertions, 17 deletions
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index c73f6c2..fd95327 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -17,6 +17,7 @@ package android.telecom;
import android.annotation.SystemApi;
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
@@ -75,12 +76,24 @@ public class TelecomManager {
"android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
/**
+ * The {@link android.content.Intent} action used to show the call accessibility settings page.
+ */
+ public static final String ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS =
+ "android.telecom.action.SHOW_CALL_ACCESSIBILITY_SETTINGS";
+
+ /**
* The {@link android.content.Intent} action used to show the call settings page.
*/
public static final String ACTION_SHOW_CALL_SETTINGS =
"android.telecom.action.SHOW_CALL_SETTINGS";
/**
+ * The {@link android.content.Intent} action used to show the respond via SMS settings page.
+ */
+ public static final String ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS =
+ "android.telecom.action.SHOW_RESPOND_VIA_SMS_SETTINGS";
+
+ /**
* The {@link android.content.Intent} action used to show the settings page used to configure
* {@link PhoneAccount} preferences.
*/
@@ -347,7 +360,8 @@ public class TelecomManager {
public PhoneAccountHandle getDefaultOutgoingPhoneAccount(String uriScheme) {
try {
if (isServiceConnected()) {
- return getTelecomService().getDefaultOutgoingPhoneAccount(uriScheme);
+ return getTelecomService().getDefaultOutgoingPhoneAccount(uriScheme,
+ mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#getDefaultOutgoingPhoneAccount", e);
@@ -431,7 +445,7 @@ public class TelecomManager {
public List<PhoneAccountHandle> getSimCallManagers() {
try {
if (isServiceConnected()) {
- return getTelecomService().getSimCallManagers();
+ return getTelecomService().getSimCallManagers(mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#getSimCallManagers");
@@ -479,7 +493,8 @@ public class TelecomManager {
public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme) {
try {
if (isServiceConnected()) {
- return getTelecomService().getPhoneAccountsSupportingScheme(uriScheme);
+ return getTelecomService().getPhoneAccountsSupportingScheme(uriScheme,
+ mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#getPhoneAccountsSupportingScheme", e);
@@ -494,11 +509,12 @@ public class TelecomManager {
*
* @see #EXTRA_PHONE_ACCOUNT_HANDLE
* @return A list of {@code PhoneAccountHandle} objects.
+ *
*/
public List<PhoneAccountHandle> getCallCapablePhoneAccounts() {
try {
if (isServiceConnected()) {
- return getTelecomService().getCallCapablePhoneAccounts();
+ return getTelecomService().getCallCapablePhoneAccounts(mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts", e);
@@ -698,7 +714,8 @@ public class TelecomManager {
public boolean isVoiceMailNumber(PhoneAccountHandle accountHandle, String number) {
try {
if (isServiceConnected()) {
- return getTelecomService().isVoiceMailNumber(accountHandle, number);
+ return getTelecomService().isVoiceMailNumber(accountHandle, number,
+ mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling ITelecomService#isVoiceMailNumber.", e);
@@ -707,20 +724,22 @@ public class TelecomManager {
}
/**
- * Return whether a given phone account has a voicemail number configured.
+ * Return the voicemail number for a given phone account.
*
- * @param accountHandle The handle for the account to check for a voicemail number.
- * @return {@code true} If the given phone account has a voicemail number.
+ * @param accountHandle The handle for the phone account.
+ * @return The voicemail number for the phone account, and {@code null} if one has not been
+ * configured.
*/
- public boolean hasVoiceMailNumber(PhoneAccountHandle accountHandle) {
+ public String getVoiceMailNumber(PhoneAccountHandle accountHandle) {
try {
if (isServiceConnected()) {
- return getTelecomService().hasVoiceMailNumber(accountHandle);
+ return getTelecomService().getVoiceMailNumber(accountHandle,
+ mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling ITelecomService#hasVoiceMailNumber.", e);
}
- return false;
+ return null;
}
/**
@@ -732,7 +751,8 @@ public class TelecomManager {
public String getLine1Number(PhoneAccountHandle accountHandle) {
try {
if (isServiceConnected()) {
- return getTelecomService().getLine1Number(accountHandle);
+ return getTelecomService().getLine1Number(accountHandle,
+ mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling ITelecomService#getLine1Number.", e);
@@ -750,7 +770,7 @@ public class TelecomManager {
public boolean isInCall() {
try {
if (isServiceConnected()) {
- return getTelecomService().isInCall();
+ return getTelecomService().isInCall(mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling isInCall().", e);
@@ -792,7 +812,7 @@ public class TelecomManager {
public boolean isRinging() {
try {
if (isServiceConnected()) {
- return getTelecomService().isRinging();
+ return getTelecomService().isRinging(mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException attempting to get ringing state of phone app.", e);
@@ -858,7 +878,7 @@ public class TelecomManager {
public boolean isTtySupported() {
try {
if (isServiceConnected()) {
- return getTelecomService().isTtySupported();
+ return getTelecomService().isTtySupported(mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException attempting to get TTY supported state.", e);
@@ -879,7 +899,7 @@ public class TelecomManager {
public int getCurrentTtyMode() {
try {
if (isServiceConnected()) {
- return getTelecomService().getCurrentTtyMode();
+ return getTelecomService().getCurrentTtyMode(mContext.getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException attempting to get the current TTY mode.", e);
@@ -1031,13 +1051,46 @@ public class TelecomManager {
ITelecomService service = getTelecomService();
if (service != null) {
try {
- service.showInCallScreen(showDialpad);
+ service.showInCallScreen(showDialpad, mContext.getOpPackageName());
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#showCallScreen", e);
}
}
}
+ /**
+ * Places a new outgoing call to the provided address using the system telecom service with
+ * the specified extras.
+ *
+ * This method is equivalent to placing an outgoing call using {@link Intent#ACTION_CALL},
+ * except that the outgoing call will always be sent via the system telecom service. If
+ * method-caller is either the user selected default dialer app or preloaded system dialer
+ * app, then emergency calls will also be allowed.
+ *
+ * Requires permission: {@link android.Manifest.permission#CALL_PHONE}
+ *
+ * Usage example:
+ * <pre>
+ * Uri uri = Uri.fromParts("tel", "12345", null);
+ * Bundle extras = new Bundle();
+ * extras.putBoolean(TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, true);
+ * telecomManager.placeCall(uri, extras);
+ * </pre>
+ *
+ * @param address The address to make the call to.
+ * @param extras Bundle of extras to use with the call.
+ */
+ public void placeCall(Uri address, Bundle extras) {
+ ITelecomService service = getTelecomService();
+ if (service != null) {
+ try {
+ service.placeCall(address, extras, mContext.getOpPackageName());
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecomService#placeCall", e);
+ }
+ }
+ }
+
private ITelecomService getTelecomService() {
return ITelecomService.Stub.asInterface(ServiceManager.getService(Context.TELECOM_SERVICE));
}