Modify AIDLs to include Session.Info

am: b32d4f8b5c

Change-Id: Ibbac4c74b5a0c4fcd5524c97acef5fc078d80cb7
This commit is contained in:
Brad Ebinger
2016-10-28 20:17:03 +00:00
committed by android-build-merger
10 changed files with 573 additions and 164 deletions

View File

@@ -26,6 +26,7 @@ import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.telecom.Logging.Session;
import com.android.internal.os.SomeArgs; import com.android.internal.os.SomeArgs;
import com.android.internal.telecom.IConnectionService; import com.android.internal.telecom.IConnectionService;
@@ -83,6 +84,32 @@ public abstract class ConnectionService extends Service {
// Flag controlling whether PII is emitted into the logs // Flag controlling whether PII is emitted into the logs
private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG); private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG);
// Session Definitions
private static final String SESSION_HANDLER = "H.";
private static final String SESSION_ADD_CS_ADAPTER = "CS.aCSA";
private static final String SESSION_REMOVE_CS_ADAPTER = "CS.rCSA";
private static final String SESSION_CREATE_CONN = "CS.crCo";
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_REJECT = "CS.r";
private static final String SESSION_REJECT_MESSAGE = "CS.rWM";
private static final String SESSION_SILENCE = "CS.s";
private static final String SESSION_DISCONNECT = "CS.d";
private static final String SESSION_HOLD = "CS.h";
private static final String SESSION_UNHOLD = "CS.u";
private static final String SESSION_CALL_AUDIO_SC = "CS.cASC";
private static final String SESSION_PLAY_DTMF = "CS.pDT";
private static final String SESSION_STOP_DTMF = "CS.sDT";
private static final String SESSION_CONFERENCE = "CS.c";
private static final String SESSION_SPLIT_CONFERENCE = "CS.sFC";
private static final String SESSION_MERGE_CONFERENCE = "CS.mC";
private static final String SESSION_SWAP_CONFERENCE = "CS.sC";
private static final String SESSION_POST_DIAL_CONT = "CS.oPDC";
private static final String SESSION_PULL_EXTERNAL_CALL = "CS.pEC";
private static final String SESSION_SEND_CALL_EVENT = "CS.sCE";
private static final String SESSION_EXTRAS_CHANGED = "CS.oEC";
private static final int MSG_ADD_CONNECTION_SERVICE_ADAPTER = 1; private static final int MSG_ADD_CONNECTION_SERVICE_ADAPTER = 1;
private static final int MSG_CREATE_CONNECTION = 2; private static final int MSG_CREATE_CONNECTION = 2;
private static final int MSG_ABORT = 3; private static final int MSG_ABORT = 3;
@@ -125,12 +152,30 @@ public abstract class ConnectionService extends Service {
private final IBinder mBinder = new IConnectionService.Stub() { private final IBinder mBinder = new IConnectionService.Stub() {
@Override @Override
public void addConnectionServiceAdapter(IConnectionServiceAdapter adapter) { public void addConnectionServiceAdapter(IConnectionServiceAdapter adapter,
mHandler.obtainMessage(MSG_ADD_CONNECTION_SERVICE_ADAPTER, adapter).sendToTarget(); Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_ADD_CS_ADAPTER);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = adapter;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_ADD_CONNECTION_SERVICE_ADAPTER, args).sendToTarget();
} finally {
Log.endSession();
}
} }
public void removeConnectionServiceAdapter(IConnectionServiceAdapter adapter) { public void removeConnectionServiceAdapter(IConnectionServiceAdapter adapter,
mHandler.obtainMessage(MSG_REMOVE_CONNECTION_SERVICE_ADAPTER, adapter).sendToTarget(); Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_REMOVE_CS_ADAPTER);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = adapter;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_REMOVE_CONNECTION_SERVICE_ADAPTER, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
@@ -139,136 +184,292 @@ public abstract class ConnectionService extends Service {
String id, String id,
ConnectionRequest request, ConnectionRequest request,
boolean isIncoming, boolean isIncoming,
boolean isUnknown) { boolean isUnknown,
Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_CREATE_CONN);
try {
SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain();
args.arg1 = connectionManagerPhoneAccount; args.arg1 = connectionManagerPhoneAccount;
args.arg2 = id; args.arg2 = id;
args.arg3 = request; args.arg3 = request;
args.arg4 = Log.createSubsession();
args.argi1 = isIncoming ? 1 : 0; args.argi1 = isIncoming ? 1 : 0;
args.argi2 = isUnknown ? 1 : 0; args.argi2 = isUnknown ? 1 : 0;
mHandler.obtainMessage(MSG_CREATE_CONNECTION, args).sendToTarget(); mHandler.obtainMessage(MSG_CREATE_CONNECTION, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void abort(String callId) { public void abort(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_ABORT, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_ABORT);
} try {
@Override
public void answerVideo(String callId, int videoState) {
SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain();
args.arg1 = callId; args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_ABORT, args).sendToTarget();
} finally {
Log.endSession();
}
}
@Override
public void answerVideo(String callId, int videoState, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_ANSWER_VIDEO);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
args.argi1 = videoState; args.argi1 = videoState;
mHandler.obtainMessage(MSG_ANSWER_VIDEO, args).sendToTarget(); mHandler.obtainMessage(MSG_ANSWER_VIDEO, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void answer(String callId) { public void answer(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_ANSWER, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_ANSWER);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_ANSWER, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void reject(String callId) { public void reject(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_REJECT, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_REJECT);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_REJECT, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void rejectWithMessage(String callId, String message) { public void rejectWithMessage(String callId, String message, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_REJECT_MESSAGE);
try {
SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain();
args.arg1 = callId; args.arg1 = callId;
args.arg2 = message; args.arg2 = message;
args.arg3 = Log.createSubsession();
mHandler.obtainMessage(MSG_REJECT_WITH_MESSAGE, args).sendToTarget(); mHandler.obtainMessage(MSG_REJECT_WITH_MESSAGE, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void silence(String callId) { public void silence(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_SILENCE, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_SILENCE);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_SILENCE, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void disconnect(String callId) { public void disconnect(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_DISCONNECT);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_DISCONNECT, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void hold(String callId) { public void hold(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_HOLD, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_HOLD);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_HOLD, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void unhold(String callId) { public void unhold(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_UNHOLD, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_UNHOLD);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_UNHOLD, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void onCallAudioStateChanged(String callId, CallAudioState callAudioState) { public void onCallAudioStateChanged(String callId, CallAudioState callAudioState,
Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_CALL_AUDIO_SC);
try {
SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain();
args.arg1 = callId; args.arg1 = callId;
args.arg2 = callAudioState; args.arg2 = callAudioState;
args.arg3 = Log.createSubsession();
mHandler.obtainMessage(MSG_ON_CALL_AUDIO_STATE_CHANGED, args).sendToTarget(); mHandler.obtainMessage(MSG_ON_CALL_AUDIO_STATE_CHANGED, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void playDtmfTone(String callId, char digit) { public void playDtmfTone(String callId, char digit, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_PLAY_DTMF_TONE, digit, 0, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_PLAY_DTMF);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = digit;
args.arg2 = callId;
args.arg3 = Log.createSubsession();
mHandler.obtainMessage(MSG_PLAY_DTMF_TONE, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void stopDtmfTone(String callId) { public void stopDtmfTone(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_STOP_DTMF_TONE, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_STOP_DTMF);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_STOP_DTMF_TONE, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void conference(String callId1, String callId2) { public void conference(String callId1, String callId2, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_CONFERENCE);
try {
SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain();
args.arg1 = callId1; args.arg1 = callId1;
args.arg2 = callId2; args.arg2 = callId2;
args.arg3 = Log.createSubsession();
mHandler.obtainMessage(MSG_CONFERENCE, args).sendToTarget(); mHandler.obtainMessage(MSG_CONFERENCE, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void splitFromConference(String callId) { public void splitFromConference(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_SPLIT_FROM_CONFERENCE, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_SPLIT_CONFERENCE);
} try {
@Override
public void mergeConference(String callId) {
mHandler.obtainMessage(MSG_MERGE_CONFERENCE, callId).sendToTarget();
}
@Override
public void swapConference(String callId) {
mHandler.obtainMessage(MSG_SWAP_CONFERENCE, callId).sendToTarget();
}
@Override
public void onPostDialContinue(String callId, boolean proceed) {
SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain();
args.arg1 = callId; args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_SPLIT_FROM_CONFERENCE, args).sendToTarget();
} finally {
Log.endSession();
}
}
@Override
public void mergeConference(String callId, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_MERGE_CONFERENCE);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_MERGE_CONFERENCE, args).sendToTarget();
} finally {
Log.endSession();
}
}
@Override
public void swapConference(String callId, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_SWAP_CONFERENCE);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_SWAP_CONFERENCE, args).sendToTarget();
} finally {
Log.endSession();
}
}
@Override
public void onPostDialContinue(String callId, boolean proceed, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_POST_DIAL_CONT);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
args.argi1 = proceed ? 1 : 0; args.argi1 = proceed ? 1 : 0;
mHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget(); mHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void pullExternalCall(String callId) { public void pullExternalCall(String callId, Session.Info sessionInfo) {
mHandler.obtainMessage(MSG_PULL_EXTERNAL_CALL, callId).sendToTarget(); Log.startSession(sessionInfo, SESSION_PULL_EXTERNAL_CALL);
try {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = Log.createSubsession();
mHandler.obtainMessage(MSG_PULL_EXTERNAL_CALL, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void sendCallEvent(String callId, String event, Bundle extras) { public void sendCallEvent(String callId, String event, Bundle extras,
Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_SEND_CALL_EVENT);
try {
SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain();
args.arg1 = callId; args.arg1 = callId;
args.arg2 = event; args.arg2 = event;
args.arg3 = extras; args.arg3 = extras;
args.arg4 = Log.createSubsession();
mHandler.obtainMessage(MSG_SEND_CALL_EVENT, args).sendToTarget(); mHandler.obtainMessage(MSG_SEND_CALL_EVENT, args).sendToTarget();
} finally {
Log.endSession();
}
} }
@Override @Override
public void onExtrasChanged(String callId, Bundle extras) { public void onExtrasChanged(String callId, Bundle extras, Session.Info sessionInfo) {
Log.startSession(sessionInfo, SESSION_EXTRAS_CHANGED);
try {
SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain();
args.arg1 = callId; args.arg1 = callId;
args.arg2 = extras; args.arg2 = extras;
args.arg3 = Log.createSubsession();
mHandler.obtainMessage(MSG_ON_EXTRAS_CHANGED, args).sendToTarget(); mHandler.obtainMessage(MSG_ON_EXTRAS_CHANGED, args).sendToTarget();
} finally {
Log.endSession();
}
} }
}; };
@@ -276,15 +477,35 @@ public abstract class ConnectionService extends Service {
@Override @Override
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
switch (msg.what) { switch (msg.what) {
case MSG_ADD_CONNECTION_SERVICE_ADAPTER: case MSG_ADD_CONNECTION_SERVICE_ADAPTER: {
mAdapter.addAdapter((IConnectionServiceAdapter) msg.obj); SomeArgs args = (SomeArgs) msg.obj;
try {
IConnectionServiceAdapter adapter = (IConnectionServiceAdapter) args.arg1;
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_ADD_CS_ADAPTER);
mAdapter.addAdapter(adapter);
onAdapterAttached(); onAdapterAttached();
} finally {
args.recycle();
Log.endSession();
}
break; break;
case MSG_REMOVE_CONNECTION_SERVICE_ADAPTER: }
mAdapter.removeAdapter((IConnectionServiceAdapter) msg.obj); case MSG_REMOVE_CONNECTION_SERVICE_ADAPTER: {
SomeArgs args = (SomeArgs) msg.obj;
try {
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_REMOVE_CS_ADAPTER);
mAdapter.removeAdapter((IConnectionServiceAdapter) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
}
case MSG_CREATE_CONNECTION: { case MSG_CREATE_CONNECTION: {
SomeArgs args = (SomeArgs) msg.obj; SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg4, SESSION_HANDLER + SESSION_CREATE_CONN);
try { try {
final PhoneAccountHandle connectionManagerPhoneAccount = final PhoneAccountHandle connectionManagerPhoneAccount =
(PhoneAccountHandle) args.arg1; (PhoneAccountHandle) args.arg1;
@@ -315,122 +536,253 @@ public abstract class ConnectionService extends Service {
} }
} finally { } finally {
args.recycle(); args.recycle();
Log.endSession();
} }
break; break;
} }
case MSG_ABORT: case MSG_ABORT: {
abort((String) msg.obj); SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_ABORT);
try {
abort((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
case MSG_ANSWER: }
answer((String) msg.obj); case MSG_ANSWER: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_ANSWER);
try {
answer((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
}
case MSG_ANSWER_VIDEO: { case MSG_ANSWER_VIDEO: {
SomeArgs args = (SomeArgs) msg.obj; SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_ANSWER_VIDEO);
try { try {
String callId = (String) args.arg1; String callId = (String) args.arg1;
int videoState = args.argi1; int videoState = args.argi1;
answerVideo(callId, videoState); answerVideo(callId, videoState);
} finally { } finally {
args.recycle(); args.recycle();
Log.endSession();
} }
break; break;
} }
case MSG_REJECT: case MSG_REJECT: {
reject((String) msg.obj); SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_REJECT);
try {
reject((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
}
case MSG_REJECT_WITH_MESSAGE: { case MSG_REJECT_WITH_MESSAGE: {
SomeArgs args = (SomeArgs) msg.obj; SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg3,
SESSION_HANDLER + SESSION_REJECT_MESSAGE);
try { try {
reject((String) args.arg1, (String) args.arg2); reject((String) args.arg1, (String) args.arg2);
} finally { } finally {
args.recycle(); args.recycle();
Log.endSession();
} }
break; break;
} }
case MSG_DISCONNECT: case MSG_DISCONNECT: {
disconnect((String) msg.obj); SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_DISCONNECT);
try {
disconnect((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
case MSG_SILENCE: }
silence((String) msg.obj); case MSG_SILENCE: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_SILENCE);
try {
silence((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
case MSG_HOLD: }
hold((String) msg.obj); case MSG_HOLD: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_REJECT);
try {
hold((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
case MSG_UNHOLD: }
unhold((String) msg.obj); case MSG_UNHOLD: {
SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_UNHOLD);
try {
unhold((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
}
case MSG_ON_CALL_AUDIO_STATE_CHANGED: { case MSG_ON_CALL_AUDIO_STATE_CHANGED: {
SomeArgs args = (SomeArgs) msg.obj; SomeArgs args = (SomeArgs) msg.obj;
Log.continueSession((Session) args.arg3,
SESSION_HANDLER + SESSION_CALL_AUDIO_SC);
try { try {
String callId = (String) args.arg1; String callId = (String) args.arg1;
CallAudioState audioState = (CallAudioState) args.arg2; CallAudioState audioState = (CallAudioState) args.arg2;
onCallAudioStateChanged(callId, new CallAudioState(audioState)); onCallAudioStateChanged(callId, new CallAudioState(audioState));
} finally { } finally {
args.recycle(); args.recycle();
Log.endSession();
} }
break; break;
} }
case MSG_PLAY_DTMF_TONE: case MSG_PLAY_DTMF_TONE: {
playDtmfTone((String) msg.obj, (char) msg.arg1); SomeArgs args = (SomeArgs) msg.obj;
try {
Log.continueSession((Session) args.arg3,
SESSION_HANDLER + SESSION_PLAY_DTMF);
playDtmfTone((String) args.arg2, (char) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
case MSG_STOP_DTMF_TONE: }
stopDtmfTone((String) msg.obj); case MSG_STOP_DTMF_TONE: {
SomeArgs args = (SomeArgs) msg.obj;
try {
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_STOP_DTMF);
stopDtmfTone((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
}
case MSG_CONFERENCE: { case MSG_CONFERENCE: {
SomeArgs args = (SomeArgs) msg.obj; SomeArgs args = (SomeArgs) msg.obj;
try { try {
Log.continueSession((Session) args.arg3,
SESSION_HANDLER + SESSION_CONFERENCE);
String callId1 = (String) args.arg1; String callId1 = (String) args.arg1;
String callId2 = (String) args.arg2; String callId2 = (String) args.arg2;
conference(callId1, callId2); conference(callId1, callId2);
} finally { } finally {
args.recycle(); args.recycle();
Log.endSession();
} }
break; break;
} }
case MSG_SPLIT_FROM_CONFERENCE: case MSG_SPLIT_FROM_CONFERENCE: {
splitFromConference((String) msg.obj); SomeArgs args = (SomeArgs) msg.obj;
try {
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_SPLIT_CONFERENCE);
splitFromConference((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
case MSG_MERGE_CONFERENCE: }
mergeConference((String) msg.obj); case MSG_MERGE_CONFERENCE: {
SomeArgs args = (SomeArgs) msg.obj;
try {
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_MERGE_CONFERENCE);
mergeConference((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
case MSG_SWAP_CONFERENCE: }
swapConference((String) msg.obj); case MSG_SWAP_CONFERENCE: {
SomeArgs args = (SomeArgs) msg.obj;
try {
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_SWAP_CONFERENCE);
swapConference((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
}
case MSG_ON_POST_DIAL_CONTINUE: { case MSG_ON_POST_DIAL_CONTINUE: {
SomeArgs args = (SomeArgs) msg.obj; SomeArgs args = (SomeArgs) msg.obj;
try { try {
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_POST_DIAL_CONT);
String callId = (String) args.arg1; String callId = (String) args.arg1;
boolean proceed = (args.argi1 == 1); boolean proceed = (args.argi1 == 1);
onPostDialContinue(callId, proceed); onPostDialContinue(callId, proceed);
} finally { } finally {
args.recycle(); args.recycle();
Log.endSession();
} }
break; break;
} }
case MSG_PULL_EXTERNAL_CALL: { case MSG_PULL_EXTERNAL_CALL: {
pullExternalCall((String) msg.obj); SomeArgs args = (SomeArgs) msg.obj;
try {
Log.continueSession((Session) args.arg2,
SESSION_HANDLER + SESSION_PULL_EXTERNAL_CALL);
pullExternalCall((String) args.arg1);
} finally {
args.recycle();
Log.endSession();
}
break; break;
} }
case MSG_SEND_CALL_EVENT: { case MSG_SEND_CALL_EVENT: {
SomeArgs args = (SomeArgs) msg.obj; SomeArgs args = (SomeArgs) msg.obj;
try { try {
Log.continueSession((Session) args.arg4,
SESSION_HANDLER + SESSION_SEND_CALL_EVENT);
String callId = (String) args.arg1; String callId = (String) args.arg1;
String event = (String) args.arg2; String event = (String) args.arg2;
Bundle extras = (Bundle) args.arg3; Bundle extras = (Bundle) args.arg3;
sendCallEvent(callId, event, extras); sendCallEvent(callId, event, extras);
} finally { } finally {
args.recycle(); args.recycle();
Log.endSession();
} }
break; break;
} }
case MSG_ON_EXTRAS_CHANGED: { case MSG_ON_EXTRAS_CHANGED: {
SomeArgs args = (SomeArgs) msg.obj; SomeArgs args = (SomeArgs) msg.obj;
try { try {
Log.continueSession((Session) args.arg3,
SESSION_HANDLER + SESSION_EXTRAS_CHANGED);
String callId = (String) args.arg1; String callId = (String) args.arg1;
Bundle extras = (Bundle) args.arg2; Bundle extras = (Bundle) args.arg2;
handleExtrasChanged(callId, extras); handleExtrasChanged(callId, extras);
} finally { } finally {
args.recycle(); args.recycle();
Log.endSession();
} }
break; break;
} }
@@ -1274,10 +1626,6 @@ public abstract class ConnectionService extends Service {
* call created using * call created using
* {@code TelecomManager#addNewIncomingCall(PhoneAccountHandle, android.os.Bundle)}. * {@code TelecomManager#addNewIncomingCall(PhoneAccountHandle, android.os.Bundle)}.
* *
* @param connectionManagerPhoneAccount
* @param request
* @return
*
* @hide * @hide
*/ */
public Connection onCreateUnknownConnection(PhoneAccountHandle connectionManagerPhoneAccount, public Connection onCreateUnknownConnection(PhoneAccountHandle connectionManagerPhoneAccount,
@@ -1509,7 +1857,7 @@ public abstract class ConnectionService extends Service {
* @return The call ID. * @return The call ID.
*/ */
private int getNextCallId() { private int getNextCallId() {
synchronized(mIdSyncRoot) { synchronized (mIdSyncRoot) {
return ++mId; return ++mId;
} }
} }

View File

@@ -184,6 +184,10 @@ public class Log {
getSessionManager().startSession(shortMethodName, null); getSessionManager().startSession(shortMethodName, null);
} }
public static void startSession(Session.Info info, String shortMethodName) {
getSessionManager().startSession(info, shortMethodName, null);
}
public static void startSession(String shortMethodName, String callerIdentification) { public static void startSession(String shortMethodName, String callerIdentification) {
getSessionManager().startSession(shortMethodName, callerIdentification); getSessionManager().startSession(shortMethodName, callerIdentification);
} }
@@ -193,14 +197,14 @@ public class Log {
getSessionManager().startSession(info, shortMethodName, callerIdentification); getSessionManager().startSession(info, shortMethodName, callerIdentification);
} }
public static void startExternalSession(Session.Info sessionInfo, String shortMethodName) {
getSessionManager().startExternalSession(sessionInfo, shortMethodName);
}
public static Session createSubsession() { public static Session createSubsession() {
return getSessionManager().createSubsession(); return getSessionManager().createSubsession();
} }
public static Session.Info getExternalSession() {
return getSessionManager().getExternalSession();
}
public static void cancelSubsession(Session subsession) { public static void cancelSubsession(Session subsession) {
getSessionManager().cancelSubsession(subsession); getSessionManager().cancelSubsession(subsession);
} }

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package android.telecom.Logging;
/**
* {@hide}
*/
parcelable Session.Info;

View File

@@ -281,7 +281,15 @@ public class Session {
parentSession.getFullMethodPath(sb); parentSession.getFullMethodPath(sb);
sb.append(SUBSESSION_SEPARATION_CHAR); sb.append(SUBSESSION_SEPARATION_CHAR);
} }
// Encapsulate the external session's method name so it is obvious what part of the session
// is external.
if (isExternal()) {
sb.append("(");
sb.append(mShortMethodName); sb.append(mShortMethodName);
sb.append(")");
} else {
sb.append(mShortMethodName);
}
if(isSessionStarted) { if(isSessionStarted) {
// Cache this value so that we do not have to do this work next time! // Cache this value so that we do not have to do this work next time!

View File

@@ -228,6 +228,23 @@ public class SessionManager {
return newSubsession; return newSubsession;
} }
/**
* Retrieve the information of the currently active Session. This information is parcelable and
* is used to create an external Session ({@link #startExternalSession(Session.Info, String)}).
* If there is no Session active, this method will return null.
*/
public synchronized Session.Info getExternalSession() {
int threadId = getCallingThreadId();
Session threadSession = mSessionMapper.get(threadId);
if (threadSession == null) {
Log.d(LOGGING_TAG, "Log.getExternalSession was called with no session " +
"active.");
return null;
}
return threadSession.getInfo();
}
/** /**
* Cancels a subsession that had Log.createSubsession() called on it, but will never have * Cancels a subsession that had Log.createSubsession() called on it, but will never have
* Log.continueSession(...) called on it due to an error. Allows the subsession to be cleaned * Log.continueSession(...) called on it due to an error. Allows the subsession to be cleaned

View File

@@ -399,7 +399,7 @@ public final class RemoteConference {
*/ */
public void disconnect() { public void disconnect() {
try { try {
mConnectionService.disconnect(mId); mConnectionService.disconnect(mId, null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -414,7 +414,7 @@ public final class RemoteConference {
public void separate(RemoteConnection connection) { public void separate(RemoteConnection connection) {
if (mChildConnections.contains(connection)) { if (mChildConnections.contains(connection)) {
try { try {
mConnectionService.splitFromConference(connection.getId()); mConnectionService.splitFromConference(connection.getId(), null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -432,7 +432,7 @@ public final class RemoteConference {
*/ */
public void merge() { public void merge() {
try { try {
mConnectionService.mergeConference(mId); mConnectionService.mergeConference(mId, null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -448,7 +448,7 @@ public final class RemoteConference {
*/ */
public void swap() { public void swap() {
try { try {
mConnectionService.swapConference(mId); mConnectionService.swapConference(mId, null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -458,7 +458,7 @@ public final class RemoteConference {
*/ */
public void hold() { public void hold() {
try { try {
mConnectionService.hold(mId); mConnectionService.hold(mId, null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -468,7 +468,7 @@ public final class RemoteConference {
*/ */
public void unhold() { public void unhold() {
try { try {
mConnectionService.unhold(mId); mConnectionService.unhold(mId, null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -491,7 +491,7 @@ public final class RemoteConference {
*/ */
public void playDtmfTone(char digit) { public void playDtmfTone(char digit) {
try { try {
mConnectionService.playDtmfTone(mId, digit); mConnectionService.playDtmfTone(mId, digit, null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -503,7 +503,7 @@ public final class RemoteConference {
*/ */
public void stopDtmfTone() { public void stopDtmfTone() {
try { try {
mConnectionService.stopDtmfTone(mId); mConnectionService.stopDtmfTone(mId, null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -528,7 +528,7 @@ public final class RemoteConference {
*/ */
public void setCallAudioState(CallAudioState state) { public void setCallAudioState(CallAudioState state) {
try { try {
mConnectionService.onCallAudioStateChanged(mId, state); mConnectionService.onCallAudioStateChanged(mId, state, null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }

View File

@@ -855,7 +855,7 @@ public final class RemoteConnection {
public void abort() { public void abort() {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.abort(mConnectionId); mConnectionService.abort(mConnectionId, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -867,7 +867,7 @@ public final class RemoteConnection {
public void answer() { public void answer() {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.answer(mConnectionId); mConnectionService.answer(mConnectionId, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -881,7 +881,7 @@ public final class RemoteConnection {
public void answer(int videoState) { public void answer(int videoState) {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.answerVideo(mConnectionId, videoState); mConnectionService.answerVideo(mConnectionId, videoState, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -893,7 +893,7 @@ public final class RemoteConnection {
public void reject() { public void reject() {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.reject(mConnectionId); mConnectionService.reject(mConnectionId, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -905,7 +905,7 @@ public final class RemoteConnection {
public void hold() { public void hold() {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.hold(mConnectionId); mConnectionService.hold(mConnectionId, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -917,7 +917,7 @@ public final class RemoteConnection {
public void unhold() { public void unhold() {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.unhold(mConnectionId); mConnectionService.unhold(mConnectionId, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -929,7 +929,7 @@ public final class RemoteConnection {
public void disconnect() { public void disconnect() {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.disconnect(mConnectionId); mConnectionService.disconnect(mConnectionId, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -947,7 +947,7 @@ public final class RemoteConnection {
public void playDtmfTone(char digit) { public void playDtmfTone(char digit) {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.playDtmfTone(mConnectionId, digit); mConnectionService.playDtmfTone(mConnectionId, digit, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -963,7 +963,7 @@ public final class RemoteConnection {
public void stopDtmfTone() { public void stopDtmfTone() {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.stopDtmfTone(mConnectionId); mConnectionService.stopDtmfTone(mConnectionId, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -993,7 +993,8 @@ public final class RemoteConnection {
public void postDialContinue(boolean proceed) { public void postDialContinue(boolean proceed) {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.onPostDialContinue(mConnectionId, proceed); mConnectionService.onPostDialContinue(mConnectionId, proceed,
null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -1007,7 +1008,7 @@ public final class RemoteConnection {
public void pullExternalCall() { public void pullExternalCall() {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.pullExternalCall(mConnectionId); mConnectionService.pullExternalCall(mConnectionId, null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }
@@ -1034,7 +1035,8 @@ public final class RemoteConnection {
public void setCallAudioState(CallAudioState state) { public void setCallAudioState(CallAudioState state) {
try { try {
if (mConnected) { if (mConnected) {
mConnectionService.onCallAudioStateChanged(mConnectionId, state); mConnectionService.onCallAudioStateChanged(mConnectionId, state,
null /*Session.Info*/);
} }
} catch (RemoteException ignored) { } catch (RemoteException ignored) {
} }

View File

@@ -76,7 +76,7 @@ public class RemoteConnectionManager {
public void conferenceRemoteConnections(RemoteConnection a, RemoteConnection b) { public void conferenceRemoteConnections(RemoteConnection a, RemoteConnection b) {
if (a.getConnectionService() == b.getConnectionService()) { if (a.getConnectionService() == b.getConnectionService()) {
try { try {
a.getConnectionService().conference(a.getId(), b.getId()); a.getConnectionService().conference(a.getId(), b.getId(), null /*Session.Info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} else { } else {

View File

@@ -431,7 +431,8 @@ final class RemoteConnectionService {
request.getVideoState()); request.getVideoState());
try { try {
if (mConnectionById.isEmpty()) { if (mConnectionById.isEmpty()) {
mOutgoingConnectionServiceRpc.addConnectionServiceAdapter(mServant.getStub()); mOutgoingConnectionServiceRpc.addConnectionServiceAdapter(mServant.getStub(),
null /*Session.Info*/);
} }
RemoteConnection connection = RemoteConnection connection =
new RemoteConnection(id, mOutgoingConnectionServiceRpc, newRequest); new RemoteConnection(id, mOutgoingConnectionServiceRpc, newRequest);
@@ -442,7 +443,8 @@ final class RemoteConnectionService {
id, id,
newRequest, newRequest,
isIncoming, isIncoming,
false /* isUnknownCall */); false /* isUnknownCall */,
null /*Session.info*/);
connection.registerCallback(new RemoteConnection.Callback() { connection.registerCallback(new RemoteConnection.Callback() {
@Override @Override
public void onDestroyed(RemoteConnection connection) { public void onDestroyed(RemoteConnection connection) {
@@ -482,7 +484,8 @@ final class RemoteConnectionService {
private void maybeDisconnectAdapter() { private void maybeDisconnectAdapter() {
if (mConnectionById.isEmpty() && mConferenceById.isEmpty()) { if (mConnectionById.isEmpty() && mConferenceById.isEmpty()) {
try { try {
mOutgoingConnectionServiceRpc.removeConnectionServiceAdapter(mServant.getStub()); mOutgoingConnectionServiceRpc.removeConnectionServiceAdapter(mServant.getStub(),
null /*Session.info*/);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }

View File

@@ -19,6 +19,7 @@ package com.android.internal.telecom;
import android.os.Bundle; import android.os.Bundle;
import android.telecom.CallAudioState; import android.telecom.CallAudioState;
import android.telecom.ConnectionRequest; import android.telecom.ConnectionRequest;
import android.telecom.Logging.Session;
import android.telecom.PhoneAccountHandle; import android.telecom.PhoneAccountHandle;
import com.android.internal.telecom.IConnectionServiceAdapter; import com.android.internal.telecom.IConnectionServiceAdapter;
@@ -31,54 +32,58 @@ import com.android.internal.telecom.IConnectionServiceAdapter;
* @hide * @hide
*/ */
oneway interface IConnectionService { oneway interface IConnectionService {
void addConnectionServiceAdapter(in IConnectionServiceAdapter adapter); void addConnectionServiceAdapter(in IConnectionServiceAdapter adapter,
in Session.Info sessionInfo);
void removeConnectionServiceAdapter(in IConnectionServiceAdapter adapter); void removeConnectionServiceAdapter(in IConnectionServiceAdapter adapter,
in Session.Info sessionInfo);
void createConnection( void createConnection(
in PhoneAccountHandle connectionManagerPhoneAccount, in PhoneAccountHandle connectionManagerPhoneAccount,
String callId, String callId,
in ConnectionRequest request, in ConnectionRequest request,
boolean isIncoming, boolean isIncoming,
boolean isUnknown); boolean isUnknown,
in Session.Info sessionInfo);
void abort(String callId); void abort(String callId, in Session.Info sessionInfo);
void answerVideo(String callId, int videoState); void answerVideo(String callId, int videoState, in Session.Info sessionInfo);
void answer(String callId); void answer(String callId, in Session.Info sessionInfo);
void reject(String callId); void reject(String callId, in Session.Info sessionInfo);
void rejectWithMessage(String callId, String message); void rejectWithMessage(String callId, String message, in Session.Info sessionInfo);
void disconnect(String callId); void disconnect(String callId, in Session.Info sessionInfo);
void silence(String callId); void silence(String callId, in Session.Info sessionInfo);
void hold(String callId); void hold(String callId, in Session.Info sessionInfo);
void unhold(String callId); void unhold(String callId, in Session.Info sessionInfo);
void onCallAudioStateChanged(String activeCallId, in CallAudioState callAudioState); void onCallAudioStateChanged(String activeCallId, in CallAudioState callAudioState,
in Session.Info sessionInfo);
void playDtmfTone(String callId, char digit); void playDtmfTone(String callId, char digit, in Session.Info sessionInfo);
void stopDtmfTone(String callId); void stopDtmfTone(String callId, in Session.Info sessionInfo);
void conference(String conferenceCallId, String callId); void conference(String conferenceCallId, String callId, in Session.Info sessionInfo);
void splitFromConference(String callId); void splitFromConference(String callId, in Session.Info sessionInfo);
void mergeConference(String conferenceCallId); void mergeConference(String conferenceCallId, in Session.Info sessionInfo);
void swapConference(String conferenceCallId); void swapConference(String conferenceCallId, in Session.Info sessionInfo);
void onPostDialContinue(String callId, boolean proceed); void onPostDialContinue(String callId, boolean proceed, in Session.Info sessionInfo);
void pullExternalCall(String callId); void pullExternalCall(String callId, in Session.Info sessionInfo);
void sendCallEvent(String callId, String event, in Bundle extras); void sendCallEvent(String callId, String event, in Bundle extras, in Session.Info sessionInfo);
void onExtrasChanged(String callId, in Bundle extras); void onExtrasChanged(String callId, in Bundle extras, in Session.Info sessionInfo);
} }