IMS: Add support in frameworks for call deflection feature

Call deflection feature is useful to deflect MT call to another
number.

Test: Manual

Bug: 62170348
Change-Id: Idfbcc175a856aa0bb9476f8c73d7a614a3af0700
This commit is contained in:
Pooja Jain
2017-12-28 14:15:31 +05:30
parent 9f16828767
commit d34698def5
13 changed files with 138 additions and 2 deletions

View File

@@ -124,6 +124,7 @@ public abstract class ConnectionService extends Service {
private static final String SESSION_ABORT = "CS.ab";
private static final String SESSION_ANSWER = "CS.an";
private static final String SESSION_ANSWER_VIDEO = "CS.anV";
private static final String SESSION_DEFLECT = "CS.def";
private static final String SESSION_REJECT = "CS.r";
private static final String SESSION_REJECT_MESSAGE = "CS.rWM";
private static final String SESSION_SILENCE = "CS.s";
@@ -181,6 +182,7 @@ public abstract class ConnectionService extends Service {
private static final int MSG_CONNECTION_SERVICE_FOCUS_GAINED = 31;
private static final int MSG_HANDOVER_FAILED = 32;
private static final int MSG_HANDOVER_COMPLETE = 33;
private static final int MSG_DEFLECT = 34;
private static Connection sNullConnection;
@@ -352,6 +354,20 @@ public abstract class ConnectionService extends Service {
}
}
@Override
public void deflect(String callId, Uri address, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_DEFLECT);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = address;
args.arg3 = Log.createSubsession();
mHandler.obtainMessage(MSG_DEFLECT, args).sendToTarget();
} finally {
Log.endSession();
}
}
@Override
public void reject(String callId, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_REJECT);
@@ -847,6 +863,17 @@ public abstract class ConnectionService extends Service {
}
break;
}
case MSG_DEFLECT: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg3, SESSION_HANDLER + SESSION_DEFLECT);
try {
deflect((String) args.arg1, (Uri) args.arg2);
} finally {
args.recycle();
Log.endSession();
}
break;
}
case MSG_REJECT: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_REJECT);
@@ -1605,6 +1632,11 @@ public abstract class ConnectionService extends Service {
findConnectionForAction(callId, "answer").onAnswer();
}
private void deflect(String callId, Uri address) {
Log.d(this, "deflect %s", callId);
findConnectionForAction(callId, "deflect").onDeflect(address);
}
private void reject(String callId) {
Log.d(this, "reject %s", callId);
findConnectionForAction(callId, "reject").onReject();