DTMF dialing support in frameworks/base
Change-Id: I86695161fab9c4fbd4a021ba69cc61ec5e585adc
This commit is contained in:
@@ -57,6 +57,8 @@ public abstract class CallService extends Service {
|
||||
private static final int MSG_HOLD = 9;
|
||||
private static final int MSG_UNHOLD = 10;
|
||||
private static final int MSG_ON_AUDIO_STATE_CHANGED = 11;
|
||||
private static final int MSG_PLAY_DTMF_TONE = 12;
|
||||
private static final int MSG_STOP_DTMF_TONE = 13;
|
||||
|
||||
/**
|
||||
* Default Handler used to consolidate binder method calls onto a single thread.
|
||||
@@ -116,6 +118,12 @@ public abstract class CallService extends Service {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_PLAY_DTMF_TONE:
|
||||
playDtmfTone((String) msg.obj, (char) msg.arg1);
|
||||
break;
|
||||
case MSG_STOP_DTMF_TONE:
|
||||
stopDtmfTone((String) msg.obj);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -180,6 +188,16 @@ public abstract class CallService extends Service {
|
||||
mMessageHandler.obtainMessage(MSG_UNHOLD, callId).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playDtmfTone(String callId, char digit) {
|
||||
mMessageHandler.obtainMessage(MSG_PLAY_DTMF_TONE, digit, 0, callId).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopDtmfTone(String callId) {
|
||||
mMessageHandler.obtainMessage(MSG_STOP_DTMF_TONE, callId).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioStateChanged(String callId, CallAudioState audioState) {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
@@ -306,6 +324,25 @@ public abstract class CallService extends Service {
|
||||
*/
|
||||
public abstract void unhold(String callId);
|
||||
|
||||
/**
|
||||
* Plays a dual-tone multi-frequency signaling (DTMF) tone in a call.
|
||||
*
|
||||
* @param callId The unique ID of the call in which the tone will be played.
|
||||
* @param digit A character representing the DTMF digit for which to play the tone. This
|
||||
* value must be one of {@code '0'} through {@code '9'}, {@code '*'} or {@code '#'}.
|
||||
*/
|
||||
public abstract void playDtmfTone(String callId, char digit);
|
||||
|
||||
/**
|
||||
* Stops any dual-tone multi-frequency sinaling (DTMF) tone currently playing.
|
||||
*
|
||||
* DTMF tones are played by calling {@link #playDtmfTone(String,char)}. If no DTMF tone is
|
||||
* currently playing, this method will do nothing.
|
||||
*
|
||||
* @param callId The unique ID of the call in which any currently playing tone will be stopped.
|
||||
*/
|
||||
public abstract void stopDtmfTone(String callId);
|
||||
|
||||
/**
|
||||
* Called when the audio state changes.
|
||||
*
|
||||
|
||||
@@ -48,6 +48,22 @@ public enum CallState {
|
||||
*/
|
||||
RINGING,
|
||||
|
||||
/**
|
||||
* Indicates that the call is active but in a "post-dial" state where Telecomm is now sending
|
||||
* some dual-tone multi-frequency signaling (DTMF) tones appended to the dialed number. Normal
|
||||
* transitions are to {@link #POST_DIAL_WAIT} when the post-dial string requires user
|
||||
* confirmation to proceed, {@link #ACTIVE} when the post-dial tones are completed, or
|
||||
* {@link #DISCONNECTED}.
|
||||
*/
|
||||
POST_DIAL,
|
||||
|
||||
/**
|
||||
* Indicates that the call was in the {@link #POST_DIAL} state but is now waiting for user
|
||||
* confirmation before the remaining digits can be sent. Normal transitions are to
|
||||
* {@link #POST_DIAL} when the user asks Telecomm to proceed with the post-dial sequence.
|
||||
*/
|
||||
POST_DIAL_WAIT,
|
||||
|
||||
/**
|
||||
* Indicates that a call is currently connected to another party and a communication channel is
|
||||
* open between them. The normal transition to this state is by the user answering a
|
||||
|
||||
@@ -126,4 +126,62 @@ public final class InCallAdapter {
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructs Telecomm to play a dual-tone multi-frequency signaling (DTMF) tone in a call.
|
||||
*
|
||||
* Any other currently playing DTMF tone in the specified call is immediately stopped.
|
||||
*
|
||||
* @param callId The unique ID of the call in which the tone will be played.
|
||||
* @param digit A character representing the DTMF digit for which to play the tone. This
|
||||
* value must be one of {@code '0'} through {@code '9'}, {@code '*'} or {@code '#'}.
|
||||
*/
|
||||
public void playDtmfTone(String callId, char digit) {
|
||||
try {
|
||||
mAdapter.playDtmfTone(callId, digit);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructs Telecomm to stop any dual-tone multi-frequency signaling (DTMF) tone currently
|
||||
* playing.
|
||||
*
|
||||
* DTMF tones are played by calling {@link #playDtmfTone(String,char)}. If no DTMF tone is
|
||||
* currently playing, this method will do nothing.
|
||||
*
|
||||
* @param callId The unique ID of the call in which any currently playing tone will be stopped.
|
||||
*/
|
||||
public void stopDtmfTone(String callId) {
|
||||
try {
|
||||
mAdapter.stopDtmfTone(callId);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructs Telecomm to continue playing a post-dial DTMF string.
|
||||
*
|
||||
* A post-dial DTMF string is a string of digits entered after a phone number, when dialed,
|
||||
* that are immediately sent as DTMF tones to the recipient as soon as the connection is made.
|
||||
* While these tones are playing, Telecomm will notify the {@link InCallService} that the call
|
||||
* is in the {@link InCallService#setPostDial(String)} state.
|
||||
*
|
||||
* If the DTMF string contains a {@link #DTMF_CHARACTER_PAUSE} symbol, Telecomm will temporarily
|
||||
* pause playing the tones for a pre-defined period of time.
|
||||
*
|
||||
* If the DTMF string contains a {@link #DTMF_CHARACTER_WAIT} symbol, Telecomm will pause
|
||||
* playing the tones and notify the {@link InCallService} that the call is in the
|
||||
* {@link InCallService#setPostDialWait(String)} state. When the user decides to continue the
|
||||
* postdial sequence, the {@link InCallService} should invoke the
|
||||
* {@link #postDialContinue(String)} method.
|
||||
*
|
||||
* @param callId The unique ID of the call for which postdial string playing should continue.
|
||||
*/
|
||||
public void postDialContinue(String callId) {
|
||||
try {
|
||||
mAdapter.postDialContinue(callId);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
import com.android.internal.os.SomeArgs;
|
||||
import com.android.internal.telecomm.IInCallAdapter;
|
||||
import com.android.internal.telecomm.IInCallService;
|
||||
|
||||
@@ -41,6 +42,10 @@ public abstract class InCallService extends Service {
|
||||
private static final int MSG_SET_DISCONNECTED = 4;
|
||||
private static final int MSG_SET_HOLD = 5;
|
||||
private static final int MSG_ON_AUDIO_STATE_CHANGED = 6;
|
||||
private static final int MSG_SET_DIALING = 7;
|
||||
private static final int MSG_SET_RINGING = 8;
|
||||
private static final int MSG_SET_POST_DIAL = 9;
|
||||
private static final int MSG_SET_POST_DIAL_WAIT = 10;
|
||||
|
||||
/** Default Handler used to consolidate binder method calls onto a single thread. */
|
||||
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
||||
@@ -57,6 +62,34 @@ public abstract class InCallService extends Service {
|
||||
case MSG_SET_ACTIVE:
|
||||
setActive((String) msg.obj);
|
||||
break;
|
||||
case MSG_SET_DIALING:
|
||||
setDialing((String) msg.obj);
|
||||
break;
|
||||
case MSG_SET_RINGING:
|
||||
setRinging((String) msg.obj);
|
||||
break;
|
||||
case MSG_SET_POST_DIAL: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
try {
|
||||
String callId = (String) args.arg1;
|
||||
String remaining = (String) args.arg2;
|
||||
setPostDial(callId, remaining);
|
||||
} finally {
|
||||
args.recycle();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_SET_POST_DIAL_WAIT: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
try {
|
||||
String callId = (String) args.arg1;
|
||||
String remaining = (String) args.arg2;
|
||||
setPostDialWait(callId, remaining);
|
||||
} finally {
|
||||
args.recycle();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_SET_DISCONNECTED:
|
||||
setDisconnected((String) msg.obj, msg.arg1);
|
||||
break;
|
||||
@@ -108,6 +141,32 @@ public abstract class InCallService extends Service {
|
||||
public void onAudioStateChanged(CallAudioState audioState) {
|
||||
mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, audioState).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDialing(String callId) {
|
||||
mHandler.obtainMessage(MSG_SET_DIALING, callId).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRinging(String callId) {
|
||||
mHandler.obtainMessage(MSG_SET_RINGING, callId).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPostDial(String callId, String remaining) {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = callId;
|
||||
args.arg2 = remaining;
|
||||
mHandler.obtainMessage(MSG_SET_POST_DIAL, args).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPostDialWait(String callId, String remaining) {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = callId;
|
||||
args.arg2 = remaining;
|
||||
mHandler.obtainMessage(MSG_SET_POST_DIAL_WAIT, args).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
private final InCallServiceBinder mBinder;
|
||||
@@ -140,12 +199,35 @@ public abstract class InCallService extends Service {
|
||||
protected abstract void addCall(CallInfo callInfo);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that a call has moved to the {@link CallState#ACTIVE} state.
|
||||
* Indicates to the in-call app that the specified call is currently connected to another party
|
||||
* and a communication channel is open between them. Normal transitions are to
|
||||
* {@link #setDisconnected(String)} when the call is complete.
|
||||
*
|
||||
* @param callId The identifier of the call that became active.
|
||||
* @param callId The identifier of the call changing state.
|
||||
*/
|
||||
protected abstract void setActive(String callId);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that the specified call is outgoing and in the dialing state.
|
||||
* Normal transition are to {@link #setActive(String)} if the call was answered,
|
||||
* {@link #setPostDial(String,String)} if the dialed number includes a post-dial DTMF string, or
|
||||
* {@link #setDisconnected(String)} if the call was disconnected immediately.
|
||||
*
|
||||
* @param callId The identifier of the call changing state.
|
||||
*/
|
||||
protected abstract void setDialing(String callId);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that the specified call is incoming and the user still has the
|
||||
* option of answering, rejecting, or doing nothing with the call. This state is usually
|
||||
* associated with some type of audible ringtone. Normal transitions are to
|
||||
* {@link #setActive(String)} if the call is answered, or {@link #setDisconnected(String)} if
|
||||
* the call is not answered or is otherwise disconnected for some reason.
|
||||
*
|
||||
* @param callId The identifier of the call changing state.
|
||||
*/
|
||||
protected abstract void setRinging(String callId);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that a call has been moved to the
|
||||
* {@link CallState#DISCONNECTED} and the user should be notified.
|
||||
@@ -170,4 +252,29 @@ public abstract class InCallService extends Service {
|
||||
* @param audioState The new {@link CallAudioState}.
|
||||
*/
|
||||
protected abstract void onAudioStateChanged(CallAudioState audioState);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that the specified call is active but in a "post-dial" state
|
||||
* where Telecomm is now sending some dual-tone multi-frequency signaling (DTMF) tones appended
|
||||
* to the dialed number. Normal transitions are to {@link #setPostDialWait(String,String)} when
|
||||
* the post-dial string requires user confirmation to proceed, {@link #setActive(String)} when
|
||||
* the post-dial tones are completed, or {@link #setDisconnected(String)} if the call is
|
||||
* disconnected.
|
||||
*
|
||||
* @param callId The identifier of the call changing state.
|
||||
* @param remaining The remaining postdial string to be dialed.
|
||||
*/
|
||||
protected abstract void setPostDial(String callId, String remaining);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that the specified call was in the
|
||||
* {@link #setPostDial(String,String)} state but is now waiting for user confirmation before the
|
||||
* remaining digits can be sent. Normal transitions are to {@link #setPostDial(String,String)}
|
||||
* when the user asks Telecomm to proceed with the post-dial sequence and the in-call app
|
||||
* informs Telecomm of this by invoking {@link IInCallAdapter#postDialContinue(String)}.
|
||||
*
|
||||
* @param callId The identifier of the call changing state.
|
||||
* @param remaining The remaining postdial string to be dialed.
|
||||
*/
|
||||
protected abstract void setPostDialWait(String callId, String remaining);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,16 @@ public final class TelecommConstants {
|
||||
* ID of the call.
|
||||
*/
|
||||
public static final String EXTRA_CALL_ID = "android.telecomm.extra.CALL_ID";
|
||||
|
||||
/**
|
||||
* The dual tone multi-frequency signaling character sent to indicate the dialing system should
|
||||
* pause for a predefined period.
|
||||
*/
|
||||
public static final char DTMF_CHARACTER_PAUSE = ',';
|
||||
|
||||
/**
|
||||
* The dual-tone multi-frequency signaling character sent to indicate the dialing system should
|
||||
* wait for user confirmation before proceeding.
|
||||
*/
|
||||
public static final char DTMF_CHARACTER_WAIT = ';';
|
||||
}
|
||||
|
||||
@@ -23,126 +23,36 @@ import android.telecomm.CallInfo;
|
||||
import com.android.internal.telecomm.ICallServiceAdapter;
|
||||
|
||||
/**
|
||||
* Service interface for services which would like to provide calls to be
|
||||
* managed by the system in-call UI.
|
||||
* Internal remote interface for call services.
|
||||
*
|
||||
* 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.
|
||||
* @see android.telecomm.CallService
|
||||
*
|
||||
* TODO(santoscordon): Need final public-facing comments in this file.
|
||||
* {@hide}
|
||||
* @hide
|
||||
*/
|
||||
oneway interface ICallService {
|
||||
|
||||
/**
|
||||
* 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 the framework binds to the call service.
|
||||
*
|
||||
* @param callServiceAdapter Interface to CallsManager for adding and updating calls.
|
||||
*/
|
||||
void setCallServiceAdapter(in ICallServiceAdapter callServiceAdapter);
|
||||
|
||||
/**
|
||||
* Determines if the ICallService can place the specified call. Response is sent via
|
||||
* {@link ICallServiceAdapter#setCompatibleWith}. When responding, the correct call ID must be
|
||||
* specified. It is expected that the call service respond within 500 milliseconds. Any response
|
||||
* that takes longer than 500 milliseconds will be treated as being incompatible.
|
||||
* TODO(santoscordon): 500 ms was arbitrarily chosen and must be confirmed before this
|
||||
* API is made public. Only used in the context of outgoing calls and call switching (handoff).
|
||||
*
|
||||
* @param callInfo The details of the relevant call.
|
||||
*/
|
||||
void isCompatibleWith(in CallInfo callInfo);
|
||||
|
||||
/**
|
||||
* Attempts to call the relevant party using the specified call's 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}. It is expected that the
|
||||
* call service respond via {@link ICallServiceAdapter#handleSuccessfulOutgoingCall} if it can
|
||||
* successfully make the call. Only used in the context of outgoing calls.
|
||||
* TODO(santoscordon): Figure out how a call service can short-circuit a failure to the adapter.
|
||||
*
|
||||
* @param callInfo The details of the relevant call.
|
||||
*/
|
||||
void call(in CallInfo callInfo);
|
||||
|
||||
/**
|
||||
* Aborts the outgoing call attempt. Invoked in the unlikely event that Telecomm decides to
|
||||
* abort an attempt to place a call. Only ever be invoked after {@link #call} invocations.
|
||||
* After this is invoked, Telecomm does not expect any more updates about the call and will
|
||||
* actively ignore any such update. This is different from {@link #disconnect} where Telecomm
|
||||
* expects confirmation via ICallServiceAdapter.markCallAsDisconnected.
|
||||
*
|
||||
* @param callId The identifier of the call to abort.
|
||||
*/
|
||||
void abort(String callId);
|
||||
|
||||
/**
|
||||
* Receives a new call ID to use with an incoming call. Invoked by Telecomm after it is notified
|
||||
* that this call service has a pending incoming call, see
|
||||
* {@link TelecommConstants#ACTION_INCOMING_CALL}. The call service must first give Telecomm
|
||||
* additional information of the call through {@link ICallServiceAdapter#handleIncomingCall}.
|
||||
* Following that, the call service can update the call at will using the specified call ID.
|
||||
*
|
||||
* As part of the {@link TelecommConstants#ACTION_INCOMING_CALL} Intent, a Bundle of extra
|
||||
* data could be sent via {@link TelecommConstants#EXTRA_INCOMING_CALL_EXTRAS}, which is
|
||||
* returned through this method. If no data was given, an empty Bundle will be returned.
|
||||
*
|
||||
* @param callId The ID of the call.
|
||||
* @param extras The Bundle of extra information passed via
|
||||
* {@link TelecommConstants#EXTRA_INCOMING_CALL_EXTRAS}.
|
||||
*/
|
||||
void setIncomingCallId(String callId, in Bundle extras);
|
||||
|
||||
/**
|
||||
* Answers a ringing call identified by callId. Telecomm invokes this method as a result of the
|
||||
* user hitting the "answer" button in the incoming call screen.
|
||||
*
|
||||
* @param callId The ID of the call.
|
||||
*/
|
||||
void answer(String callId);
|
||||
|
||||
/**
|
||||
* Rejects a ringing call identified by callId. Telecomm invokes this method as a result of the
|
||||
* user hitting the "reject" button in the incoming call screen.
|
||||
*
|
||||
* @param callId The ID of the call.
|
||||
*/
|
||||
void reject(String callId);
|
||||
|
||||
/**
|
||||
* Disconnects the call identified by callId. Used for outgoing and incoming calls.
|
||||
*
|
||||
* @param callId The identifier of the call to disconnect.
|
||||
*/
|
||||
void disconnect(String callId);
|
||||
|
||||
/**
|
||||
* Puts the call identified by callId on hold. Telecomm invokes this method when a call should
|
||||
* be placed on hold per user request or because a different call was made active.
|
||||
*
|
||||
* @param callId The identifier of the call to put on hold.
|
||||
*/
|
||||
void hold(String callId);
|
||||
|
||||
/**
|
||||
* Removes the call identified by callId from hold. Telecomm invokes this method when a call
|
||||
* should be removed on hold per user request or because a different call was put on hold.
|
||||
*
|
||||
* @param callId The identifier of the call to remove from hold.
|
||||
*/
|
||||
void unhold(String callId);
|
||||
|
||||
/**
|
||||
* Called when the audio state changes.
|
||||
*
|
||||
* @param activeCallId The identifier of the call that was active during the state change.
|
||||
* @param audioState The new {@link CallAudioState}.
|
||||
*/
|
||||
void onAudioStateChanged(String activeCallId, in CallAudioState audioState);
|
||||
|
||||
void playDtmfTone(String callId, char digit);
|
||||
|
||||
void stopDtmfTone(String callId);
|
||||
}
|
||||
|
||||
@@ -19,86 +19,28 @@ package com.android.internal.telecomm;
|
||||
import android.telecomm.CallInfo;
|
||||
|
||||
/**
|
||||
* Provides methods for ICallService implementations to interact with the system phone app.
|
||||
* TODO(santoscordon): Need final public-facing comments in this file.
|
||||
* Internal remote callback interface for call services.
|
||||
*
|
||||
* @see android.telecomm.CallServiceAdapter
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
oneway interface ICallServiceAdapter {
|
||||
|
||||
/**
|
||||
* Receives confirmation of a call service's ability to place a call. This method is used in
|
||||
* response to {@link ICallService#isCompatibleWith}.
|
||||
*
|
||||
* @param callId The identifier of the call for which compatibility is being received. This ID
|
||||
* should correspond to the ID given as part of the call information in
|
||||
* {@link ICallService#isCompatibleWith}.
|
||||
* @param isCompatible True if the call service can place the call.
|
||||
*/
|
||||
void setIsCompatibleWith(String callId, boolean isCompatible);
|
||||
|
||||
/**
|
||||
* Provides Telecomm with the details of an incoming call. An invocation of this method must
|
||||
* follow {@link CallService#setIncomingCallId} and use the call ID specified therein. Upon
|
||||
* the invocation of this method, Telecomm will bring up the incoming-call interface where the
|
||||
* user can elect to answer or reject a call.
|
||||
*
|
||||
* @param callInfo The details of the relevant call.
|
||||
*/
|
||||
void notifyIncomingCall(in CallInfo callInfo);
|
||||
|
||||
/**
|
||||
* Tells Telecomm that an attempt to place the specified outgoing call succeeded.
|
||||
* TODO(santoscordon): Consider adding a CallState parameter in case this outgoing call is
|
||||
* somehow no longer in the DIALING state.
|
||||
*
|
||||
* @param callId The ID of the outgoing call.
|
||||
*/
|
||||
void handleSuccessfulOutgoingCall(String callId);
|
||||
|
||||
/**
|
||||
* Tells Telecomm that an attempt to place the specified outgoing call failed.
|
||||
*
|
||||
* @param callId The ID of the outgoing call.
|
||||
* @param errorMessage The error associated with the failed call attempt.
|
||||
*/
|
||||
void handleFailedOutgoingCall(String callId, String errorMessage);
|
||||
|
||||
/**
|
||||
* Sets a call's state to active (e.g., an ongoing call where two parties can actively
|
||||
* communicate).
|
||||
*
|
||||
* @param callId The unique ID of the call whose state is changing to active.
|
||||
*/
|
||||
void setActive(String callId);
|
||||
|
||||
/**
|
||||
* Sets a call's state to ringing (e.g., an inbound ringing call).
|
||||
*
|
||||
* @param callId The unique ID of the call whose state is changing to ringing.
|
||||
*/
|
||||
void setRinging(String callId);
|
||||
|
||||
/**
|
||||
* Sets a call's state to dialing (e.g., dialing an outbound call).
|
||||
*
|
||||
* @param callId The unique ID of the call whose state is changing to dialing.
|
||||
*/
|
||||
void setDialing(String callId);
|
||||
|
||||
/**
|
||||
* Sets a call's state to disconnected.
|
||||
*
|
||||
* @param callId The unique ID of the call whose state is changing to disconnected.
|
||||
* @param disconnectCause The reason for the disconnection, any of
|
||||
* {@link android.telephony.DisconnectCause}.
|
||||
* @param disconnectMessage The call-service-provided message about the disconnect cause.
|
||||
*/
|
||||
void setDisconnected(String callId, int disconnectCause, String disconnectMessage);
|
||||
|
||||
/**
|
||||
* Sets a call's state to be on hold.
|
||||
*
|
||||
* @param callId The unique ID of the call whose state is changing to be on hold.
|
||||
*/
|
||||
void setOnHold(String callId);
|
||||
}
|
||||
|
||||
@@ -19,68 +19,30 @@ package com.android.internal.telecomm;
|
||||
import android.telecomm.CallAudioState;
|
||||
|
||||
/**
|
||||
* Receives commands from {@link IInCallService} implementations which should be executed by
|
||||
* Telecomm. When Telecomm binds to a {@link IInCallService}, an instance of this class is given to
|
||||
* the in-call service through which it can manipulate live (active, dialing, ringing) calls. When
|
||||
* the in-call service is notified of new calls ({@link IInCallService#addCall}), it can use the
|
||||
* given call IDs to execute commands such as {@link #answerCall} for incoming calls or
|
||||
* {@link #disconnectCall} for active calls the user would like to end. Some commands are only
|
||||
* appropriate for calls in certain states; please consult each method for such limitations.
|
||||
* TODO(santoscordon): Needs more/better comments once the API is finalized.
|
||||
* TODO(santoscordon): Specify the adapter will stop functioning when there are no more calls.
|
||||
* TODO(santoscordon): Once we have proper "CallState" constant definitions, consider rewording
|
||||
* the javadoc to reference those states precisely.
|
||||
* Internal remote callback interface for in-call services.
|
||||
*
|
||||
* @see android.telecomm.InCallAdapter
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
oneway interface IInCallAdapter {
|
||||
/**
|
||||
* Instructs Telecomm to answer the specified call.
|
||||
*
|
||||
* @param callId The identifier of the call to answer.
|
||||
*/
|
||||
void answerCall(String callId);
|
||||
|
||||
/**
|
||||
* Instructs Telecomm to reject the specified call.
|
||||
* TODO(santoscordon): Add reject-with-text-message parameter when that feature
|
||||
* is ported over.
|
||||
*
|
||||
* @param callId The identifier of the call to reject.
|
||||
*/
|
||||
void rejectCall(String callId);
|
||||
|
||||
/**
|
||||
* Instructs Telecomm to disconnect the specified call.
|
||||
*
|
||||
* @param callId The identifier of the call to disconnect.
|
||||
*/
|
||||
void disconnectCall(String callId);
|
||||
|
||||
/**
|
||||
* Instructs Telecomm to put the specified call on hold.
|
||||
*
|
||||
* @param callId The identifier of the call to put on hold.
|
||||
*/
|
||||
void holdCall(String callId);
|
||||
|
||||
/**
|
||||
* Instructs Telecomm to release the specified call from hold.
|
||||
*
|
||||
* @param callId The identifier of the call to release from hold.
|
||||
*/
|
||||
void unholdCall(String callId);
|
||||
|
||||
/**
|
||||
* Mute the microphone.
|
||||
*
|
||||
* @param shouldMute True if the microphone should be muted.
|
||||
*/
|
||||
void mute(boolean shouldMute);
|
||||
|
||||
/**
|
||||
* Sets the audio route (speaker, bluetooth, etc...). See {@link CallAudioState}.
|
||||
*
|
||||
* @param route The audio route to use.
|
||||
*/
|
||||
void setAudioRoute(int route);
|
||||
|
||||
void playDtmfTone(String callId, char digit);
|
||||
|
||||
void stopDtmfTone(String callId);
|
||||
|
||||
void postDialContinue(String callId);
|
||||
}
|
||||
|
||||
@@ -22,64 +22,30 @@ import android.telecomm.CallInfo;
|
||||
import com.android.internal.telecomm.IInCallAdapter;
|
||||
|
||||
/**
|
||||
* This service is implemented by any app that wishes to provide the user-interface for managing
|
||||
* phone calls. Telecomm binds to this service while there exists a live (active or incoming)
|
||||
* call, and uses it to notify the in-call app of any live and and recently disconnected calls.
|
||||
* TODO(santoscordon): Needs more/better description of lifecycle once the interface is better
|
||||
* defined.
|
||||
* TODO(santoscordon): What happens if two or more apps on a given device implement this interface?
|
||||
* Internal remote interface for in-call services.
|
||||
*
|
||||
* @see android.telecomm.InCallService
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
oneway interface IInCallService {
|
||||
|
||||
/**
|
||||
* Provides the in-call app an adapter object through which to send call-commands such as
|
||||
* answering and rejecting incoming calls, disconnecting active calls, and putting calls in
|
||||
* special states (mute, hold, etc).
|
||||
*
|
||||
* @param inCallAdapter Adapter through which an in-call app can send call-commands to Telecomm.
|
||||
*/
|
||||
void setInCallAdapter(in IInCallAdapter inCallAdapter);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that a new call has been created and an appropriate
|
||||
* user-interface should be built and shown to notify the user. Information about the call
|
||||
* including its current state is passed in through the callInfo object.
|
||||
*
|
||||
* @param callInfo Information about the new call.
|
||||
*/
|
||||
void addCall(in CallInfo callInfo);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that a call has moved to the
|
||||
* {@link android.telecomm.CallState#ACTIVE} state.
|
||||
*
|
||||
* @param callId The identifier of the call that became active.
|
||||
*/
|
||||
void setActive(String callId);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that a call has been moved to the
|
||||
* {@link android.telecomm.CallState#DISCONNECTED} and the user should be notified.
|
||||
*
|
||||
* @param callId The identifier of the call that was disconnected.
|
||||
* @param disconnectCause The reason for the disconnection, any of
|
||||
* {@link android.telephony.DisconnectCause}.
|
||||
*/
|
||||
void setDisconnected(String callId, int disconnectCause);
|
||||
|
||||
/**
|
||||
* Indicates to the in-call app that a call has been moved to the
|
||||
* {@link android.telecomm.CallState#HOLD} state and the user should be notified.
|
||||
*
|
||||
* @param callId The identifier of the call that was put on hold.
|
||||
*/
|
||||
void setDialing(in String callId);
|
||||
|
||||
void setOnHold(String callId);
|
||||
|
||||
/**
|
||||
* Called when the audio state changes.
|
||||
*
|
||||
* @param audioState The new {@link CallAudioState}.
|
||||
*/
|
||||
void onAudioStateChanged(in CallAudioState audioState);
|
||||
|
||||
void setRinging(String callId);
|
||||
|
||||
void setPostDial(String callId, String remaining);
|
||||
|
||||
void setPostDialWait(String callId, String remaining);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user