Merge "Expose post-dial APIs" into lmp-preview-dev

This commit is contained in:
Evan Charlton
2014-06-05 22:52:07 +00:00
committed by Android (Google) Code Review
8 changed files with 65 additions and 5 deletions

View File

@@ -63,6 +63,7 @@ public abstract class CallService extends Service {
private static final int MSG_STOP_DTMF_TONE = 13;
private static final int MSG_ADD_TO_CONFERENCE = 14;
private static final int MSG_SPLIT_FROM_CONFERENCE = 15;
private static final int MSG_ON_POST_DIAL_CONTINUE = 16;
/**
* Default Handler used to consolidate binder method calls onto a single thread.
@@ -150,6 +151,17 @@ public abstract class CallService extends Service {
}
break;
}
case MSG_ON_POST_DIAL_CONTINUE: {
SomeArgs args = (SomeArgs) msg.obj;
try {
String callId = (String) args.arg1;
boolean proceed = (args.argi1 == 1);
onPostDialContinue(callId, proceed);
} finally {
args.recycle();
}
break;
}
default:
break;
}
@@ -247,6 +259,14 @@ public abstract class CallService extends Service {
args.arg2 = callId;
mMessageHandler.obtainMessage(MSG_SPLIT_FROM_CONFERENCE, args).sendToTarget();
}
@Override
public void onPostDialContinue(String callId, boolean proceed) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.argi1 = proceed ? 1 : 0;
mMessageHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget();
}
}
/**
@@ -422,4 +442,7 @@ public abstract class CallService extends Service {
* @hide
*/
public abstract void splitFromConference(String conferenceCallId, String callId);
public void onPostDialContinue(String callId, boolean proceed) {}
public void onPostDialWait(Connection conn, String remaining) {}
}

View File

@@ -217,4 +217,11 @@ public final class CallServiceAdapter {
} catch (RemoteException ignored) {
}
}
public void onPostDialWait(String callId, String remaining) {
try {
mAdapter.onPostDialWait(callId, remaining);
} catch (RemoteException ignored) {
}
}
}

View File

@@ -444,6 +444,11 @@ public abstract class Connection {
*/
protected void onReject() {}
/**
* Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes.
*/
protected void onPostDialContinue(boolean proceed) {}
private void setState(int state) {
Log.d(this, "setState: %s", stateToString(state));
onSetState(state);

View File

@@ -146,7 +146,8 @@ public abstract class ConnectionService extends CallService {
}
} else {
addConnection(callInfo.getId(), result[0]);
Log.d(this, "adapter handleSuccessfulOutgoingCall %s", callInfo.getId());
Log.d(this, "adapter handleSuccessfulOutgoingCall %s",
callInfo.getId());
getAdapter().handleSuccessfulOutgoingCall(callInfo.getId());
}
}
@@ -288,6 +289,25 @@ public abstract class ConnectionService extends CallService {
// TODO(santoscordon): Find existing conference call and invoke split(connection).
}
@Override
public final void onPostDialContinue(String callId, boolean proceed) {
Log.d(this, "onPostDialContinue(%s)", callId);
Connection connection = findConnectionForAction(callId, "onPostDialContinue");
if (connection == NULL_CONNECTION) {
Log.w(this, "Connection missing in post-dial request %s.", callId);
return;
}
connection.onPostDialContinue(proceed);
}
@Override
public final void onPostDialWait(Connection conn, String remaining) {
Log.d(this, "onPostDialWait(%s, %s)", conn, remaining);
getAdapter().onPostDialWait(mIdByConnection.get(conn), remaining);
}
/**
* Find a set of Subscriptions matching a given handle (e.g. phone number).
*

View File

@@ -174,13 +174,14 @@ public final class InCallAdapter {
* will pause playing the tones and notify the {@link InCallService} that the call is in the
* {@link InCallService#setPostDialWait(String,String)} state. When the user decides to continue
* the postdial sequence, the {@link InCallService} should invoke the
* {@link #postDialContinue(String)} method.
* {@link #postDialContinue(String,boolean)} method.
*
* @param callId The unique ID of the call for which postdial string playing should continue.
* @param proceed Whether or not to continue with the post-dial sequence.
*/
public void postDialContinue(String callId) {
public void postDialContinue(String callId, boolean proceed) {
try {
mAdapter.postDialContinue(callId);
mAdapter.postDialContinue(callId, proceed);
} catch (RemoteException e) {
}
}

View File

@@ -59,4 +59,6 @@ oneway interface ICallService {
void addToConference(String conferenceCallId, in List<String> callIds);
void splitFromConference(String conferenceCallId, String callId);
void onPostDialContinue(String callId, boolean proceed);
}

View File

@@ -52,4 +52,6 @@ oneway interface ICallServiceAdapter {
void setIsConferenced(String conferenceCallId, String callId, boolean isConferenced);
void removeCall(String callId);
void onPostDialWait(String callId, String remaining);
}

View File

@@ -44,7 +44,7 @@ oneway interface IInCallAdapter {
void stopDtmfTone(String callId);
void postDialContinue(String callId);
void postDialContinue(String callId, boolean proceed);
void handoffCall(String callId);