Add support for rejecting Telecom call with a specified reason.

Adding a new Call API which supports passing a user-specified call
rejection reason down to the lower layers for reporting to the network.
Part of the VERSTAT spec involves support for this type of signaling, so
it makes sense to also support it here as well.
There are two potential types of reject reason:
declined - user declined the call because they want it to go to voicemail
or don't want to talk to the caller right now.
unwanted - this is a nuisance call and the user never wanted to receive it.

Bug: 135929421
Test: Added new CTS test to validate API pathways.
Test: Ran existing telecom and telephony unit tests.
Test: Modified test dialer app to use the new reject API and verified that
the reject reason signals down to the modem and translates to the correct
reject cause.

Change-Id: I6f25fafa2b2620e2839e5d3a9fb986f1130fa165
This commit is contained in:
Tyler Gunn
2020-01-23 13:10:37 -08:00
parent 0ab00030a2
commit facfdee122
8 changed files with 104 additions and 0 deletions

View File

@@ -194,6 +194,7 @@ public abstract class ConnectionService extends Service {
private static final int MSG_CREATE_CONFERENCE = 35;
private static final int MSG_CREATE_CONFERENCE_COMPLETE = 36;
private static final int MSG_CREATE_CONFERENCE_FAILED = 37;
private static final int MSG_REJECT_WITH_REASON = 38;
private static Connection sNullConnection;
@@ -449,6 +450,21 @@ public abstract class ConnectionService extends Service {
}
}
@Override
public void rejectWithReason(String callId,
@android.telecom.Call.RejectReason int rejectReason, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_REJECT);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.argi1 = rejectReason;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_REJECT_WITH_REASON, args).sendToTarget();
} finally {
Log.endSession();
}
}
@Override
public void rejectWithMessage(String callId, String message, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_REJECT_MESSAGE);
@@ -1053,6 +1069,17 @@ public abstract class ConnectionService extends Service {
}
break;
}
case MSG_REJECT_WITH_REASON: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_REJECT);
try {
reject((String) args.arg1, args.argi1);
} finally {
args.recycle();
Log.endSession();
}
break;
}
case MSG_REJECT_WITH_MESSAGE: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg3,
@@ -1981,6 +2008,11 @@ public abstract class ConnectionService extends Service {
findConnectionForAction(callId, "reject").onReject(rejectWithMessage);
}
private void reject(String callId, @android.telecom.Call.RejectReason int rejectReason) {
Log.d(this, "reject %s with reason %d", callId, rejectReason);
findConnectionForAction(callId, "reject").onReject(rejectReason);
}
private void silence(String callId) {
Log.d(this, "silence %s", callId);
findConnectionForAction(callId, "silence").onSilence();