From 6621c917a09d5e20208d9e9a0065a77362df522e Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Thu, 24 Oct 2013 13:07:24 -0700 Subject: Add new phone type (public API) DO NOT MERGE This CL adds a new public API to allow services to implement calls. Change-Id: Ic57f39dfce070cce43c2b4e0f023b0e50ee60718 --- .../java/android/telephony/TelephonyManager.java | 16 ++++ .../android/telephony/ThirdPartyCallListener.java | 89 ++++++++++++++++++++ .../android/telephony/ThirdPartyCallProvider.java | 87 ++++++++++++++++++++ .../android/telephony/ThirdPartyCallService.java | 96 ++++++++++++++++++++++ .../com/android/internal/telephony/ITelephony.aidl | 13 ++- .../telephony/IThirdPartyCallListener.aidl | 46 +++++++++++ .../telephony/IThirdPartyCallProvider.aidl | 41 +++++++++ .../internal/telephony/IThirdPartyCallService.aidl | 35 ++++++++ .../android/internal/telephony/PhoneConstants.java | 1 + .../android/internal/telephony/RILConstants.java | 1 + 10 files changed, 423 insertions(+), 2 deletions(-) create mode 100644 telephony/java/android/telephony/ThirdPartyCallListener.java create mode 100644 telephony/java/android/telephony/ThirdPartyCallProvider.java create mode 100644 telephony/java/android/telephony/ThirdPartyCallService.java create mode 100644 telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl create mode 100644 telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl create mode 100644 telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 8f17e72..b0f7dcf 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -18,6 +18,7 @@ package android.telephony; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.content.ComponentName; import android.content.Context; import android.os.Bundle; import android.os.RemoteException; @@ -1423,6 +1424,21 @@ public class TelephonyManager { } /** + * Inform the phone about a new incoming third party call. The phone will bind to the service + * identified by component to handle the call. + * @param component the component that should handle the intent. + * @param callId the unique id of the call. This id is passed to the service via {@link + * ThirdPartyCallService#incomingCallAttach incomingCallAttach}. + */ + public void newIncomingThirdPartyCall(ComponentName component, String callId) { + try { + getITelephony().newIncomingThirdPartyCall(component, callId); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + } + + /** * Returns the MMS user agent. */ public String getMmsUserAgent() { diff --git a/telephony/java/android/telephony/ThirdPartyCallListener.java b/telephony/java/android/telephony/ThirdPartyCallListener.java new file mode 100644 index 0000000..08f8d3a --- /dev/null +++ b/telephony/java/android/telephony/ThirdPartyCallListener.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.os.Handler; +import android.os.Message; +import android.os.RemoteException; + +import com.android.internal.telephony.IThirdPartyCallListener; + +/** + * Interface provided to {@link android.telephony.ThirdPartyCallService}. The service can use this + * to notify the listener of changes to the call state. + */ +public class ThirdPartyCallListener { + private final IThirdPartyCallListener mListener; + + // Call end reason. + public static final int CALL_END_NORMAL = 1; + public static final int CALL_END_INCOMING_MISSED = 2; + public static final int CALL_END_OTHER = 3; + + public ThirdPartyCallListener(IThirdPartyCallListener listener) { + mListener = listener; + } + + /** + * Called by the service when a call provider is available to perform the outgoing or incoming + * call. + */ + public void onCallProviderAttached(ThirdPartyCallProvider callProvider) { + try { + if (mListener != null) { + mListener.onCallProviderAttached(callProvider.callback); + } + } catch (RemoteException e) { + } + } + + /** + * Notifies the listener that ringing has started for this call. + */ + public void onRingingStarted() { + try { + if (mListener != null) { + mListener.onRingingStarted(); + } + } catch (RemoteException e) { + } + } + + /** + * Notifies the listener that the call has been successfully established. + */ + public void onCallEstablished() { + try { + if (mListener != null) { + mListener.onCallEstablished(); + } + } catch (RemoteException e) { + } + } + + /** + * Notifies the listener that the call has ended. + */ + public void onCallEnded(int reason) { + try { + if (mListener != null) { + mListener.onCallEnded(reason); + } + } catch (RemoteException e) { + } + } +} diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java new file mode 100644 index 0000000..9d3f929 --- /dev/null +++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.os.Handler; +import android.os.Message; + +import com.android.internal.telephony.IThirdPartyCallProvider; + +/** + * Interface sent to {@link android.telephony.ThirdPartyCallListener#onCallProviderAttached + * onCallProviderAttached}. This is used to control an outgoing or an incoming call. + */ +public class ThirdPartyCallProvider { + private static final int MSG_MUTE = 1; + private static final int MSG_HANGUP = 2; + private static final int MSG_INCOMING_CALL_ACCEPT = 3; + + /** + * Mutes or unmutes the call. + */ + public void mute(boolean shouldMute) { + // default implementation empty + } + + /** + * Ends the current call. If this is an unanswered incoming call then the call is rejected. + */ + public void hangup() { + // default implementation empty + } + + /** + * Accepts the incoming call. + */ + public void incomingCallAccept() { + // default implementation empty + } + + final IThirdPartyCallProvider callback = new IThirdPartyCallProvider.Stub() { + @Override + public void mute(boolean shouldMute) { + Message.obtain(mHandler, MSG_MUTE, shouldMute ? 1 : 0, 0).sendToTarget(); + } + + @Override + public void hangup() { + Message.obtain(mHandler, MSG_HANGUP).sendToTarget(); + } + + @Override + public void incomingCallAccept() { + Message.obtain(mHandler, MSG_INCOMING_CALL_ACCEPT).sendToTarget(); + } + }; + + private final Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_MUTE: + mute(msg.arg1 != 0); + break; + case MSG_HANGUP: + hangup(); + break; + case MSG_INCOMING_CALL_ACCEPT: + incomingCallAccept(); + break; + } + } + }; +} diff --git a/telephony/java/android/telephony/ThirdPartyCallService.java b/telephony/java/android/telephony/ThirdPartyCallService.java new file mode 100644 index 0000000..de6c290 --- /dev/null +++ b/telephony/java/android/telephony/ThirdPartyCallService.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.os.Handler; +import android.os.IBinder; +import android.os.Message; +import android.os.RemoteException; +import android.util.Pair; + +import com.android.internal.telephony.IThirdPartyCallListener; +import com.android.internal.telephony.IThirdPartyCallService; + +/** + * Interface provided by a service to start outgoing calls and attach to incoming calls. + */ +public class ThirdPartyCallService { + private static final int MSG_OUTGOING_CALL_INITIATE = 1; + private static final int MSG_INCOMING_CALL_ATTACH = 2; + + /** + * Call to start a new outgoing call. + */ + public void outgoingCallInitiate(ThirdPartyCallListener listener, String number) { + // default implementation empty + } + + /** + * Call to attach to an incoming call. This is in response to a call to {@link + * android.telephony.TelephonyManager#newIncomingThirdPartyCall newIncomingThirdPartyCall}. + */ + public void incomingCallAttach(ThirdPartyCallListener listener, String callId) { + // default implementation empty + } + + /** + * Returns an IBinder instance that can returned from the service's onBind function. + */ + public IBinder getBinder() { + return callback; + } + + private final IThirdPartyCallService.Stub callback = new IThirdPartyCallService.Stub() { + @Override + public void outgoingCallInitiate(IThirdPartyCallListener listener, String number) { + Rlog.w("ThirdPartyPhone", "ThirdPartyCallService.IThirdPartyCallService.out"); + Message.obtain(mHandler, MSG_OUTGOING_CALL_INITIATE, + Pair.create(listener, number)).sendToTarget(); + } + + @Override + public void incomingCallAttach(IThirdPartyCallListener listener, String callId) { + Rlog.w("ThirdPartyPhone", "ThirdPartyCallService.IThirdPartyCallService.in"); + Message.obtain(mHandler, MSG_INCOMING_CALL_ATTACH, + Pair.create(listener, callId)).sendToTarget(); + } + }; + + private final Handler mHandler = new Handler() { + public void handleMessage(Message msg) { + Rlog.w("ThirdPartyPhone", "ThirdPartyCallService.handleMessage: " + msg.what); + switch (msg.what) { + case MSG_OUTGOING_CALL_INITIATE: { + Rlog.w("ThirdPartyPhone", "ThirdPartyCallService.handleMessage out"); + Pair pair = + (Pair) msg.obj; + ThirdPartyCallListener listener = new ThirdPartyCallListener(pair.first); + outgoingCallInitiate(listener, pair.second); + break; + } + case MSG_INCOMING_CALL_ATTACH: { + Rlog.w("ThirdPartyPhone", "ThirdPartyCallService.handleMessage in"); + Pair pair = + (Pair) msg.obj; + ThirdPartyCallListener listener = new ThirdPartyCallListener(pair.first); + incomingCallAttach(listener, pair.second); + break; + } + } + } + }; +} diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 7bd2c84..69a4428 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -17,10 +17,12 @@ package com.android.internal.telephony; import android.os.Bundle; -import java.util.List; +import android.content.ComponentName; import android.telephony.NeighboringCellInfo; import android.telephony.CellInfo; +import java.util.List; + /** * Interface used to interact with the phone. Mostly this is used by the * TelephonyManager class. A few places are still using this directly. @@ -324,5 +326,12 @@ interface ITelephony { * Sets minimum time in milli-seconds between onCellInfoChanged */ void setCellInfoListRate(int rateInMillis); -} + /** + * Inform the phone about a new incoming third party call. The phone will bind to the service + * identified by component to handle the call. + * @param component the component that should handle the intent. + * @param callId the unique id of the call. + */ + void newIncomingThirdPartyCall(in ComponentName component, String callId); +} diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl new file mode 100644 index 0000000..bcf2d81 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.IThirdPartyCallProvider; + +/** + * Interface provided to ThirdPartyCallService. The service can use this to notify the listener of + * changes to the call state. + */ +oneway interface IThirdPartyCallListener { + /** + * Called by the service when a call provider is available to perform the outgoing or incoming + * call. + */ + void onCallProviderAttached(IThirdPartyCallProvider callProvider); + + /** + * Notifies the listener that ringing has started for this call. + */ + void onRingingStarted(); + + /** + * Notifies the listener that the call has been successfully established. + */ + void onCallEstablished(); + + /** + * Notifies the listener that the call has ended. + */ + void onCallEnded(int reason); +} diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl new file mode 100644 index 0000000..dcbf877 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.IThirdPartyCallListener; + +/** + * Interface sent to ThirdPartyCallListener.onCallProviderAttached. This is used to control an + * outgoing or incoming call. + */ +oneway interface IThirdPartyCallProvider { + /** + * Mutes or unmutes the call. + */ + void mute(boolean shouldMute); + + /** + * Ends the current call. If this is an unanswered incoming call then the call is rejected (for + * example, a notification is sent to a server that the user declined the call). + */ + void hangup(); + + /** + * Accepts the incoming call. + */ + void incomingCallAccept(); +} diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl new file mode 100644 index 0000000..597567a --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.IThirdPartyCallListener; + +/** + * Interface provided by a service to start outgoing calls and attach to incoming calls. + */ +oneway interface IThirdPartyCallService { + /** + * Call to start a new outgoing call. + */ + void outgoingCallInitiate(IThirdPartyCallListener listener, String number); + + /** + * Call to attach to an incoming call. This is in response to a call to + * TelephonyManager.newIncomingThirdPartyCall. + */ + void incomingCallAttach(IThirdPartyCallListener listener, String callId); +} diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index 4163255..fe8f031 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -57,6 +57,7 @@ public class PhoneConstants { public static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE; public static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE; public static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE; + public static final int PHONE_TYPE_THIRD_PARTY = RILConstants.THIRD_PARTY_PHONE; // Modes for LTE_ON_CDMA public static final int LTE_ON_CDMA_UNKNOWN = RILConstants.LTE_ON_CDMA_UNKNOWN; diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 821a11c..71c3bec 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -82,6 +82,7 @@ public interface RILConstants { int GSM_PHONE = 1; int CDMA_PHONE = 2; int SIP_PHONE = 3; + int THIRD_PARTY_PHONE = 4; int LTE_ON_CDMA_UNKNOWN = -1; int LTE_ON_CDMA_FALSE = 0; -- cgit v1.1 From 1dc5b4e87bdb7b9d9767aadd15ad25326fb28071 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Wed, 13 Nov 2013 09:14:49 -0800 Subject: ThirdPartyPhone: DTMF & callerDisplayName API DO NOT MERGE This CL extends the ThirdPartyCall API to support DTMF and callerDisplayname. Change-Id: I4bb43273243af6b41d63dde69c982891f160c035 --- telephony/java/android/telephony/TelephonyManager.java | 7 +++++-- .../java/android/telephony/ThirdPartyCallProvider.java | 16 ++++++++++++++++ .../java/com/android/internal/telephony/ITelephony.aidl | 5 ++++- .../internal/telephony/IThirdPartyCallProvider.aidl | 5 +++++ 4 files changed, 30 insertions(+), 3 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b0f7dcf..42b2b8c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1429,10 +1429,13 @@ public class TelephonyManager { * @param component the component that should handle the intent. * @param callId the unique id of the call. This id is passed to the service via {@link * ThirdPartyCallService#incomingCallAttach incomingCallAttach}. + * @param callerDisplayName the name shown to the user. Normally this will be the caller's phone + * number. */ - public void newIncomingThirdPartyCall(ComponentName component, String callId) { + public void newIncomingThirdPartyCall(ComponentName component, String callId, + String callerDisplayName) { try { - getITelephony().newIncomingThirdPartyCall(component, callId); + getITelephony().newIncomingThirdPartyCall(component, callId, callerDisplayName); } catch (RemoteException ex) { } catch (NullPointerException ex) { } diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java index 9d3f929..74b9ae3 100644 --- a/telephony/java/android/telephony/ThirdPartyCallProvider.java +++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java @@ -29,6 +29,7 @@ public class ThirdPartyCallProvider { private static final int MSG_MUTE = 1; private static final int MSG_HANGUP = 2; private static final int MSG_INCOMING_CALL_ACCEPT = 3; + private static final int MSG_SEND_DTMF = 4; /** * Mutes or unmutes the call. @@ -51,6 +52,13 @@ public class ThirdPartyCallProvider { // default implementation empty } + /** + * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. + */ + public void sendDtmf(char c) { + // default implementation empty + } + final IThirdPartyCallProvider callback = new IThirdPartyCallProvider.Stub() { @Override public void mute(boolean shouldMute) { @@ -66,6 +74,11 @@ public class ThirdPartyCallProvider { public void incomingCallAccept() { Message.obtain(mHandler, MSG_INCOMING_CALL_ACCEPT).sendToTarget(); } + + @Override + public void sendDtmf(char c) { + Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0).sendToTarget(); + } }; private final Handler mHandler = new Handler() { @@ -81,6 +94,9 @@ public class ThirdPartyCallProvider { case MSG_INCOMING_CALL_ACCEPT: incomingCallAccept(); break; + case MSG_SEND_DTMF: + sendDtmf((char) msg.arg1); + break; } } }; diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 69a4428..d81cab3 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -332,6 +332,9 @@ interface ITelephony { * identified by component to handle the call. * @param component the component that should handle the intent. * @param callId the unique id of the call. + * @param callerDisplayName the name shown to the user. Normally this will be the caller's phone + * number. */ - void newIncomingThirdPartyCall(in ComponentName component, String callId); + void newIncomingThirdPartyCall(in ComponentName component, String callId, + String callerDisplayName); } diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl index dcbf877..a9d67a4 100644 --- a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl @@ -38,4 +38,9 @@ oneway interface IThirdPartyCallProvider { * Accepts the incoming call. */ void incomingCallAccept(); + + /** + * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. + */ + void sendDtmf(char c); } -- cgit v1.1 From fc2a0a34d64baa9a9c793c68a06d75d8ca0e8e41 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Fri, 15 Nov 2013 13:23:45 -0800 Subject: DO NOT MERGE ThirdPartyCallSendDtmfCallBack API This API is needed to implement post dial. Change-Id: I013382a910948b3934ae128288f47bcf73c68f8c --- .../android/telephony/ThirdPartyCallProvider.java | 11 ++++-- .../telephony/ThirdPartyCallSendDtmfCallback.java | 46 ++++++++++++++++++++++ .../telephony/IThirdPartyCallProvider.aidl | 3 +- .../telephony/IThirdPartyCallSendDtmfCallback.aidl | 27 +++++++++++++ 4 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java create mode 100644 telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl (limited to 'telephony') diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java index 74b9ae3..5054380 100644 --- a/telephony/java/android/telephony/ThirdPartyCallProvider.java +++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java @@ -20,6 +20,7 @@ import android.os.Handler; import android.os.Message; import com.android.internal.telephony.IThirdPartyCallProvider; +import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback; /** * Interface sent to {@link android.telephony.ThirdPartyCallListener#onCallProviderAttached @@ -55,7 +56,7 @@ public class ThirdPartyCallProvider { /** * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. */ - public void sendDtmf(char c) { + public void sendDtmf(char c, ThirdPartyCallSendDtmfCallback callback) { // default implementation empty } @@ -76,8 +77,8 @@ public class ThirdPartyCallProvider { } @Override - public void sendDtmf(char c) { - Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0).sendToTarget(); + public void sendDtmf(char c, IThirdPartyCallSendDtmfCallback callback) { + Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0, callback).sendToTarget(); } }; @@ -95,7 +96,9 @@ public class ThirdPartyCallProvider { incomingCallAccept(); break; case MSG_SEND_DTMF: - sendDtmf((char) msg.arg1); + ThirdPartyCallSendDtmfCallback callback = new ThirdPartyCallSendDtmfCallback( + (IThirdPartyCallSendDtmfCallback) msg.obj); + sendDtmf((char) msg.arg1, callback); break; } } diff --git a/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java b/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java new file mode 100644 index 0000000..5a67cf7 --- /dev/null +++ b/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.os.RemoteException; + +import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback; + +/** + * Callback interface for when DTMF has been sent. + */ +public class ThirdPartyCallSendDtmfCallback { + private final IThirdPartyCallSendDtmfCallback mCallback; + + public ThirdPartyCallSendDtmfCallback(IThirdPartyCallSendDtmfCallback callback) { + if (callback == null) { + throw new IllegalArgumentException("Invalid callback"); + } + mCallback = callback; + } + + /** + * Called by the service when a call provider is available to perform the outgoing or incoming + * call. + */ + public void onSendDtmfCompleted() { + try { + mCallback.onSendDtmfCompleted(); + } catch (RemoteException e) { + } + } +} diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl index a9d67a4..9d595b0 100644 --- a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl @@ -17,6 +17,7 @@ package com.android.internal.telephony; import com.android.internal.telephony.IThirdPartyCallListener; +import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback; /** * Interface sent to ThirdPartyCallListener.onCallProviderAttached. This is used to control an @@ -42,5 +43,5 @@ oneway interface IThirdPartyCallProvider { /** * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. */ - void sendDtmf(char c); + void sendDtmf(char c, IThirdPartyCallSendDtmfCallback callback); } diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl new file mode 100644 index 0000000..3a02b06 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +/** + * Callback interface for when DTMF has been sent. + */ +oneway interface IThirdPartyCallSendDtmfCallback { + /** + * Called when the DTMF code has been sent. + */ + void onSendDtmfCompleted(); +} -- cgit v1.1 From c62180949f3b1a39b2625b3381f998ff60537e46 Mon Sep 17 00:00:00 2001 From: Ihab Awad Date: Mon, 25 Nov 2013 11:31:46 -0800 Subject: Add Wi-Fi calling state setting to telephony interfaces Change-Id: I73e643c00c7c00182cc4650053d098b6e40a8a5f --- .../java/android/telephony/TelephonyManager.java | 42 +++++++++++++++++++++- .../com/android/internal/telephony/ITelephony.aidl | 14 ++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 42b2b8c..37cd4f8 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -24,7 +24,6 @@ import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; -import android.telephony.Rlog; import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.ITelephony; @@ -63,6 +62,20 @@ public class TelephonyManager { private static ITelephonyRegistry sRegistry; private final Context mContext; + /** + * The allowed states of Wi-Fi calling. + * + * @hide + */ + public interface WifiCallingChoices { + /** Always use Wi-Fi calling */ + static final int ALWAYS_USE = 0; + /** Never use Wi-Fi calling */ + static final int NEVER_USE = 1; + /** Ask the user whether to use Wi-Fi on every call */ + static final int ASK_EVERY_TIME = 2; + } + /** @hide */ public TelephonyManager(Context context) { Context appContext = context.getApplicationContext(); @@ -1458,4 +1471,31 @@ public class TelephonyManager { return mContext.getResources().getString( com.android.internal.R.string.config_mms_user_agent_profile_url); } + + /** + * Obtain the current state of Wi-Fi calling. + * + * @hide + * @see android.telephony.TelephonyManager.WifiCallingChoices + */ + public int getWhenToMakeWifiCalls() { + try { + return getITelephony().getWhenToMakeWifiCalls(); + } catch (RemoteException ex) { + return WifiCallingChoices.NEVER_USE; + } + } + + /** + * Set the current state of Wi-Fi calling. + * + * @hide + * @see android.telephony.TelephonyManager.WifiCallingChoices + */ + public void setWhenToMakeWifiCalls(int state) { + try { + getITelephony().setWhenToMakeWifiCalls(state); + } catch (RemoteException ex) { + } + } } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index d81cab3..caa7ff40 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -337,4 +337,18 @@ interface ITelephony { */ void newIncomingThirdPartyCall(in ComponentName component, String callId, String callerDisplayName); + + /** + * Obtain the current state of Wi-Fi calling. + * + * @see android.telephony.TelephonyManager.WifiCallingChoices + */ + int getWhenToMakeWifiCalls(); + + /** + * Set the current state of Wi-Fi calling. + * + * @see android.telephony.TelephonyManager.WifiCallingChoices + */ + void setWhenToMakeWifiCalls(int state); } -- cgit v1.1 From 7647f361b35f11e5a7a071b89f8cbf62fd793cf7 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Wed, 20 Nov 2013 13:22:28 -0800 Subject: Add interface definitions for CallService/PhoneService Interfaces are meant to replace ThirdParty*.aidl/java files in same directory long term. The differences in methods are on purpose and reflect more recent design directions. Change-Id: Ia5ece7149b228a44758e659a4cabfc0676d1c499 --- .../com/android/internal/telephony/CallInfo.aidl | 19 ++++++ .../com/android/internal/telephony/CallInfo.java | 77 ++++++++++++++++++++++ .../android/internal/telephony/ICallService.aidl | 61 +++++++++++++++++ .../internal/telephony/ICallServiceAdapter.aidl | 61 +++++++++++++++++ 4 files changed, 218 insertions(+) create mode 100644 telephony/java/com/android/internal/telephony/CallInfo.aidl create mode 100644 telephony/java/com/android/internal/telephony/CallInfo.java create mode 100644 telephony/java/com/android/internal/telephony/ICallService.aidl create mode 100644 telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl (limited to 'telephony') diff --git a/telephony/java/com/android/internal/telephony/CallInfo.aidl b/telephony/java/com/android/internal/telephony/CallInfo.aidl new file mode 100644 index 0000000..9140388 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CallInfo.aidl @@ -0,0 +1,19 @@ +/* +** Copyright 2013, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package com.android.internal.telephony; + +parcelable CallInfo; diff --git a/telephony/java/com/android/internal/telephony/CallInfo.java b/telephony/java/com/android/internal/telephony/CallInfo.java new file mode 100644 index 0000000..6bfc9d7 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CallInfo.java @@ -0,0 +1,77 @@ +/* +** Copyright 2013, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package com.android.internal.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * A parcelable holder class of Call information data. + */ +public class CallInfo implements Parcelable { + + /** + * Endpoint to which the call is connected. + * This could be the dialed value for outgoing calls or the caller id of incoming calls. + */ + private String handle; + + public CallInfo(String handle) { + this.handle = handle; + } + + public String getHandle() { + return handle; + } + + // + // Parcelling related code below here. + // + + /** + * Responsible for creating CallInfo objects for deserialized Parcels. + */ + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator () { + + @Override + public CallInfo createFromParcel(Parcel source) { + return new CallInfo(source.readString()); + } + + @Override + public CallInfo[] newArray(int size) { + return new CallInfo[size]; + } + }; + + /** + * {@inheritDoc} + */ + @Override + public int describeContents() { + return 0; + } + + /** + * Writes CallInfo object into a serializeable Parcel. + */ + @Override + public void writeToParcel(Parcel destination, int flags) { + destination.writeString(handle); + } +} diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl new file mode 100644 index 0000000..a24c860 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallService.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.ICallServiceAdapter; + +/** + * Service interface for services which would like to provide calls to be + * managed by the system in-call UI. + * + * This interface provides methods that the android framework can use to deliver commands + * for calls provided by this call service including making new calls and disconnecting + * existing ones. A binding to ICallService implementations exists for two conditions: + * 1) There exists one or more live calls for that call service, + * 2) Prior to an outbound call to test if this call service is compatible with the outgoing call. + */ +oneway interface ICallService { + + /** + * Determines if the CallService can make calls to the handle. + * TODO(santoscordon): Move this method into its own service interface long term. + * TODO(santoscordon): Add response callback parameter. + */ + void isCompatibleWith(String handle); + + /** + * Attempts to call the relevant party using the specified handle, be it a phone number, + * SIP address, or some other kind of user ID. Note that the set of handle types is + * dynamically extensible since call providers should be able to implement arbitrary + * handle-calling systems. See {@link #isCompatibleWith}. + * TODO(santoscordon): Should this have a response attached to it to ensure that the call + * service actually plans to make the call? + */ + void call(String handle); + + /** + * Disconnects the call identified by callId. + */ + void disconnect(String callId); + + /** + * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls + * and communicate state changes of existing calls. This is the first method that is called + * after a the framework binds to the call service. + */ + void setCallServiceAdapter(ICallServiceAdapter CallServiceAdapter); +} diff --git a/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl new file mode 100644 index 0000000..bc900f0 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.CallInfo; + +/** + * Provides methods for ICallService implementations to interact with the system phone app. + */ +oneway interface ICallServiceAdapter { + + /** + * Retrieves a new unique call id for use with newOutgoingCall and newIncomingCall. + */ + void getNextCallId(/* TODO(santoscordon): Needs response object */); + + /** + * Tells CallsManager of a new incoming call. + */ + void newIncomingCall(String callId, in CallInfo info); + + /** + * Tells CallsManager of a new outgoing call. + */ + void newOutgoingCall(String callId, in CallInfo info); + + /** + * Sets a call's state to active (e.g., an ongoing call where two parties can actively + * communicate). + */ + void setActive(String callId); + + /** + * Sets a call's state to ringing (e.g., an inbound ringing call). + */ + void setRinging(String callId); + + /** + * Sets a call's state to dialing (e.g., dialing an outbound call). + */ + void setDialing(String callId); + + /** + * Sets a call's state to disconnected. + */ + void setDisconnected(String callId); +} -- cgit v1.1 From d16654f80e5ed5d71fb512ccaf6709e5247805f7 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Tue, 26 Nov 2013 11:50:49 -0800 Subject: Add abstract base implementation of CallService. Base implementation takes care of a lot of boilerplate code. Change-Id: Ic7ee3325f694f7df06d23501d77172b4770551bc --- telephony/java/android/telephony/CallService.java | 165 +++++++++++++++++++++ .../android/internal/telephony/ICallService.aidl | 2 +- 2 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 telephony/java/android/telephony/CallService.java (limited to 'telephony') diff --git a/telephony/java/android/telephony/CallService.java b/telephony/java/android/telephony/CallService.java new file mode 100644 index 0000000..0ea55b2 --- /dev/null +++ b/telephony/java/android/telephony/CallService.java @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.app.Service; +import android.content.Intent; +import android.os.Handler; +import android.os.IBinder; +import android.os.Message; + +import com.android.internal.telephony.ICallService; +import com.android.internal.telephony.ICallServiceAdapter; + +/** + * Base implementation of CallService which can be used to provide calls for the system + * in-call UI. CallService is a one-way service from the framework's CallsManager to any app + * that would like to provide calls managed by the default system in-call user interface. + * When the service is bound by the framework, CallsManager will call setCallServiceAdapter + * which will provide CallService with an instance of {@link CallServiceAdapter} to be used + * for communicating back to CallsManager. Subsequently, more specific methods of the service + * will be called to perform various call actions including making an outgoing call and + * disconnected existing calls. + * TODO(santoscordon): Needs more about AndroidManifest.xml service registrations before + * we can unhide this API. + * + * Most public methods of this function are backed by a one-way AIDL interface which precludes + * syncronous responses. As a result, most responses are handled by (or have TODOs to handle) + * response objects instead of return values. + * TODO(santoscordon): Improve paragraph above once the final design is in place. + * @hide + */ +public abstract class CallService extends Service { + + /** + * Default Handler used to consolidate binder method calls onto a single thread. + */ + private final class CallServiceMessageHandler extends Handler { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_SET_CALL_SERVICE_ADAPTER: + setCallServiceAdapter((ICallServiceAdapter) msg.obj); + break; + case MSG_IS_COMPATIBLE_WITH: + isCompatibleWith((String) msg.obj); + break; + case MSG_CALL: + call((String) msg.obj); + break; + case MSG_DISCONNECT: + disconnect((String) msg.obj); + break; + default: + break; + } + } + } + + /** + * Default ICallService implementation provided to CallsManager via {@link #onBind}. + */ + private final class CallServiceWrapper extends ICallService.Stub { + @Override + public void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter) { + mMessageHandler.obtainMessage(MSG_SET_CALL_SERVICE_ADAPTER, callServiceAdapter) + .sendToTarget(); + } + + @Override + public void isCompatibleWith(String handle) { + mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, handle).sendToTarget(); + } + + @Override + public void call(String handle) { + mMessageHandler.obtainMessage(MSG_CALL, handle).sendToTarget(); + } + + @Override + public void disconnect(String callId) { + mMessageHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget(); + } + } + + // Only used internally by this class. + // Binder method calls on this service can occur on multiple threads. These messages are used + // in conjunction with {@link #mMessageHandler} to ensure that all callbacks are handled on a + // single thread. Keeping it on a single thread allows CallService implementations to avoid + // needing multi-threaded code in their own callback routines. + private static final int + MSG_SET_CALL_SERVICE_ADAPTER = 1, + MSG_IS_COMPATIBLE_WITH = 2, + MSG_CALL = 3, + MSG_DISCONNECT = 4; + + /** + * Message handler for consolidating binder callbacks onto a single thread. + * See {@link #CallServiceMessageHandler}. + */ + private final CallServiceMessageHandler mMessageHandler; + + /** + * Default binder implementation of {@link ICallService} interface. + */ + private final CallServiceWrapper mBinder; + + /** + * Protected constructor called only by subclasses creates the binder interface and + * single-threaded message handler. + */ + protected CallService() { + mMessageHandler = new CallServiceMessageHandler(); + mBinder = new CallServiceWrapper(); + } + + /** {@inheritDoc} */ + public IBinder onBind(Intent intent) { + return mBinder; + } + + /** + * Sets an implementation of ICallServiceAdapter for adding new calls and communicating state + * changes of existing calls. + * @param callServiceAdapter Adapter object for communicating call to CallsManager + * TODO(santoscordon): Should we not reference ICallServiceAdapter directly from here? Should we + * wrap that in a wrapper like we do for CallService/ICallService? + * TODO(santoscordon): Consider rename of CallServiceAdapter to CallsManager. + */ + public abstract void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); + + /** + * Determines if the CallService can make calls to the handle. + * @param handle The handle to test for compatibility. + * TODO(santoscordon): Need response parameter. + */ + public abstract void isCompatibleWith(String handle); + + /** + * Calls the specified handle. Handle type is dynamically extensible and can be a phone number, + * a SIP address, or other types. Only called if {@link #isCompatibleWith} returns true for the + * same handle and this service is selected by the switchboard to handle the call. + * @param handle The handle to call. + */ + public abstract void call(String handle); + + /** + * Disconnects the specified call. + * @param callId The ID of the call to disconnect. + */ + public abstract void disconnect(String callId); +} diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl index a24c860..cb9b2e8 100644 --- a/telephony/java/com/android/internal/telephony/ICallService.aidl +++ b/telephony/java/com/android/internal/telephony/ICallService.aidl @@ -57,5 +57,5 @@ oneway interface ICallService { * and communicate state changes of existing calls. This is the first method that is called * after a the framework binds to the call service. */ - void setCallServiceAdapter(ICallServiceAdapter CallServiceAdapter); + void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); } -- cgit v1.1 From c8712b6e2297f8b86045b885d3f8cdf28d7ec462 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Mon, 16 Dec 2013 16:27:43 -0800 Subject: Update TelephonyManager.WifiCallingChoices API This CL updates the order of the WifiCallingChoices values to match the wifi_calling_choice_values resource. Change-Id: Ib314bc44073fdc416b15926cec2aca91aedba08f --- telephony/java/android/telephony/TelephonyManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 37cd4f8..f1ed0a2 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -70,10 +70,10 @@ public class TelephonyManager { public interface WifiCallingChoices { /** Always use Wi-Fi calling */ static final int ALWAYS_USE = 0; - /** Never use Wi-Fi calling */ - static final int NEVER_USE = 1; /** Ask the user whether to use Wi-Fi on every call */ - static final int ASK_EVERY_TIME = 2; + static final int ASK_EVERY_TIME = 1; + /** Never use Wi-Fi calling */ + static final int NEVER_USE = 2; } /** @hide */ -- cgit v1.1 From 0590ac70a93c713c6cf28c3bcbce287d9864f037 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 21:27:13 -0800 Subject: Add new phone type (public API) DO NOT MERGE This CL adds a new public API to allow services to implement calls. Change-Id: If6fef93aebc8b199880ad44d35b7d8ae69f71f9e --- .../java/android/telephony/TelephonyManager.java | 16 +++++++++++++++ .../android/telephony/ThirdPartyCallListener.java | 23 ++++++++++++++-------- .../android/telephony/ThirdPartyCallProvider.java | 22 +-------------------- .../android/telephony/ThirdPartyCallService.java | 8 +++++--- 4 files changed, 37 insertions(+), 32 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 3d416fb..2723118 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -18,6 +18,7 @@ package android.telephony; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.content.ComponentName; import android.content.Context; import android.os.Bundle; import android.os.RemoteException; @@ -1422,6 +1423,21 @@ public class TelephonyManager { } /** + * Inform the phone about a new incoming third party call. The phone will bind to the service + * identified by component to handle the call. + * @param component the component that should handle the intent. + * @param callId the unique id of the call. This id is passed to the service via {@link + * ThirdPartyCallService#incomingCallAttach incomingCallAttach}. + */ + public void newIncomingThirdPartyCall(ComponentName component, String callId) { + try { + getITelephony().newIncomingThirdPartyCall(component, callId); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + } + + /** * Returns the MMS user agent. */ public String getMmsUserAgent() { diff --git a/telephony/java/android/telephony/ThirdPartyCallListener.java b/telephony/java/android/telephony/ThirdPartyCallListener.java index 00265f8..08f8d3a 100644 --- a/telephony/java/android/telephony/ThirdPartyCallListener.java +++ b/telephony/java/android/telephony/ThirdPartyCallListener.java @@ -16,6 +16,8 @@ package android.telephony; +import android.os.Handler; +import android.os.Message; import android.os.RemoteException; import com.android.internal.telephony.IThirdPartyCallListener; @@ -27,15 +29,12 @@ import com.android.internal.telephony.IThirdPartyCallListener; public class ThirdPartyCallListener { private final IThirdPartyCallListener mListener; - // Call end reason. TODO: rename this to DisconnectCause once they are public. + // Call end reason. public static final int CALL_END_NORMAL = 1; public static final int CALL_END_INCOMING_MISSED = 2; public static final int CALL_END_OTHER = 3; public ThirdPartyCallListener(IThirdPartyCallListener listener) { - if (listener == null) { - throw new IllegalArgumentException("Invalid listener"); - } mListener = listener; } @@ -45,7 +44,9 @@ public class ThirdPartyCallListener { */ public void onCallProviderAttached(ThirdPartyCallProvider callProvider) { try { - mListener.onCallProviderAttached(callProvider.getCallback()); + if (mListener != null) { + mListener.onCallProviderAttached(callProvider.callback); + } } catch (RemoteException e) { } } @@ -55,7 +56,9 @@ public class ThirdPartyCallListener { */ public void onRingingStarted() { try { - mListener.onRingingStarted(); + if (mListener != null) { + mListener.onRingingStarted(); + } } catch (RemoteException e) { } } @@ -65,7 +68,9 @@ public class ThirdPartyCallListener { */ public void onCallEstablished() { try { - mListener.onCallEstablished(); + if (mListener != null) { + mListener.onCallEstablished(); + } } catch (RemoteException e) { } } @@ -75,7 +80,9 @@ public class ThirdPartyCallListener { */ public void onCallEnded(int reason) { try { - mListener.onCallEnded(reason); + if (mListener != null) { + mListener.onCallEnded(reason); + } } catch (RemoteException e) { } } diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java index bd8a1ea..9d3f929 100644 --- a/telephony/java/android/telephony/ThirdPartyCallProvider.java +++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java @@ -29,7 +29,6 @@ public class ThirdPartyCallProvider { private static final int MSG_MUTE = 1; private static final int MSG_HANGUP = 2; private static final int MSG_INCOMING_CALL_ACCEPT = 3; - private static final int MSG_SEND_DTMF = 4; /** * Mutes or unmutes the call. @@ -52,18 +51,7 @@ public class ThirdPartyCallProvider { // default implementation empty } - /** - * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. - */ - public void sendDtmf(char c) { - // default implementation empty - } - - IThirdPartyCallProvider getCallback() { - return mCallback; - } - - private final IThirdPartyCallProvider mCallback = new IThirdPartyCallProvider.Stub() { + final IThirdPartyCallProvider callback = new IThirdPartyCallProvider.Stub() { @Override public void mute(boolean shouldMute) { Message.obtain(mHandler, MSG_MUTE, shouldMute ? 1 : 0, 0).sendToTarget(); @@ -78,11 +66,6 @@ public class ThirdPartyCallProvider { public void incomingCallAccept() { Message.obtain(mHandler, MSG_INCOMING_CALL_ACCEPT).sendToTarget(); } - - @Override - public void sendDtmf(char c) { - Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0).sendToTarget(); - } }; private final Handler mHandler = new Handler() { @@ -98,9 +81,6 @@ public class ThirdPartyCallProvider { case MSG_INCOMING_CALL_ACCEPT: incomingCallAccept(); break; - case MSG_SEND_DTMF: - sendDtmf((char) msg.arg1); - break; } } }; diff --git a/telephony/java/android/telephony/ThirdPartyCallService.java b/telephony/java/android/telephony/ThirdPartyCallService.java index 6eddb43..de6c290 100644 --- a/telephony/java/android/telephony/ThirdPartyCallService.java +++ b/telephony/java/android/telephony/ThirdPartyCallService.java @@ -19,6 +19,7 @@ package android.telephony; import android.os.Handler; import android.os.IBinder; import android.os.Message; +import android.os.RemoteException; import android.util.Pair; import com.android.internal.telephony.IThirdPartyCallListener; @@ -39,7 +40,8 @@ public class ThirdPartyCallService { } /** - * Call to attach to an incoming call. + * Call to attach to an incoming call. This is in response to a call to {@link + * android.telephony.TelephonyManager#newIncomingThirdPartyCall newIncomingThirdPartyCall}. */ public void incomingCallAttach(ThirdPartyCallListener listener, String callId) { // default implementation empty @@ -49,10 +51,10 @@ public class ThirdPartyCallService { * Returns an IBinder instance that can returned from the service's onBind function. */ public IBinder getBinder() { - return mCallback; + return callback; } - private final IThirdPartyCallService.Stub mCallback = new IThirdPartyCallService.Stub() { + private final IThirdPartyCallService.Stub callback = new IThirdPartyCallService.Stub() { @Override public void outgoingCallInitiate(IThirdPartyCallListener listener, String number) { Rlog.w("ThirdPartyPhone", "ThirdPartyCallService.IThirdPartyCallService.out"); -- cgit v1.1 From b47ed4f44a8ef802143fbc68d24384b4847ad834 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Wed, 12 Feb 2014 06:02:26 +0000 Subject: Revert "Add new phone type (public API) DO NOT MERGE" This reverts commit 0590ac70a93c713c6cf28c3bcbce287d9864f037. Change-Id: I1f4b34c0f8246bb601e2ba5f14eabe9c36d33d94 --- .../java/android/telephony/TelephonyManager.java | 16 --------------- .../android/telephony/ThirdPartyCallListener.java | 23 ++++++++-------------- .../android/telephony/ThirdPartyCallProvider.java | 22 ++++++++++++++++++++- .../android/telephony/ThirdPartyCallService.java | 8 +++----- 4 files changed, 32 insertions(+), 37 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 2723118..3d416fb 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -18,7 +18,6 @@ package android.telephony; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; -import android.content.ComponentName; import android.content.Context; import android.os.Bundle; import android.os.RemoteException; @@ -1423,21 +1422,6 @@ public class TelephonyManager { } /** - * Inform the phone about a new incoming third party call. The phone will bind to the service - * identified by component to handle the call. - * @param component the component that should handle the intent. - * @param callId the unique id of the call. This id is passed to the service via {@link - * ThirdPartyCallService#incomingCallAttach incomingCallAttach}. - */ - public void newIncomingThirdPartyCall(ComponentName component, String callId) { - try { - getITelephony().newIncomingThirdPartyCall(component, callId); - } catch (RemoteException ex) { - } catch (NullPointerException ex) { - } - } - - /** * Returns the MMS user agent. */ public String getMmsUserAgent() { diff --git a/telephony/java/android/telephony/ThirdPartyCallListener.java b/telephony/java/android/telephony/ThirdPartyCallListener.java index 08f8d3a..00265f8 100644 --- a/telephony/java/android/telephony/ThirdPartyCallListener.java +++ b/telephony/java/android/telephony/ThirdPartyCallListener.java @@ -16,8 +16,6 @@ package android.telephony; -import android.os.Handler; -import android.os.Message; import android.os.RemoteException; import com.android.internal.telephony.IThirdPartyCallListener; @@ -29,12 +27,15 @@ import com.android.internal.telephony.IThirdPartyCallListener; public class ThirdPartyCallListener { private final IThirdPartyCallListener mListener; - // Call end reason. + // Call end reason. TODO: rename this to DisconnectCause once they are public. public static final int CALL_END_NORMAL = 1; public static final int CALL_END_INCOMING_MISSED = 2; public static final int CALL_END_OTHER = 3; public ThirdPartyCallListener(IThirdPartyCallListener listener) { + if (listener == null) { + throw new IllegalArgumentException("Invalid listener"); + } mListener = listener; } @@ -44,9 +45,7 @@ public class ThirdPartyCallListener { */ public void onCallProviderAttached(ThirdPartyCallProvider callProvider) { try { - if (mListener != null) { - mListener.onCallProviderAttached(callProvider.callback); - } + mListener.onCallProviderAttached(callProvider.getCallback()); } catch (RemoteException e) { } } @@ -56,9 +55,7 @@ public class ThirdPartyCallListener { */ public void onRingingStarted() { try { - if (mListener != null) { - mListener.onRingingStarted(); - } + mListener.onRingingStarted(); } catch (RemoteException e) { } } @@ -68,9 +65,7 @@ public class ThirdPartyCallListener { */ public void onCallEstablished() { try { - if (mListener != null) { - mListener.onCallEstablished(); - } + mListener.onCallEstablished(); } catch (RemoteException e) { } } @@ -80,9 +75,7 @@ public class ThirdPartyCallListener { */ public void onCallEnded(int reason) { try { - if (mListener != null) { - mListener.onCallEnded(reason); - } + mListener.onCallEnded(reason); } catch (RemoteException e) { } } diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java index 9d3f929..bd8a1ea 100644 --- a/telephony/java/android/telephony/ThirdPartyCallProvider.java +++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java @@ -29,6 +29,7 @@ public class ThirdPartyCallProvider { private static final int MSG_MUTE = 1; private static final int MSG_HANGUP = 2; private static final int MSG_INCOMING_CALL_ACCEPT = 3; + private static final int MSG_SEND_DTMF = 4; /** * Mutes or unmutes the call. @@ -51,7 +52,18 @@ public class ThirdPartyCallProvider { // default implementation empty } - final IThirdPartyCallProvider callback = new IThirdPartyCallProvider.Stub() { + /** + * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. + */ + public void sendDtmf(char c) { + // default implementation empty + } + + IThirdPartyCallProvider getCallback() { + return mCallback; + } + + private final IThirdPartyCallProvider mCallback = new IThirdPartyCallProvider.Stub() { @Override public void mute(boolean shouldMute) { Message.obtain(mHandler, MSG_MUTE, shouldMute ? 1 : 0, 0).sendToTarget(); @@ -66,6 +78,11 @@ public class ThirdPartyCallProvider { public void incomingCallAccept() { Message.obtain(mHandler, MSG_INCOMING_CALL_ACCEPT).sendToTarget(); } + + @Override + public void sendDtmf(char c) { + Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0).sendToTarget(); + } }; private final Handler mHandler = new Handler() { @@ -81,6 +98,9 @@ public class ThirdPartyCallProvider { case MSG_INCOMING_CALL_ACCEPT: incomingCallAccept(); break; + case MSG_SEND_DTMF: + sendDtmf((char) msg.arg1); + break; } } }; diff --git a/telephony/java/android/telephony/ThirdPartyCallService.java b/telephony/java/android/telephony/ThirdPartyCallService.java index de6c290..6eddb43 100644 --- a/telephony/java/android/telephony/ThirdPartyCallService.java +++ b/telephony/java/android/telephony/ThirdPartyCallService.java @@ -19,7 +19,6 @@ package android.telephony; import android.os.Handler; import android.os.IBinder; import android.os.Message; -import android.os.RemoteException; import android.util.Pair; import com.android.internal.telephony.IThirdPartyCallListener; @@ -40,8 +39,7 @@ public class ThirdPartyCallService { } /** - * Call to attach to an incoming call. This is in response to a call to {@link - * android.telephony.TelephonyManager#newIncomingThirdPartyCall newIncomingThirdPartyCall}. + * Call to attach to an incoming call. */ public void incomingCallAttach(ThirdPartyCallListener listener, String callId) { // default implementation empty @@ -51,10 +49,10 @@ public class ThirdPartyCallService { * Returns an IBinder instance that can returned from the service's onBind function. */ public IBinder getBinder() { - return callback; + return mCallback; } - private final IThirdPartyCallService.Stub callback = new IThirdPartyCallService.Stub() { + private final IThirdPartyCallService.Stub mCallback = new IThirdPartyCallService.Stub() { @Override public void outgoingCallInitiate(IThirdPartyCallListener listener, String number) { Rlog.w("ThirdPartyPhone", "ThirdPartyCallService.IThirdPartyCallService.out"); -- cgit v1.1 From aae9216320328e6b865725219a31a029ea46c1b0 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:08:33 -0800 Subject: Add new phone type (public API) DO NOT MERGE This CL adds a new public API to allow services to implement calls. Change-Id: I4d30eb4d91bd342506cad4ced059bd8446c2bec4 --- .../java/android/telephony/TelephonyManager.java | 16 +++++++++++++++ .../android/telephony/ThirdPartyCallListener.java | 23 ++++++++++++++-------- .../android/telephony/ThirdPartyCallProvider.java | 22 +-------------------- .../android/telephony/ThirdPartyCallService.java | 8 +++++--- .../com/android/internal/telephony/ITelephony.aidl | 12 ++++++++++- .../telephony/IThirdPartyCallProvider.aidl | 5 ----- .../internal/telephony/IThirdPartyCallService.aidl | 3 ++- .../android/internal/telephony/PhoneConstants.java | 1 + .../android/internal/telephony/RILConstants.java | 1 + 9 files changed, 52 insertions(+), 39 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 3d416fb..2723118 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -18,6 +18,7 @@ package android.telephony; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.content.ComponentName; import android.content.Context; import android.os.Bundle; import android.os.RemoteException; @@ -1422,6 +1423,21 @@ public class TelephonyManager { } /** + * Inform the phone about a new incoming third party call. The phone will bind to the service + * identified by component to handle the call. + * @param component the component that should handle the intent. + * @param callId the unique id of the call. This id is passed to the service via {@link + * ThirdPartyCallService#incomingCallAttach incomingCallAttach}. + */ + public void newIncomingThirdPartyCall(ComponentName component, String callId) { + try { + getITelephony().newIncomingThirdPartyCall(component, callId); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + } + + /** * Returns the MMS user agent. */ public String getMmsUserAgent() { diff --git a/telephony/java/android/telephony/ThirdPartyCallListener.java b/telephony/java/android/telephony/ThirdPartyCallListener.java index 00265f8..08f8d3a 100644 --- a/telephony/java/android/telephony/ThirdPartyCallListener.java +++ b/telephony/java/android/telephony/ThirdPartyCallListener.java @@ -16,6 +16,8 @@ package android.telephony; +import android.os.Handler; +import android.os.Message; import android.os.RemoteException; import com.android.internal.telephony.IThirdPartyCallListener; @@ -27,15 +29,12 @@ import com.android.internal.telephony.IThirdPartyCallListener; public class ThirdPartyCallListener { private final IThirdPartyCallListener mListener; - // Call end reason. TODO: rename this to DisconnectCause once they are public. + // Call end reason. public static final int CALL_END_NORMAL = 1; public static final int CALL_END_INCOMING_MISSED = 2; public static final int CALL_END_OTHER = 3; public ThirdPartyCallListener(IThirdPartyCallListener listener) { - if (listener == null) { - throw new IllegalArgumentException("Invalid listener"); - } mListener = listener; } @@ -45,7 +44,9 @@ public class ThirdPartyCallListener { */ public void onCallProviderAttached(ThirdPartyCallProvider callProvider) { try { - mListener.onCallProviderAttached(callProvider.getCallback()); + if (mListener != null) { + mListener.onCallProviderAttached(callProvider.callback); + } } catch (RemoteException e) { } } @@ -55,7 +56,9 @@ public class ThirdPartyCallListener { */ public void onRingingStarted() { try { - mListener.onRingingStarted(); + if (mListener != null) { + mListener.onRingingStarted(); + } } catch (RemoteException e) { } } @@ -65,7 +68,9 @@ public class ThirdPartyCallListener { */ public void onCallEstablished() { try { - mListener.onCallEstablished(); + if (mListener != null) { + mListener.onCallEstablished(); + } } catch (RemoteException e) { } } @@ -75,7 +80,9 @@ public class ThirdPartyCallListener { */ public void onCallEnded(int reason) { try { - mListener.onCallEnded(reason); + if (mListener != null) { + mListener.onCallEnded(reason); + } } catch (RemoteException e) { } } diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java index bd8a1ea..9d3f929 100644 --- a/telephony/java/android/telephony/ThirdPartyCallProvider.java +++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java @@ -29,7 +29,6 @@ public class ThirdPartyCallProvider { private static final int MSG_MUTE = 1; private static final int MSG_HANGUP = 2; private static final int MSG_INCOMING_CALL_ACCEPT = 3; - private static final int MSG_SEND_DTMF = 4; /** * Mutes or unmutes the call. @@ -52,18 +51,7 @@ public class ThirdPartyCallProvider { // default implementation empty } - /** - * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. - */ - public void sendDtmf(char c) { - // default implementation empty - } - - IThirdPartyCallProvider getCallback() { - return mCallback; - } - - private final IThirdPartyCallProvider mCallback = new IThirdPartyCallProvider.Stub() { + final IThirdPartyCallProvider callback = new IThirdPartyCallProvider.Stub() { @Override public void mute(boolean shouldMute) { Message.obtain(mHandler, MSG_MUTE, shouldMute ? 1 : 0, 0).sendToTarget(); @@ -78,11 +66,6 @@ public class ThirdPartyCallProvider { public void incomingCallAccept() { Message.obtain(mHandler, MSG_INCOMING_CALL_ACCEPT).sendToTarget(); } - - @Override - public void sendDtmf(char c) { - Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0).sendToTarget(); - } }; private final Handler mHandler = new Handler() { @@ -98,9 +81,6 @@ public class ThirdPartyCallProvider { case MSG_INCOMING_CALL_ACCEPT: incomingCallAccept(); break; - case MSG_SEND_DTMF: - sendDtmf((char) msg.arg1); - break; } } }; diff --git a/telephony/java/android/telephony/ThirdPartyCallService.java b/telephony/java/android/telephony/ThirdPartyCallService.java index 6eddb43..de6c290 100644 --- a/telephony/java/android/telephony/ThirdPartyCallService.java +++ b/telephony/java/android/telephony/ThirdPartyCallService.java @@ -19,6 +19,7 @@ package android.telephony; import android.os.Handler; import android.os.IBinder; import android.os.Message; +import android.os.RemoteException; import android.util.Pair; import com.android.internal.telephony.IThirdPartyCallListener; @@ -39,7 +40,8 @@ public class ThirdPartyCallService { } /** - * Call to attach to an incoming call. + * Call to attach to an incoming call. This is in response to a call to {@link + * android.telephony.TelephonyManager#newIncomingThirdPartyCall newIncomingThirdPartyCall}. */ public void incomingCallAttach(ThirdPartyCallListener listener, String callId) { // default implementation empty @@ -49,10 +51,10 @@ public class ThirdPartyCallService { * Returns an IBinder instance that can returned from the service's onBind function. */ public IBinder getBinder() { - return mCallback; + return callback; } - private final IThirdPartyCallService.Stub mCallback = new IThirdPartyCallService.Stub() { + private final IThirdPartyCallService.Stub callback = new IThirdPartyCallService.Stub() { @Override public void outgoingCallInitiate(IThirdPartyCallListener listener, String number) { Rlog.w("ThirdPartyPhone", "ThirdPartyCallService.IThirdPartyCallService.out"); diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 370e27a..eb6c66f 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -17,10 +17,12 @@ package com.android.internal.telephony; import android.os.Bundle; -import java.util.List; +import android.content.ComponentName; import android.telephony.NeighboringCellInfo; import android.telephony.CellInfo; +import java.util.List; + /** * Interface used to interact with the phone. Mostly this is used by the * TelephonyManager class. A few places are still using this directly. @@ -412,4 +414,12 @@ interface ITelephony { * @return true on success; false on any failure. */ boolean setRadioMode(int radioMode); + + /** + * Inform the phone about a new incoming third party call. The phone will bind to the service + * identified by component to handle the call. + * @param component the component that should handle the intent. + * @param callId the unique id of the call. + */ + void newIncomingThirdPartyCall(in ComponentName component, String callId); } diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl index a9d67a4..dcbf877 100644 --- a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl @@ -38,9 +38,4 @@ oneway interface IThirdPartyCallProvider { * Accepts the incoming call. */ void incomingCallAccept(); - - /** - * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. - */ - void sendDtmf(char c); } diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl index c9ee4ed..597567a 100644 --- a/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl @@ -28,7 +28,8 @@ oneway interface IThirdPartyCallService { void outgoingCallInitiate(IThirdPartyCallListener listener, String number); /** - * Call to attach to an incoming call. + * Call to attach to an incoming call. This is in response to a call to + * TelephonyManager.newIncomingThirdPartyCall. */ void incomingCallAttach(IThirdPartyCallListener listener, String callId); } diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index fc6c997..ade024f 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -57,6 +57,7 @@ public class PhoneConstants { public static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE; public static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE; public static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE; + public static final int PHONE_TYPE_THIRD_PARTY = RILConstants.THIRD_PARTY_PHONE; // Modes for LTE_ON_CDMA public static final int LTE_ON_CDMA_UNKNOWN = RILConstants.LTE_ON_CDMA_UNKNOWN; diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 6015df0..b8b90ee 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -84,6 +84,7 @@ public interface RILConstants { int GSM_PHONE = 1; int CDMA_PHONE = 2; int SIP_PHONE = 3; + int THIRD_PARTY_PHONE = 4; int LTE_ON_CDMA_UNKNOWN = -1; int LTE_ON_CDMA_FALSE = 0; -- cgit v1.1 From 960fe9a5ff2a629d62e3252a37e4ec598af54b6a Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:18:35 -0800 Subject: ThirdPartyPhone: DTMF & callerDisplayName API DO NOT MERGE This CL extends the ThirdPartyCall API to support DTMF and callerDisplayname. Change-Id: Ia3b4730e852a95d0c11fbddfbe1b780aec39dbb5 --- telephony/java/android/telephony/TelephonyManager.java | 7 +++++-- .../java/android/telephony/ThirdPartyCallProvider.java | 16 ++++++++++++++++ .../java/com/android/internal/telephony/ITelephony.aidl | 5 ++++- .../internal/telephony/IThirdPartyCallProvider.aidl | 5 +++++ 4 files changed, 30 insertions(+), 3 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 2723118..0e54d0f 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1428,10 +1428,13 @@ public class TelephonyManager { * @param component the component that should handle the intent. * @param callId the unique id of the call. This id is passed to the service via {@link * ThirdPartyCallService#incomingCallAttach incomingCallAttach}. + * @param callerDisplayName the name shown to the user. Normally this will be the caller's phone + * number. */ - public void newIncomingThirdPartyCall(ComponentName component, String callId) { + public void newIncomingThirdPartyCall(ComponentName component, String callId, + String callerDisplayName) { try { - getITelephony().newIncomingThirdPartyCall(component, callId); + getITelephony().newIncomingThirdPartyCall(component, callId, callerDisplayName); } catch (RemoteException ex) { } catch (NullPointerException ex) { } diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java index 9d3f929..74b9ae3 100644 --- a/telephony/java/android/telephony/ThirdPartyCallProvider.java +++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java @@ -29,6 +29,7 @@ public class ThirdPartyCallProvider { private static final int MSG_MUTE = 1; private static final int MSG_HANGUP = 2; private static final int MSG_INCOMING_CALL_ACCEPT = 3; + private static final int MSG_SEND_DTMF = 4; /** * Mutes or unmutes the call. @@ -51,6 +52,13 @@ public class ThirdPartyCallProvider { // default implementation empty } + /** + * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. + */ + public void sendDtmf(char c) { + // default implementation empty + } + final IThirdPartyCallProvider callback = new IThirdPartyCallProvider.Stub() { @Override public void mute(boolean shouldMute) { @@ -66,6 +74,11 @@ public class ThirdPartyCallProvider { public void incomingCallAccept() { Message.obtain(mHandler, MSG_INCOMING_CALL_ACCEPT).sendToTarget(); } + + @Override + public void sendDtmf(char c) { + Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0).sendToTarget(); + } }; private final Handler mHandler = new Handler() { @@ -81,6 +94,9 @@ public class ThirdPartyCallProvider { case MSG_INCOMING_CALL_ACCEPT: incomingCallAccept(); break; + case MSG_SEND_DTMF: + sendDtmf((char) msg.arg1); + break; } } }; diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index eb6c66f..a22e6b6 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -420,6 +420,9 @@ interface ITelephony { * identified by component to handle the call. * @param component the component that should handle the intent. * @param callId the unique id of the call. + * @param callerDisplayName the name shown to the user. Normally this will be the caller's phone + * number. */ - void newIncomingThirdPartyCall(in ComponentName component, String callId); + void newIncomingThirdPartyCall(in ComponentName component, String callId, + String callerDisplayName); } diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl index dcbf877..a9d67a4 100644 --- a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl @@ -38,4 +38,9 @@ oneway interface IThirdPartyCallProvider { * Accepts the incoming call. */ void incomingCallAccept(); + + /** + * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. + */ + void sendDtmf(char c); } -- cgit v1.1 From 512b28309d3ee5dd506e62fb14913047b6049236 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:22:42 -0800 Subject: DO NOT MERGE ThirdPartyCallSendDtmfCallBack API This API is needed to implement post dial. Change-Id: Iefdeae81d0eae6be86e7ee1e8ab0251ae43ed079 --- .../android/telephony/ThirdPartyCallProvider.java | 11 ++++-- .../telephony/ThirdPartyCallSendDtmfCallback.java | 46 ++++++++++++++++++++++ .../telephony/IThirdPartyCallProvider.aidl | 3 +- .../telephony/IThirdPartyCallSendDtmfCallback.aidl | 27 +++++++++++++ 4 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java create mode 100644 telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl (limited to 'telephony') diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java index 74b9ae3..5054380 100644 --- a/telephony/java/android/telephony/ThirdPartyCallProvider.java +++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java @@ -20,6 +20,7 @@ import android.os.Handler; import android.os.Message; import com.android.internal.telephony.IThirdPartyCallProvider; +import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback; /** * Interface sent to {@link android.telephony.ThirdPartyCallListener#onCallProviderAttached @@ -55,7 +56,7 @@ public class ThirdPartyCallProvider { /** * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. */ - public void sendDtmf(char c) { + public void sendDtmf(char c, ThirdPartyCallSendDtmfCallback callback) { // default implementation empty } @@ -76,8 +77,8 @@ public class ThirdPartyCallProvider { } @Override - public void sendDtmf(char c) { - Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0).sendToTarget(); + public void sendDtmf(char c, IThirdPartyCallSendDtmfCallback callback) { + Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0, callback).sendToTarget(); } }; @@ -95,7 +96,9 @@ public class ThirdPartyCallProvider { incomingCallAccept(); break; case MSG_SEND_DTMF: - sendDtmf((char) msg.arg1); + ThirdPartyCallSendDtmfCallback callback = new ThirdPartyCallSendDtmfCallback( + (IThirdPartyCallSendDtmfCallback) msg.obj); + sendDtmf((char) msg.arg1, callback); break; } } diff --git a/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java b/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java new file mode 100644 index 0000000..5a67cf7 --- /dev/null +++ b/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.os.RemoteException; + +import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback; + +/** + * Callback interface for when DTMF has been sent. + */ +public class ThirdPartyCallSendDtmfCallback { + private final IThirdPartyCallSendDtmfCallback mCallback; + + public ThirdPartyCallSendDtmfCallback(IThirdPartyCallSendDtmfCallback callback) { + if (callback == null) { + throw new IllegalArgumentException("Invalid callback"); + } + mCallback = callback; + } + + /** + * Called by the service when a call provider is available to perform the outgoing or incoming + * call. + */ + public void onSendDtmfCompleted() { + try { + mCallback.onSendDtmfCompleted(); + } catch (RemoteException e) { + } + } +} diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl index a9d67a4..9d595b0 100644 --- a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl @@ -17,6 +17,7 @@ package com.android.internal.telephony; import com.android.internal.telephony.IThirdPartyCallListener; +import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback; /** * Interface sent to ThirdPartyCallListener.onCallProviderAttached. This is used to control an @@ -42,5 +43,5 @@ oneway interface IThirdPartyCallProvider { /** * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. */ - void sendDtmf(char c); + void sendDtmf(char c, IThirdPartyCallSendDtmfCallback callback); } diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl new file mode 100644 index 0000000..3a02b06 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +/** + * Callback interface for when DTMF has been sent. + */ +oneway interface IThirdPartyCallSendDtmfCallback { + /** + * Called when the DTMF code has been sent. + */ + void onSendDtmfCompleted(); +} -- cgit v1.1 From 1bd7876d76167922f38d78747c5696c82020c1ea Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:32:21 -0800 Subject: Add Wi-Fi calling state setting to telephony interfaces Change-Id: I01029ade0eb1ff981cb92a536d042a02129a053f --- .../java/android/telephony/TelephonyManager.java | 40 ++++++++++++++++++++++ .../com/android/internal/telephony/ITelephony.aidl | 14 ++++++++ 2 files changed, 54 insertions(+) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 0e54d0f..5902b9c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -62,6 +62,20 @@ public class TelephonyManager { private static ITelephonyRegistry sRegistry; private final Context mContext; + /** + * The allowed states of Wi-Fi calling. + * + * @hide + */ + public interface WifiCallingChoices { + /** Always use Wi-Fi calling */ + static final int ALWAYS_USE = 0; + /** Never use Wi-Fi calling */ + static final int NEVER_USE = 1; + /** Ask the user whether to use Wi-Fi on every call */ + static final int ASK_EVERY_TIME = 2; + } + /** @hide */ public TelephonyManager(Context context) { Context appContext = context.getApplicationContext(); @@ -1617,5 +1631,31 @@ public class TelephonyManager { Rlog.e(TAG, "setRadioMode NPE", ex); } return false; + + /* + * Obtain the current state of Wi-Fi calling. + * + * @hide + * @see android.telephony.TelephonyManager.WifiCallingChoices + */ + public int getWhenToMakeWifiCalls() { + try { + return getITelephony().getWhenToMakeWifiCalls(); + } catch (RemoteException ex) { + return WifiCallingChoices.NEVER_USE; + } + } + + /** + * Set the current state of Wi-Fi calling. + * + * @hide + * @see android.telephony.TelephonyManager.WifiCallingChoices + */ + public void setWhenToMakeWifiCalls(int state) { + try { + getITelephony().setWhenToMakeWifiCalls(state); + } catch (RemoteException ex) { + } } } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index a22e6b6..3ff5a52 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -425,4 +425,18 @@ interface ITelephony { */ void newIncomingThirdPartyCall(in ComponentName component, String callId, String callerDisplayName); + + /** + * Obtain the current state of Wi-Fi calling. + * + * @see android.telephony.TelephonyManager.WifiCallingChoices + */ + int getWhenToMakeWifiCalls(); + + /** + * Set the current state of Wi-Fi calling. + * + * @see android.telephony.TelephonyManager.WifiCallingChoices + */ + void setWhenToMakeWifiCalls(int state); } -- cgit v1.1 From eaeb071a1751c9813612a1e3e2ec2450ea0d7a73 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:36:26 -0800 Subject: Add interface definitions for CallService/PhoneService Interfaces are meant to replace ThirdParty*.aidl/java files in same directory long term. The differences in methods are on purpose and reflect more recent design directions. Change-Id: Ia98603a1d0b6d07a3393c5f7c5aa040f9e3916e4 --- .../com/android/internal/telephony/CallInfo.aidl | 19 ++++++ .../com/android/internal/telephony/CallInfo.java | 77 ++++++++++++++++++++++ .../android/internal/telephony/ICallService.aidl | 61 +++++++++++++++++ .../internal/telephony/ICallServiceAdapter.aidl | 61 +++++++++++++++++ 4 files changed, 218 insertions(+) create mode 100644 telephony/java/com/android/internal/telephony/CallInfo.aidl create mode 100644 telephony/java/com/android/internal/telephony/CallInfo.java create mode 100644 telephony/java/com/android/internal/telephony/ICallService.aidl create mode 100644 telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl (limited to 'telephony') diff --git a/telephony/java/com/android/internal/telephony/CallInfo.aidl b/telephony/java/com/android/internal/telephony/CallInfo.aidl new file mode 100644 index 0000000..9140388 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CallInfo.aidl @@ -0,0 +1,19 @@ +/* +** Copyright 2013, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package com.android.internal.telephony; + +parcelable CallInfo; diff --git a/telephony/java/com/android/internal/telephony/CallInfo.java b/telephony/java/com/android/internal/telephony/CallInfo.java new file mode 100644 index 0000000..6bfc9d7 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CallInfo.java @@ -0,0 +1,77 @@ +/* +** Copyright 2013, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package com.android.internal.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * A parcelable holder class of Call information data. + */ +public class CallInfo implements Parcelable { + + /** + * Endpoint to which the call is connected. + * This could be the dialed value for outgoing calls or the caller id of incoming calls. + */ + private String handle; + + public CallInfo(String handle) { + this.handle = handle; + } + + public String getHandle() { + return handle; + } + + // + // Parcelling related code below here. + // + + /** + * Responsible for creating CallInfo objects for deserialized Parcels. + */ + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator () { + + @Override + public CallInfo createFromParcel(Parcel source) { + return new CallInfo(source.readString()); + } + + @Override + public CallInfo[] newArray(int size) { + return new CallInfo[size]; + } + }; + + /** + * {@inheritDoc} + */ + @Override + public int describeContents() { + return 0; + } + + /** + * Writes CallInfo object into a serializeable Parcel. + */ + @Override + public void writeToParcel(Parcel destination, int flags) { + destination.writeString(handle); + } +} diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl new file mode 100644 index 0000000..a24c860 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallService.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.ICallServiceAdapter; + +/** + * Service interface for services which would like to provide calls to be + * managed by the system in-call UI. + * + * This interface provides methods that the android framework can use to deliver commands + * for calls provided by this call service including making new calls and disconnecting + * existing ones. A binding to ICallService implementations exists for two conditions: + * 1) There exists one or more live calls for that call service, + * 2) Prior to an outbound call to test if this call service is compatible with the outgoing call. + */ +oneway interface ICallService { + + /** + * Determines if the CallService can make calls to the handle. + * TODO(santoscordon): Move this method into its own service interface long term. + * TODO(santoscordon): Add response callback parameter. + */ + void isCompatibleWith(String handle); + + /** + * Attempts to call the relevant party using the specified handle, be it a phone number, + * SIP address, or some other kind of user ID. Note that the set of handle types is + * dynamically extensible since call providers should be able to implement arbitrary + * handle-calling systems. See {@link #isCompatibleWith}. + * TODO(santoscordon): Should this have a response attached to it to ensure that the call + * service actually plans to make the call? + */ + void call(String handle); + + /** + * Disconnects the call identified by callId. + */ + void disconnect(String callId); + + /** + * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls + * and communicate state changes of existing calls. This is the first method that is called + * after a the framework binds to the call service. + */ + void setCallServiceAdapter(ICallServiceAdapter CallServiceAdapter); +} diff --git a/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl new file mode 100644 index 0000000..bc900f0 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.CallInfo; + +/** + * Provides methods for ICallService implementations to interact with the system phone app. + */ +oneway interface ICallServiceAdapter { + + /** + * Retrieves a new unique call id for use with newOutgoingCall and newIncomingCall. + */ + void getNextCallId(/* TODO(santoscordon): Needs response object */); + + /** + * Tells CallsManager of a new incoming call. + */ + void newIncomingCall(String callId, in CallInfo info); + + /** + * Tells CallsManager of a new outgoing call. + */ + void newOutgoingCall(String callId, in CallInfo info); + + /** + * Sets a call's state to active (e.g., an ongoing call where two parties can actively + * communicate). + */ + void setActive(String callId); + + /** + * Sets a call's state to ringing (e.g., an inbound ringing call). + */ + void setRinging(String callId); + + /** + * Sets a call's state to dialing (e.g., dialing an outbound call). + */ + void setDialing(String callId); + + /** + * Sets a call's state to disconnected. + */ + void setDisconnected(String callId); +} -- cgit v1.1 From bdd484f6f263f44f31709b71c4d2843442fd830a Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:51:32 -0800 Subject: Add abstract base implementation of CallService. Base implementation takes care of a lot of boilerplate code. Change-Id: Iaf5a16f5718727cee0f7efb4af53a021536f50d8 --- telephony/java/android/telephony/CallService.java | 165 +++++++++++++++++++++ .../android/internal/telephony/ICallService.aidl | 2 +- 2 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 telephony/java/android/telephony/CallService.java (limited to 'telephony') diff --git a/telephony/java/android/telephony/CallService.java b/telephony/java/android/telephony/CallService.java new file mode 100644 index 0000000..0ea55b2 --- /dev/null +++ b/telephony/java/android/telephony/CallService.java @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.app.Service; +import android.content.Intent; +import android.os.Handler; +import android.os.IBinder; +import android.os.Message; + +import com.android.internal.telephony.ICallService; +import com.android.internal.telephony.ICallServiceAdapter; + +/** + * Base implementation of CallService which can be used to provide calls for the system + * in-call UI. CallService is a one-way service from the framework's CallsManager to any app + * that would like to provide calls managed by the default system in-call user interface. + * When the service is bound by the framework, CallsManager will call setCallServiceAdapter + * which will provide CallService with an instance of {@link CallServiceAdapter} to be used + * for communicating back to CallsManager. Subsequently, more specific methods of the service + * will be called to perform various call actions including making an outgoing call and + * disconnected existing calls. + * TODO(santoscordon): Needs more about AndroidManifest.xml service registrations before + * we can unhide this API. + * + * Most public methods of this function are backed by a one-way AIDL interface which precludes + * syncronous responses. As a result, most responses are handled by (or have TODOs to handle) + * response objects instead of return values. + * TODO(santoscordon): Improve paragraph above once the final design is in place. + * @hide + */ +public abstract class CallService extends Service { + + /** + * Default Handler used to consolidate binder method calls onto a single thread. + */ + private final class CallServiceMessageHandler extends Handler { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_SET_CALL_SERVICE_ADAPTER: + setCallServiceAdapter((ICallServiceAdapter) msg.obj); + break; + case MSG_IS_COMPATIBLE_WITH: + isCompatibleWith((String) msg.obj); + break; + case MSG_CALL: + call((String) msg.obj); + break; + case MSG_DISCONNECT: + disconnect((String) msg.obj); + break; + default: + break; + } + } + } + + /** + * Default ICallService implementation provided to CallsManager via {@link #onBind}. + */ + private final class CallServiceWrapper extends ICallService.Stub { + @Override + public void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter) { + mMessageHandler.obtainMessage(MSG_SET_CALL_SERVICE_ADAPTER, callServiceAdapter) + .sendToTarget(); + } + + @Override + public void isCompatibleWith(String handle) { + mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, handle).sendToTarget(); + } + + @Override + public void call(String handle) { + mMessageHandler.obtainMessage(MSG_CALL, handle).sendToTarget(); + } + + @Override + public void disconnect(String callId) { + mMessageHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget(); + } + } + + // Only used internally by this class. + // Binder method calls on this service can occur on multiple threads. These messages are used + // in conjunction with {@link #mMessageHandler} to ensure that all callbacks are handled on a + // single thread. Keeping it on a single thread allows CallService implementations to avoid + // needing multi-threaded code in their own callback routines. + private static final int + MSG_SET_CALL_SERVICE_ADAPTER = 1, + MSG_IS_COMPATIBLE_WITH = 2, + MSG_CALL = 3, + MSG_DISCONNECT = 4; + + /** + * Message handler for consolidating binder callbacks onto a single thread. + * See {@link #CallServiceMessageHandler}. + */ + private final CallServiceMessageHandler mMessageHandler; + + /** + * Default binder implementation of {@link ICallService} interface. + */ + private final CallServiceWrapper mBinder; + + /** + * Protected constructor called only by subclasses creates the binder interface and + * single-threaded message handler. + */ + protected CallService() { + mMessageHandler = new CallServiceMessageHandler(); + mBinder = new CallServiceWrapper(); + } + + /** {@inheritDoc} */ + public IBinder onBind(Intent intent) { + return mBinder; + } + + /** + * Sets an implementation of ICallServiceAdapter for adding new calls and communicating state + * changes of existing calls. + * @param callServiceAdapter Adapter object for communicating call to CallsManager + * TODO(santoscordon): Should we not reference ICallServiceAdapter directly from here? Should we + * wrap that in a wrapper like we do for CallService/ICallService? + * TODO(santoscordon): Consider rename of CallServiceAdapter to CallsManager. + */ + public abstract void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); + + /** + * Determines if the CallService can make calls to the handle. + * @param handle The handle to test for compatibility. + * TODO(santoscordon): Need response parameter. + */ + public abstract void isCompatibleWith(String handle); + + /** + * Calls the specified handle. Handle type is dynamically extensible and can be a phone number, + * a SIP address, or other types. Only called if {@link #isCompatibleWith} returns true for the + * same handle and this service is selected by the switchboard to handle the call. + * @param handle The handle to call. + */ + public abstract void call(String handle); + + /** + * Disconnects the specified call. + * @param callId The ID of the call to disconnect. + */ + public abstract void disconnect(String callId); +} diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl index a24c860..cb9b2e8 100644 --- a/telephony/java/com/android/internal/telephony/ICallService.aidl +++ b/telephony/java/com/android/internal/telephony/ICallService.aidl @@ -57,5 +57,5 @@ oneway interface ICallService { * and communicate state changes of existing calls. This is the first method that is called * after a the framework binds to the call service. */ - void setCallServiceAdapter(ICallServiceAdapter CallServiceAdapter); + void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); } -- cgit v1.1 From 2cde710fe42b706b368aec9b85f134f2d2452f7f Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:54:58 -0800 Subject: Update TelephonyManager.WifiCallingChoices API This CL updates the order of the WifiCallingChoices values to match the wifi_calling_choice_values resource. Change-Id: Iaa643d7a70938877c760ff4a65f737a4c1c750da --- telephony/java/android/telephony/TelephonyManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 5902b9c..ec1f1df 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -70,10 +70,10 @@ public class TelephonyManager { public interface WifiCallingChoices { /** Always use Wi-Fi calling */ static final int ALWAYS_USE = 0; - /** Never use Wi-Fi calling */ - static final int NEVER_USE = 1; /** Ask the user whether to use Wi-Fi on every call */ - static final int ASK_EVERY_TIME = 2; + static final int ASK_EVERY_TIME = 1; + /** Never use Wi-Fi calling */ + static final int NEVER_USE = 2; } /** @hide */ @@ -1631,6 +1631,7 @@ public class TelephonyManager { Rlog.e(TAG, "setRadioMode NPE", ex); } return false; + } /* * Obtain the current state of Wi-Fi calling. -- cgit v1.1 From 6eac2ee0fc8a652c4cb1e7ca6602a080d4f82dbd Mon Sep 17 00:00:00 2001 From: Derek Tan Date: Tue, 4 Feb 2014 12:05:05 -0800 Subject: Expose sendEnvelope. Change-Id: I21565fae9ba8f163aed9104db355aecf9bae1796 --- .../java/android/telephony/TelephonyManager.java | 38 +++++++++++++++++++--- .../com/android/internal/telephony/ITelephony.aidl | 11 +++++++ 2 files changed, 45 insertions(+), 4 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index ec1f1df..c8efcea 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1477,12 +1477,15 @@ public class TelephonyManager { * * Input parameters equivalent to TS 27.007 AT+CCHO command. * + *

Requires Permission: + * {@link android.Manifest.permission#SIM_COMMUNICATION SIM_COMMUNICATION} + * * @param AID Application id. See ETSI 102.221 and 101.220. * @return The logical channel id which is negative on error. */ public int iccOpenLogicalChannel(String AID) { try { - return getITelephony().iccOpenLogicalChannel(AID); + return getITelephony().iccOpenLogicalChannel(AID); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -1494,13 +1497,16 @@ public class TelephonyManager { * * Input parameters equivalent to TS 27.007 AT+CCHC command. * + *

Requires Permission: + * {@link android.Manifest.permission#SIM_COMMUNICATION SIM_COMMUNICATION} + * * @param channel is the channel id to be closed as retruned by a successful * iccOpenLogicalChannel. * @return true if the channel was closed successfully. */ public boolean iccCloseLogicalChannel(int channel) { try { - return getITelephony().iccCloseLogicalChannel(channel); + return getITelephony().iccCloseLogicalChannel(channel); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -1512,6 +1518,9 @@ public class TelephonyManager { * * Input parameters equivalent to TS 27.007 AT+CGLA command. * + *

Requires Permission: + * {@link android.Manifest.permission#SIM_COMMUNICATION SIM_COMMUNICATION} + * * @param channel is the channel id to be closed as returned by a successful * iccOpenLogicalChannel. * @param cla Class of the APDU command. @@ -1527,8 +1536,29 @@ public class TelephonyManager { public String iccTransmitApduLogicalChannel(int channel, int cla, int instruction, int p1, int p2, int p3, String data) { try { - return getITelephony().iccTransmitApduLogicalChannel(channel, cla, - instruction, p1, p2, p3, data); + return getITelephony().iccTransmitApduLogicalChannel(channel, cla, + instruction, p1, p2, p3, data); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return ""; + } + + /** + * Send ENVELOPE to the SIM, after processing a proactive command sent by + * the SIM. + * + *

Requires Permission: + * {@link android.Manifest.permission#SIM_COMMUNICATION SIM_COMMUNICATION} + * + * @param contents String containing SAT/USAT response in hexadecimal + * format starting with command tag. See TS 102 223 for + * details. + * @return The APDU response from the ICC card. + */ + public String sendEnvelope(String content) { + try { + return getITelephony().sendEnvelope(content); } catch (RemoteException ex) { } catch (NullPointerException ex) { } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 3ff5a52..5f490af 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -369,6 +369,17 @@ interface ITelephony { int p1, int p2, int p3, String data); /** + * Send ENVELOPE to the SIM, after processing a proactive command sent by + * the SIM. + * + * @param contents String containing SAT/USAT response in hexadecimal + * format starting with command tag. See TS 102 223 for + * details. + * @return The APDU response from the ICC card. + */ + String sendEnvelope(String content); + + /** * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}. * Used for device configuration by some CDMA operators. * -- cgit v1.1 From ded7d1871d702ce628bb8041f28677c801179a38 Mon Sep 17 00:00:00 2001 From: Derek Tan Date: Thu, 13 Feb 2014 14:49:26 -0800 Subject: Fix the inconsistent name on @param and the real param. Change-Id: If9853e91f55c0be89cdf77ae7c4369f274a45bb6 --- telephony/java/android/telephony/TelephonyManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index e5f9a55..108310e 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1812,9 +1812,9 @@ public class TelephonyManager { *

Requires Permission: * {@link android.Manifest.permission#SIM_COMMUNICATION SIM_COMMUNICATION} * - * @param contents String containing SAT/USAT response in hexadecimal - * format starting with command tag. See TS 102 223 for - * details. + * @param content String containing SAT/USAT response in hexadecimal + * format starting with command tag. See TS 102 223 for + * details. * @return The APDU response from the ICC card. */ public String sendEnvelope(String content) { -- cgit v1.1 From d13e1d2babf9e3d14d3fe661c7c701b3b18b3eca Mon Sep 17 00:00:00 2001 From: Ben Gilad Date: Thu, 12 Dec 2013 18:40:03 -0800 Subject: Remove the telecomm entries now that we have https://googleplex-android-review.git.corp.google.com/#/c/398927 DO NOT SUBMIT until the above CL is uploaded. Change-Id: I4e4f19175b502ba81c882d1379d1d225b0e6ba67 --- telephony/java/android/telephony/CallService.java | 165 --------------------- .../com/android/internal/telephony/CallInfo.aidl | 19 --- .../com/android/internal/telephony/CallInfo.java | 77 ---------- .../android/internal/telephony/ICallService.aidl | 61 -------- .../internal/telephony/ICallServiceAdapter.aidl | 61 -------- 5 files changed, 383 deletions(-) delete mode 100644 telephony/java/android/telephony/CallService.java delete mode 100644 telephony/java/com/android/internal/telephony/CallInfo.aidl delete mode 100644 telephony/java/com/android/internal/telephony/CallInfo.java delete mode 100644 telephony/java/com/android/internal/telephony/ICallService.aidl delete mode 100644 telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl (limited to 'telephony') diff --git a/telephony/java/android/telephony/CallService.java b/telephony/java/android/telephony/CallService.java deleted file mode 100644 index 0ea55b2..0000000 --- a/telephony/java/android/telephony/CallService.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.telephony; - -import android.app.Service; -import android.content.Intent; -import android.os.Handler; -import android.os.IBinder; -import android.os.Message; - -import com.android.internal.telephony.ICallService; -import com.android.internal.telephony.ICallServiceAdapter; - -/** - * Base implementation of CallService which can be used to provide calls for the system - * in-call UI. CallService is a one-way service from the framework's CallsManager to any app - * that would like to provide calls managed by the default system in-call user interface. - * When the service is bound by the framework, CallsManager will call setCallServiceAdapter - * which will provide CallService with an instance of {@link CallServiceAdapter} to be used - * for communicating back to CallsManager. Subsequently, more specific methods of the service - * will be called to perform various call actions including making an outgoing call and - * disconnected existing calls. - * TODO(santoscordon): Needs more about AndroidManifest.xml service registrations before - * we can unhide this API. - * - * Most public methods of this function are backed by a one-way AIDL interface which precludes - * syncronous responses. As a result, most responses are handled by (or have TODOs to handle) - * response objects instead of return values. - * TODO(santoscordon): Improve paragraph above once the final design is in place. - * @hide - */ -public abstract class CallService extends Service { - - /** - * Default Handler used to consolidate binder method calls onto a single thread. - */ - private final class CallServiceMessageHandler extends Handler { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_SET_CALL_SERVICE_ADAPTER: - setCallServiceAdapter((ICallServiceAdapter) msg.obj); - break; - case MSG_IS_COMPATIBLE_WITH: - isCompatibleWith((String) msg.obj); - break; - case MSG_CALL: - call((String) msg.obj); - break; - case MSG_DISCONNECT: - disconnect((String) msg.obj); - break; - default: - break; - } - } - } - - /** - * Default ICallService implementation provided to CallsManager via {@link #onBind}. - */ - private final class CallServiceWrapper extends ICallService.Stub { - @Override - public void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter) { - mMessageHandler.obtainMessage(MSG_SET_CALL_SERVICE_ADAPTER, callServiceAdapter) - .sendToTarget(); - } - - @Override - public void isCompatibleWith(String handle) { - mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, handle).sendToTarget(); - } - - @Override - public void call(String handle) { - mMessageHandler.obtainMessage(MSG_CALL, handle).sendToTarget(); - } - - @Override - public void disconnect(String callId) { - mMessageHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget(); - } - } - - // Only used internally by this class. - // Binder method calls on this service can occur on multiple threads. These messages are used - // in conjunction with {@link #mMessageHandler} to ensure that all callbacks are handled on a - // single thread. Keeping it on a single thread allows CallService implementations to avoid - // needing multi-threaded code in their own callback routines. - private static final int - MSG_SET_CALL_SERVICE_ADAPTER = 1, - MSG_IS_COMPATIBLE_WITH = 2, - MSG_CALL = 3, - MSG_DISCONNECT = 4; - - /** - * Message handler for consolidating binder callbacks onto a single thread. - * See {@link #CallServiceMessageHandler}. - */ - private final CallServiceMessageHandler mMessageHandler; - - /** - * Default binder implementation of {@link ICallService} interface. - */ - private final CallServiceWrapper mBinder; - - /** - * Protected constructor called only by subclasses creates the binder interface and - * single-threaded message handler. - */ - protected CallService() { - mMessageHandler = new CallServiceMessageHandler(); - mBinder = new CallServiceWrapper(); - } - - /** {@inheritDoc} */ - public IBinder onBind(Intent intent) { - return mBinder; - } - - /** - * Sets an implementation of ICallServiceAdapter for adding new calls and communicating state - * changes of existing calls. - * @param callServiceAdapter Adapter object for communicating call to CallsManager - * TODO(santoscordon): Should we not reference ICallServiceAdapter directly from here? Should we - * wrap that in a wrapper like we do for CallService/ICallService? - * TODO(santoscordon): Consider rename of CallServiceAdapter to CallsManager. - */ - public abstract void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); - - /** - * Determines if the CallService can make calls to the handle. - * @param handle The handle to test for compatibility. - * TODO(santoscordon): Need response parameter. - */ - public abstract void isCompatibleWith(String handle); - - /** - * Calls the specified handle. Handle type is dynamically extensible and can be a phone number, - * a SIP address, or other types. Only called if {@link #isCompatibleWith} returns true for the - * same handle and this service is selected by the switchboard to handle the call. - * @param handle The handle to call. - */ - public abstract void call(String handle); - - /** - * Disconnects the specified call. - * @param callId The ID of the call to disconnect. - */ - public abstract void disconnect(String callId); -} diff --git a/telephony/java/com/android/internal/telephony/CallInfo.aidl b/telephony/java/com/android/internal/telephony/CallInfo.aidl deleted file mode 100644 index 9140388..0000000 --- a/telephony/java/com/android/internal/telephony/CallInfo.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* -** Copyright 2013, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -package com.android.internal.telephony; - -parcelable CallInfo; diff --git a/telephony/java/com/android/internal/telephony/CallInfo.java b/telephony/java/com/android/internal/telephony/CallInfo.java deleted file mode 100644 index 6bfc9d7..0000000 --- a/telephony/java/com/android/internal/telephony/CallInfo.java +++ /dev/null @@ -1,77 +0,0 @@ -/* -** Copyright 2013, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -package com.android.internal.telephony; - -import android.os.Parcel; -import android.os.Parcelable; - -/** - * A parcelable holder class of Call information data. - */ -public class CallInfo implements Parcelable { - - /** - * Endpoint to which the call is connected. - * This could be the dialed value for outgoing calls or the caller id of incoming calls. - */ - private String handle; - - public CallInfo(String handle) { - this.handle = handle; - } - - public String getHandle() { - return handle; - } - - // - // Parcelling related code below here. - // - - /** - * Responsible for creating CallInfo objects for deserialized Parcels. - */ - public static final Parcelable.Creator CREATOR - = new Parcelable.Creator () { - - @Override - public CallInfo createFromParcel(Parcel source) { - return new CallInfo(source.readString()); - } - - @Override - public CallInfo[] newArray(int size) { - return new CallInfo[size]; - } - }; - - /** - * {@inheritDoc} - */ - @Override - public int describeContents() { - return 0; - } - - /** - * Writes CallInfo object into a serializeable Parcel. - */ - @Override - public void writeToParcel(Parcel destination, int flags) { - destination.writeString(handle); - } -} diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl deleted file mode 100644 index cb9b2e8..0000000 --- a/telephony/java/com/android/internal/telephony/ICallService.aidl +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.telephony; - -import com.android.internal.telephony.ICallServiceAdapter; - -/** - * Service interface for services which would like to provide calls to be - * managed by the system in-call UI. - * - * This interface provides methods that the android framework can use to deliver commands - * for calls provided by this call service including making new calls and disconnecting - * existing ones. A binding to ICallService implementations exists for two conditions: - * 1) There exists one or more live calls for that call service, - * 2) Prior to an outbound call to test if this call service is compatible with the outgoing call. - */ -oneway interface ICallService { - - /** - * Determines if the CallService can make calls to the handle. - * TODO(santoscordon): Move this method into its own service interface long term. - * TODO(santoscordon): Add response callback parameter. - */ - void isCompatibleWith(String handle); - - /** - * Attempts to call the relevant party using the specified handle, be it a phone number, - * SIP address, or some other kind of user ID. Note that the set of handle types is - * dynamically extensible since call providers should be able to implement arbitrary - * handle-calling systems. See {@link #isCompatibleWith}. - * TODO(santoscordon): Should this have a response attached to it to ensure that the call - * service actually plans to make the call? - */ - void call(String handle); - - /** - * Disconnects the call identified by callId. - */ - void disconnect(String callId); - - /** - * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls - * and communicate state changes of existing calls. This is the first method that is called - * after a the framework binds to the call service. - */ - void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); -} diff --git a/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl deleted file mode 100644 index bc900f0..0000000 --- a/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.telephony; - -import com.android.internal.telephony.CallInfo; - -/** - * Provides methods for ICallService implementations to interact with the system phone app. - */ -oneway interface ICallServiceAdapter { - - /** - * Retrieves a new unique call id for use with newOutgoingCall and newIncomingCall. - */ - void getNextCallId(/* TODO(santoscordon): Needs response object */); - - /** - * Tells CallsManager of a new incoming call. - */ - void newIncomingCall(String callId, in CallInfo info); - - /** - * Tells CallsManager of a new outgoing call. - */ - void newOutgoingCall(String callId, in CallInfo info); - - /** - * Sets a call's state to active (e.g., an ongoing call where two parties can actively - * communicate). - */ - void setActive(String callId); - - /** - * Sets a call's state to ringing (e.g., an inbound ringing call). - */ - void setRinging(String callId); - - /** - * Sets a call's state to dialing (e.g., dialing an outbound call). - */ - void setDialing(String callId); - - /** - * Sets a call's state to disconnected. - */ - void setDisconnected(String callId); -} -- cgit v1.1 From 77e0d606f63c8526931018a3ae86f8b9d722c0bd Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:36:26 -0800 Subject: Add interface definitions for CallService/PhoneService Interfaces are meant to replace ThirdParty*.aidl/java files in same directory long term. The differences in methods are on purpose and reflect more recent design directions. Change-Id: Ia98603a1d0b6d07a3393c5f7c5aa040f9e3916e4 --- .../com/android/internal/telephony/CallInfo.aidl | 19 ++++++ .../com/android/internal/telephony/CallInfo.java | 77 ++++++++++++++++++++++ .../android/internal/telephony/ICallService.aidl | 61 +++++++++++++++++ .../internal/telephony/ICallServiceAdapter.aidl | 61 +++++++++++++++++ 4 files changed, 218 insertions(+) create mode 100644 telephony/java/com/android/internal/telephony/CallInfo.aidl create mode 100644 telephony/java/com/android/internal/telephony/CallInfo.java create mode 100644 telephony/java/com/android/internal/telephony/ICallService.aidl create mode 100644 telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl (limited to 'telephony') diff --git a/telephony/java/com/android/internal/telephony/CallInfo.aidl b/telephony/java/com/android/internal/telephony/CallInfo.aidl new file mode 100644 index 0000000..9140388 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CallInfo.aidl @@ -0,0 +1,19 @@ +/* +** Copyright 2013, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package com.android.internal.telephony; + +parcelable CallInfo; diff --git a/telephony/java/com/android/internal/telephony/CallInfo.java b/telephony/java/com/android/internal/telephony/CallInfo.java new file mode 100644 index 0000000..6bfc9d7 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CallInfo.java @@ -0,0 +1,77 @@ +/* +** Copyright 2013, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package com.android.internal.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * A parcelable holder class of Call information data. + */ +public class CallInfo implements Parcelable { + + /** + * Endpoint to which the call is connected. + * This could be the dialed value for outgoing calls or the caller id of incoming calls. + */ + private String handle; + + public CallInfo(String handle) { + this.handle = handle; + } + + public String getHandle() { + return handle; + } + + // + // Parcelling related code below here. + // + + /** + * Responsible for creating CallInfo objects for deserialized Parcels. + */ + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator () { + + @Override + public CallInfo createFromParcel(Parcel source) { + return new CallInfo(source.readString()); + } + + @Override + public CallInfo[] newArray(int size) { + return new CallInfo[size]; + } + }; + + /** + * {@inheritDoc} + */ + @Override + public int describeContents() { + return 0; + } + + /** + * Writes CallInfo object into a serializeable Parcel. + */ + @Override + public void writeToParcel(Parcel destination, int flags) { + destination.writeString(handle); + } +} diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl new file mode 100644 index 0000000..a24c860 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallService.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.ICallServiceAdapter; + +/** + * Service interface for services which would like to provide calls to be + * managed by the system in-call UI. + * + * This interface provides methods that the android framework can use to deliver commands + * for calls provided by this call service including making new calls and disconnecting + * existing ones. A binding to ICallService implementations exists for two conditions: + * 1) There exists one or more live calls for that call service, + * 2) Prior to an outbound call to test if this call service is compatible with the outgoing call. + */ +oneway interface ICallService { + + /** + * Determines if the CallService can make calls to the handle. + * TODO(santoscordon): Move this method into its own service interface long term. + * TODO(santoscordon): Add response callback parameter. + */ + void isCompatibleWith(String handle); + + /** + * Attempts to call the relevant party using the specified handle, be it a phone number, + * SIP address, or some other kind of user ID. Note that the set of handle types is + * dynamically extensible since call providers should be able to implement arbitrary + * handle-calling systems. See {@link #isCompatibleWith}. + * TODO(santoscordon): Should this have a response attached to it to ensure that the call + * service actually plans to make the call? + */ + void call(String handle); + + /** + * Disconnects the call identified by callId. + */ + void disconnect(String callId); + + /** + * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls + * and communicate state changes of existing calls. This is the first method that is called + * after a the framework binds to the call service. + */ + void setCallServiceAdapter(ICallServiceAdapter CallServiceAdapter); +} diff --git a/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl new file mode 100644 index 0000000..bc900f0 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.CallInfo; + +/** + * Provides methods for ICallService implementations to interact with the system phone app. + */ +oneway interface ICallServiceAdapter { + + /** + * Retrieves a new unique call id for use with newOutgoingCall and newIncomingCall. + */ + void getNextCallId(/* TODO(santoscordon): Needs response object */); + + /** + * Tells CallsManager of a new incoming call. + */ + void newIncomingCall(String callId, in CallInfo info); + + /** + * Tells CallsManager of a new outgoing call. + */ + void newOutgoingCall(String callId, in CallInfo info); + + /** + * Sets a call's state to active (e.g., an ongoing call where two parties can actively + * communicate). + */ + void setActive(String callId); + + /** + * Sets a call's state to ringing (e.g., an inbound ringing call). + */ + void setRinging(String callId); + + /** + * Sets a call's state to dialing (e.g., dialing an outbound call). + */ + void setDialing(String callId); + + /** + * Sets a call's state to disconnected. + */ + void setDisconnected(String callId); +} -- cgit v1.1 From 968740b5f574fee11d71a35c321f4e9e13d13570 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 11 Feb 2014 22:51:32 -0800 Subject: Add abstract base implementation of CallService. Base implementation takes care of a lot of boilerplate code. Change-Id: Iaf5a16f5718727cee0f7efb4af53a021536f50d8 --- telephony/java/android/telephony/CallService.java | 165 +++++++++++++++++++++ .../android/internal/telephony/ICallService.aidl | 2 +- 2 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 telephony/java/android/telephony/CallService.java (limited to 'telephony') diff --git a/telephony/java/android/telephony/CallService.java b/telephony/java/android/telephony/CallService.java new file mode 100644 index 0000000..0ea55b2 --- /dev/null +++ b/telephony/java/android/telephony/CallService.java @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.app.Service; +import android.content.Intent; +import android.os.Handler; +import android.os.IBinder; +import android.os.Message; + +import com.android.internal.telephony.ICallService; +import com.android.internal.telephony.ICallServiceAdapter; + +/** + * Base implementation of CallService which can be used to provide calls for the system + * in-call UI. CallService is a one-way service from the framework's CallsManager to any app + * that would like to provide calls managed by the default system in-call user interface. + * When the service is bound by the framework, CallsManager will call setCallServiceAdapter + * which will provide CallService with an instance of {@link CallServiceAdapter} to be used + * for communicating back to CallsManager. Subsequently, more specific methods of the service + * will be called to perform various call actions including making an outgoing call and + * disconnected existing calls. + * TODO(santoscordon): Needs more about AndroidManifest.xml service registrations before + * we can unhide this API. + * + * Most public methods of this function are backed by a one-way AIDL interface which precludes + * syncronous responses. As a result, most responses are handled by (or have TODOs to handle) + * response objects instead of return values. + * TODO(santoscordon): Improve paragraph above once the final design is in place. + * @hide + */ +public abstract class CallService extends Service { + + /** + * Default Handler used to consolidate binder method calls onto a single thread. + */ + private final class CallServiceMessageHandler extends Handler { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_SET_CALL_SERVICE_ADAPTER: + setCallServiceAdapter((ICallServiceAdapter) msg.obj); + break; + case MSG_IS_COMPATIBLE_WITH: + isCompatibleWith((String) msg.obj); + break; + case MSG_CALL: + call((String) msg.obj); + break; + case MSG_DISCONNECT: + disconnect((String) msg.obj); + break; + default: + break; + } + } + } + + /** + * Default ICallService implementation provided to CallsManager via {@link #onBind}. + */ + private final class CallServiceWrapper extends ICallService.Stub { + @Override + public void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter) { + mMessageHandler.obtainMessage(MSG_SET_CALL_SERVICE_ADAPTER, callServiceAdapter) + .sendToTarget(); + } + + @Override + public void isCompatibleWith(String handle) { + mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, handle).sendToTarget(); + } + + @Override + public void call(String handle) { + mMessageHandler.obtainMessage(MSG_CALL, handle).sendToTarget(); + } + + @Override + public void disconnect(String callId) { + mMessageHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget(); + } + } + + // Only used internally by this class. + // Binder method calls on this service can occur on multiple threads. These messages are used + // in conjunction with {@link #mMessageHandler} to ensure that all callbacks are handled on a + // single thread. Keeping it on a single thread allows CallService implementations to avoid + // needing multi-threaded code in their own callback routines. + private static final int + MSG_SET_CALL_SERVICE_ADAPTER = 1, + MSG_IS_COMPATIBLE_WITH = 2, + MSG_CALL = 3, + MSG_DISCONNECT = 4; + + /** + * Message handler for consolidating binder callbacks onto a single thread. + * See {@link #CallServiceMessageHandler}. + */ + private final CallServiceMessageHandler mMessageHandler; + + /** + * Default binder implementation of {@link ICallService} interface. + */ + private final CallServiceWrapper mBinder; + + /** + * Protected constructor called only by subclasses creates the binder interface and + * single-threaded message handler. + */ + protected CallService() { + mMessageHandler = new CallServiceMessageHandler(); + mBinder = new CallServiceWrapper(); + } + + /** {@inheritDoc} */ + public IBinder onBind(Intent intent) { + return mBinder; + } + + /** + * Sets an implementation of ICallServiceAdapter for adding new calls and communicating state + * changes of existing calls. + * @param callServiceAdapter Adapter object for communicating call to CallsManager + * TODO(santoscordon): Should we not reference ICallServiceAdapter directly from here? Should we + * wrap that in a wrapper like we do for CallService/ICallService? + * TODO(santoscordon): Consider rename of CallServiceAdapter to CallsManager. + */ + public abstract void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); + + /** + * Determines if the CallService can make calls to the handle. + * @param handle The handle to test for compatibility. + * TODO(santoscordon): Need response parameter. + */ + public abstract void isCompatibleWith(String handle); + + /** + * Calls the specified handle. Handle type is dynamically extensible and can be a phone number, + * a SIP address, or other types. Only called if {@link #isCompatibleWith} returns true for the + * same handle and this service is selected by the switchboard to handle the call. + * @param handle The handle to call. + */ + public abstract void call(String handle); + + /** + * Disconnects the specified call. + * @param callId The ID of the call to disconnect. + */ + public abstract void disconnect(String callId); +} diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl index a24c860..cb9b2e8 100644 --- a/telephony/java/com/android/internal/telephony/ICallService.aidl +++ b/telephony/java/com/android/internal/telephony/ICallService.aidl @@ -57,5 +57,5 @@ oneway interface ICallService { * and communicate state changes of existing calls. This is the first method that is called * after a the framework binds to the call service. */ - void setCallServiceAdapter(ICallServiceAdapter CallServiceAdapter); + void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); } -- cgit v1.1 From 7692be41290faccf3f38ab7ccf8844a7014cc6c1 Mon Sep 17 00:00:00 2001 From: Evan Charlton Date: Wed, 12 Feb 2014 13:28:33 -0800 Subject: Delete telephony's CallService This moved to telecomm; kill it again. Change-Id: I6ae581ac3fe5417f3a17f10f8615caacc69a21ad --- telephony/java/android/telephony/CallService.java | 165 ---------------------- 1 file changed, 165 deletions(-) delete mode 100644 telephony/java/android/telephony/CallService.java (limited to 'telephony') diff --git a/telephony/java/android/telephony/CallService.java b/telephony/java/android/telephony/CallService.java deleted file mode 100644 index 0ea55b2..0000000 --- a/telephony/java/android/telephony/CallService.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.telephony; - -import android.app.Service; -import android.content.Intent; -import android.os.Handler; -import android.os.IBinder; -import android.os.Message; - -import com.android.internal.telephony.ICallService; -import com.android.internal.telephony.ICallServiceAdapter; - -/** - * Base implementation of CallService which can be used to provide calls for the system - * in-call UI. CallService is a one-way service from the framework's CallsManager to any app - * that would like to provide calls managed by the default system in-call user interface. - * When the service is bound by the framework, CallsManager will call setCallServiceAdapter - * which will provide CallService with an instance of {@link CallServiceAdapter} to be used - * for communicating back to CallsManager. Subsequently, more specific methods of the service - * will be called to perform various call actions including making an outgoing call and - * disconnected existing calls. - * TODO(santoscordon): Needs more about AndroidManifest.xml service registrations before - * we can unhide this API. - * - * Most public methods of this function are backed by a one-way AIDL interface which precludes - * syncronous responses. As a result, most responses are handled by (or have TODOs to handle) - * response objects instead of return values. - * TODO(santoscordon): Improve paragraph above once the final design is in place. - * @hide - */ -public abstract class CallService extends Service { - - /** - * Default Handler used to consolidate binder method calls onto a single thread. - */ - private final class CallServiceMessageHandler extends Handler { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_SET_CALL_SERVICE_ADAPTER: - setCallServiceAdapter((ICallServiceAdapter) msg.obj); - break; - case MSG_IS_COMPATIBLE_WITH: - isCompatibleWith((String) msg.obj); - break; - case MSG_CALL: - call((String) msg.obj); - break; - case MSG_DISCONNECT: - disconnect((String) msg.obj); - break; - default: - break; - } - } - } - - /** - * Default ICallService implementation provided to CallsManager via {@link #onBind}. - */ - private final class CallServiceWrapper extends ICallService.Stub { - @Override - public void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter) { - mMessageHandler.obtainMessage(MSG_SET_CALL_SERVICE_ADAPTER, callServiceAdapter) - .sendToTarget(); - } - - @Override - public void isCompatibleWith(String handle) { - mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, handle).sendToTarget(); - } - - @Override - public void call(String handle) { - mMessageHandler.obtainMessage(MSG_CALL, handle).sendToTarget(); - } - - @Override - public void disconnect(String callId) { - mMessageHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget(); - } - } - - // Only used internally by this class. - // Binder method calls on this service can occur on multiple threads. These messages are used - // in conjunction with {@link #mMessageHandler} to ensure that all callbacks are handled on a - // single thread. Keeping it on a single thread allows CallService implementations to avoid - // needing multi-threaded code in their own callback routines. - private static final int - MSG_SET_CALL_SERVICE_ADAPTER = 1, - MSG_IS_COMPATIBLE_WITH = 2, - MSG_CALL = 3, - MSG_DISCONNECT = 4; - - /** - * Message handler for consolidating binder callbacks onto a single thread. - * See {@link #CallServiceMessageHandler}. - */ - private final CallServiceMessageHandler mMessageHandler; - - /** - * Default binder implementation of {@link ICallService} interface. - */ - private final CallServiceWrapper mBinder; - - /** - * Protected constructor called only by subclasses creates the binder interface and - * single-threaded message handler. - */ - protected CallService() { - mMessageHandler = new CallServiceMessageHandler(); - mBinder = new CallServiceWrapper(); - } - - /** {@inheritDoc} */ - public IBinder onBind(Intent intent) { - return mBinder; - } - - /** - * Sets an implementation of ICallServiceAdapter for adding new calls and communicating state - * changes of existing calls. - * @param callServiceAdapter Adapter object for communicating call to CallsManager - * TODO(santoscordon): Should we not reference ICallServiceAdapter directly from here? Should we - * wrap that in a wrapper like we do for CallService/ICallService? - * TODO(santoscordon): Consider rename of CallServiceAdapter to CallsManager. - */ - public abstract void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); - - /** - * Determines if the CallService can make calls to the handle. - * @param handle The handle to test for compatibility. - * TODO(santoscordon): Need response parameter. - */ - public abstract void isCompatibleWith(String handle); - - /** - * Calls the specified handle. Handle type is dynamically extensible and can be a phone number, - * a SIP address, or other types. Only called if {@link #isCompatibleWith} returns true for the - * same handle and this service is selected by the switchboard to handle the call. - * @param handle The handle to call. - */ - public abstract void call(String handle); - - /** - * Disconnects the specified call. - * @param callId The ID of the call to disconnect. - */ - public abstract void disconnect(String callId); -} -- cgit v1.1 From 37384dedab38239433a41641fe87fc3e51bb6976 Mon Sep 17 00:00:00 2001 From: Shishir Agrawal Date: Fri, 14 Mar 2014 09:32:22 -0700 Subject: Modify TelephonyManager to expose sendEnvelopeWithStatus instead of sendEnvelope. The RIL sendEnvelope command does not return the response from the SIM while the sendEnvelopeWithStatus does. Since the response is required for certain envelope commands, its better to expose sendEnvelopeWithStatus. Change-Id: I209bfc59e396bb6f91345d6f99c51cfa35f2d650 --- telephony/java/android/telephony/TelephonyManager.java | 11 ++++++----- telephony/java/com/android/internal/telephony/ITelephony.aidl | 9 +++++---- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index f621fa4..413f9e50 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1806,8 +1806,7 @@ public class TelephonyManager { } /** - * Send ENVELOPE to the SIM, after processing a proactive command sent by - * the SIM. + * Send ENVELOPE to the SIM and return the response. * *

Requires Permission: * {@link android.Manifest.permission#SIM_COMMUNICATION SIM_COMMUNICATION} @@ -1815,11 +1814,13 @@ public class TelephonyManager { * @param content String containing SAT/USAT response in hexadecimal * format starting with command tag. See TS 102 223 for * details. - * @return The APDU response from the ICC card. + * @return The APDU response from the ICC card, with the last 4 bytes + * being the status word. If the command fails, returns an empty + * string. */ - public String sendEnvelope(String content) { + public String sendEnvelopeWithStatus(String content) { try { - return getITelephony().sendEnvelope(content); + return getITelephony().sendEnvelopeWithStatus(content); } catch (RemoteException ex) { } catch (NullPointerException ex) { } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 4c0f259..e2abb9a 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -369,15 +369,16 @@ interface ITelephony { int p1, int p2, int p3, String data); /** - * Send ENVELOPE to the SIM, after processing a proactive command sent by - * the SIM. + * Send ENVELOPE to the SIM and returns the response. * * @param contents String containing SAT/USAT response in hexadecimal * format starting with command tag. See TS 102 223 for * details. - * @return The APDU response from the ICC card. + * @return The APDU response from the ICC card, with the last 4 bytes + * being the status word. If the command fails, returns an empty + * string. */ - String sendEnvelope(String content); + String sendEnvelopeWithStatus(String content); /** * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}. -- cgit v1.1 From 20e3f02c2de4efd4ccf56112b39b6056582f283a Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Thu, 27 Mar 2014 12:15:38 -0700 Subject: Add disconnect cause to setDisconnected. Change-Id: I4ba9b8f47a942b82b7a3d4bed43c0ca945957592 --- telephony/java/android/telephony/DisconnectCause.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java index 1c75658..8681344 100644 --- a/telephony/java/android/telephony/DisconnectCause.java +++ b/telephony/java/android/telephony/DisconnectCause.java @@ -17,10 +17,7 @@ package android.telephony; /** - * Contains disconnect call causes generated by the - * framework and the RIL. - * - * @hide + * Contains disconnect call causes generated by the framework and the RIL. */ public class DisconnectCause { -- cgit v1.1