diff options
author | Yorke Lee <yorkelee@google.com> | 2015-04-23 23:49:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-23 23:49:24 +0000 |
commit | 29738688859120f254b3c7e76ae42f51c7e7d04a (patch) | |
tree | cc8c531d4314c67c403b6713e9a0297b01c90f3f /telecomm | |
parent | 9e29086d5df800532e736d8f31e2b9159b102524 (diff) | |
parent | 3e56ba14cc1533ec2585994066b238f0e2c7f59a (diff) | |
download | frameworks_base-29738688859120f254b3c7e76ae42f51c7e7d04a.zip frameworks_base-29738688859120f254b3c7e76ae42f51c7e7d04a.tar.gz frameworks_base-29738688859120f254b3c7e76ae42f51c7e7d04a.tar.bz2 |
Merge "Add TelecomManager.placeCall"
Diffstat (limited to 'telecomm')
-rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 34 | ||||
-rw-r--r-- | telecomm/java/com/android/internal/telecom/ITelecomService.aidl | 5 |
2 files changed, 39 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index a72172c..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; @@ -1057,6 +1058,39 @@ public class TelecomManager { } } + /** + * 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)); } diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 727fd4b..45b2482 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -210,4 +210,9 @@ interface ITelecomService { * @see TelecomServiceImpl#addNewUnknownCall */ void addNewUnknownCall(in PhoneAccountHandle phoneAccount, in Bundle extras); + + /** + * @see TelecomServiceImpl#placeCall + */ + void placeCall(in Uri handle, in Bundle extras, String callingPackage); } |