New call service methods for incoming calls.
Adds a method that allows Telecomm to request confirmation of an incoming call and another method on the adapter through which the confirmation is sent. Change-Id: Ib5d0a71f40ea3d09a42f31c479c22aed1dbc5ce8
This commit is contained in:
committed by
Evan Charlton
parent
c3010b39c9
commit
bd63f90a78
@@ -24186,6 +24186,7 @@ package android.telecomm {
|
||||
public abstract class CallService extends android.app.Service {
|
||||
ctor protected CallService();
|
||||
method public abstract void call(android.telecomm.CallInfo);
|
||||
method public abstract void confirmIncomingCall(java.lang.String, java.lang.String);
|
||||
method public abstract void disconnect(java.lang.String);
|
||||
method public android.os.IBinder getBinder();
|
||||
method public abstract void isCompatibleWith(android.telecomm.CallInfo);
|
||||
@@ -24228,6 +24229,7 @@ package android.telecomm {
|
||||
|
||||
public abstract interface ICallService implements android.os.IInterface {
|
||||
method public abstract void call(android.telecomm.CallInfo) throws android.os.RemoteException;
|
||||
method public abstract void confirmIncomingCall(java.lang.String, java.lang.String) throws android.os.RemoteException;
|
||||
method public abstract void disconnect(java.lang.String) throws android.os.RemoteException;
|
||||
method public abstract void isCompatibleWith(android.telecomm.CallInfo) throws android.os.RemoteException;
|
||||
method public abstract void setCallServiceAdapter(android.telecomm.ICallServiceAdapter) throws android.os.RemoteException;
|
||||
@@ -24241,9 +24243,8 @@ package android.telecomm {
|
||||
}
|
||||
|
||||
public abstract interface ICallServiceAdapter implements android.os.IInterface {
|
||||
method public abstract void getNextCallId() throws android.os.RemoteException;
|
||||
method public abstract void handleConfirmedIncomingCall(android.telecomm.CallInfo) throws android.os.RemoteException;
|
||||
method public abstract void handleFailedOutgoingCall(java.lang.String, java.lang.String) throws android.os.RemoteException;
|
||||
method public abstract void handleIncomingCall(android.telecomm.CallInfo) throws android.os.RemoteException;
|
||||
method public abstract void handleSuccessfulOutgoingCall(java.lang.String) throws android.os.RemoteException;
|
||||
method public abstract void setActive(java.lang.String) throws android.os.RemoteException;
|
||||
method public abstract void setCompatibleWith(java.lang.String, boolean) throws android.os.RemoteException;
|
||||
@@ -24745,11 +24746,11 @@ package android.telephony {
|
||||
method public boolean hasIccCard();
|
||||
method public boolean iccCloseLogicalChannel(int);
|
||||
method public int iccOpenLogicalChannel(java.lang.String);
|
||||
method public java.lang.String sendEnvelope(java.lang.String);
|
||||
method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String);
|
||||
method public boolean isNetworkRoaming();
|
||||
method public void listen(android.telephony.PhoneStateListener, int);
|
||||
method public void newIncomingThirdPartyCall(android.content.ComponentName, java.lang.String, java.lang.String);
|
||||
method public java.lang.String sendEnvelope(java.lang.String);
|
||||
field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE";
|
||||
field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
|
||||
field public static final int CALL_STATE_IDLE = 0; // 0x0
|
||||
|
||||
@@ -27,6 +27,8 @@ import android.telecomm.ICallServiceAdapter;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.android.internal.os.SomeArgs;
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -66,6 +68,12 @@ public abstract class CallService extends Service {
|
||||
case MSG_DISCONNECT:
|
||||
disconnect((String) msg.obj);
|
||||
break;
|
||||
case MSG_CONFIRM_INCOMING_CALL:
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
String callId = (String) args.arg1;
|
||||
String callToken = (String) args.arg2;
|
||||
confirmIncomingCall(callId, callToken);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -75,7 +83,7 @@ public abstract class CallService extends Service {
|
||||
/**
|
||||
* Default ICallService implementation provided to CallsManager via {@link #onBind}.
|
||||
*/
|
||||
private final class CallServiceWrapper extends ICallService.Stub {
|
||||
private final class CallServiceBinder extends ICallService.Stub {
|
||||
@Override
|
||||
public void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter) {
|
||||
mMessageHandler.obtainMessage(MSG_SET_CALL_SERVICE_ADAPTER, callServiceAdapter)
|
||||
@@ -96,6 +104,14 @@ public abstract class CallService extends Service {
|
||||
public void disconnect(String callId) {
|
||||
mMessageHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmIncomingCall(String callId, String callToken) {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = callId;
|
||||
args.arg2 = callToken;
|
||||
mMessageHandler.obtainMessage(MSG_CONFIRM_INCOMING_CALL, args).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
// Only used internally by this class.
|
||||
@@ -107,27 +123,19 @@ public abstract class CallService extends Service {
|
||||
MSG_SET_CALL_SERVICE_ADAPTER = 1,
|
||||
MSG_IS_COMPATIBLE_WITH = 2,
|
||||
MSG_CALL = 3,
|
||||
MSG_DISCONNECT = 4;
|
||||
MSG_DISCONNECT = 4,
|
||||
MSG_CONFIRM_INCOMING_CALL = 5;
|
||||
|
||||
/**
|
||||
* Message handler for consolidating binder callbacks onto a single thread.
|
||||
* See {@link #CallServiceMessageHandler}.
|
||||
*/
|
||||
private final CallServiceMessageHandler mMessageHandler;
|
||||
private final CallServiceMessageHandler mMessageHandler = new CallServiceMessageHandler();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
private final CallServiceBinder mBinder = new CallServiceBinder();
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public IBinder onBind(Intent intent) {
|
||||
@@ -178,4 +186,16 @@ public abstract class CallService extends Service {
|
||||
* @param callId The ID of the call to disconnect.
|
||||
*/
|
||||
public abstract void disconnect(String callId);
|
||||
|
||||
/**
|
||||
* Confirms that the specified incoming call is connecting through this call service. Telecomm
|
||||
* receives all incoming calls initially as intents that include information about a call
|
||||
* and a token identifying the call. Before displaying any UI to the user, Telecomm confirms
|
||||
* the existence of the incoming call by binding to the specified call service and calling
|
||||
* this method. Confirmation responses are received through {@link ICallServiceAdapter}.
|
||||
*
|
||||
* @param callId The ID of the call.
|
||||
* @param callToken The call token received through the incoming call intent.
|
||||
*/
|
||||
public abstract void confirmIncomingCall(String callId, String callToken);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,16 @@ oneway interface ICallService {
|
||||
* @param callId The identifier of the call to disconnect.
|
||||
*/
|
||||
void disconnect(String callId);
|
||||
|
||||
/**
|
||||
* Confirms that the specified incoming call is connecting through this call service. Telecomm
|
||||
* receives all incoming calls initially as intents that include information about a call
|
||||
* and a token identifying the call. Before displaying any UI to the user, Telecomm confirms
|
||||
* the existence of the incoming call by binding to the specified call service and calling
|
||||
* this method. Confirmation responses are received through {@link ICallServiceAdapter}.
|
||||
*
|
||||
* @param callId The ID of the call.
|
||||
* @param callToken The call token received through the incoming call intent.
|
||||
*/
|
||||
void confirmIncomingCall(String callId, String callToken);
|
||||
}
|
||||
|
||||
@@ -24,11 +24,6 @@ import android.telecomm.CallInfo;
|
||||
*/
|
||||
oneway interface ICallServiceAdapter {
|
||||
|
||||
/**
|
||||
* Retrieves a new unique call ID for use with newIncomingCall.
|
||||
*/
|
||||
void getNextCallId(/* TODO(santoscordon): Needs response object */);
|
||||
|
||||
/**
|
||||
* Receives confirmation of a call service's ability to place a call. This method is used in
|
||||
* response to {@link ICallService#isCompatibleWith}.
|
||||
@@ -42,12 +37,15 @@ oneway interface ICallServiceAdapter {
|
||||
void setCompatibleWith(String callId, boolean isCompatible);
|
||||
|
||||
/**
|
||||
* Tells CallsManager of a new incoming call. CallInfo should be populated using a new call ID
|
||||
* retrieved via {@link #getNextCallId}.
|
||||
* Receives confirmation of the existence of an incoming call connected through the call
|
||||
* service. Invoked by the call service after it receives a confirmation request from Telecomm
|
||||
* through {@link ICallService#confirmIncomingCall}. The call info object must contain all the
|
||||
* updated status of the call and use the same call ID as was passed into
|
||||
* {@link ICallService#confirmIncomingCall}.
|
||||
*
|
||||
* @param callInfo The details of the relevant call.
|
||||
*/
|
||||
void handleIncomingCall(in CallInfo callInfo);
|
||||
void handleConfirmedIncomingCall(in CallInfo callInfo);
|
||||
|
||||
/**
|
||||
* Tells Telecomm that an attempt to place the specified outgoing call succeeded.
|
||||
|
||||
Reference in New Issue
Block a user