Loading src/com/android/server/telecom/Call.java +22 −1 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, void onExtrasRemoved(Call c, int source, List<String> keys); void onHandleChanged(Call call); void onCallerDisplayNameChanged(Call call); void onCallDirectionChanged(Call call); void onVideoStateChanged(Call call, int previousVideoState, int newVideoState); void onTargetPhoneAccountChanged(Call call); void onConnectionManagerPhoneAccountChanged(Call call); Loading Loading @@ -197,6 +198,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, @Override public void onCallerDisplayNameChanged(Call call) {} @Override public void onCallDirectionChanged(Call call) {} @Override public void onVideoStateChanged(Call call, int previousVideoState, int newVideoState) {} @Override public void onTargetPhoneAccountChanged(Call call) {} Loading Loading @@ -258,7 +261,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, /** * One of CALL_DIRECTION_INCOMING, CALL_DIRECTION_OUTGOING, or CALL_DIRECTION_UNKNOWN */ private final int mCallDirection; private int mCallDirection; /** * The post-dial digits that were dialed after the network portion of the number Loading Loading @@ -3631,6 +3634,24 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } /** * Change the call direction. This is useful if it was not previously defined (for example in * single caller emulation mode). * @param callDirection The new direction of this call. */ // Make sure the callDirection has been mapped to the Call definition correctly! public void setCallDirection(int callDirection) { if (mCallDirection != callDirection) { Log.addEvent(this, LogUtils.Events.CALL_DIRECTION_CHANGED, "callDirection=" + callDirection); mCallDirection = callDirection; for (Listener l : mListeners) { // Update InCallService directly, do not notify CallsManager. l.onCallDirectionChanged(this); } } } /** * Sets the video history based on the state and state transitions of the call. Always add the * current video state to the video state history during a call transition except for the Loading src/com/android/server/telecom/ConnectionServiceWrapper.java +30 −0 Original line number Diff line number Diff line Loading @@ -1084,6 +1084,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements if (mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { Log.w(this, "setConferenceState from caller without permission."); Log.endSession(); return; } Loading @@ -1103,6 +1104,35 @@ public class ConnectionServiceWrapper extends ServiceBinder implements Log.endSession(); } } @Override public void setCallDirection(String callId, int direction, Session.Info sessionInfo) { Log.startSession(sessionInfo, "CSW.sCD"); if (mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { Log.w(this, "setCallDirection from caller without permission."); Log.endSession(); return; } long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { logIncoming("setCallDirection %s %d", callId, direction); Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setCallDirection(Call.getRemappedCallDirection(direction)); } } } catch (Throwable t) { Log.e(ConnectionServiceWrapper.this, t, ""); throw t; } finally { Binder.restoreCallingIdentity(token); Log.endSession(); } } } private final Adapter mAdapter = new Adapter(); Loading src/com/android/server/telecom/InCallController.java +5 −0 Original line number Diff line number Diff line Loading @@ -801,6 +801,11 @@ public class InCallController extends CallsManagerListenerBase { updateCall(call); } @Override public void onCallDirectionChanged(Call call) { updateCall(call); } @Override public void onVideoStateChanged(Call call, int previousVideoState, int newVideoState) { updateCall(call); Loading src/com/android/server/telecom/LogUtils.java +1 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,7 @@ public class LogUtils { public static final String REMOVE_CHILD = "REMOVE_CHILD"; public static final String SET_PARENT = "SET_PARENT"; public static final String CONF_STATE_CHANGED = "CONF_STATE_CHANGED"; public static final String CALL_DIRECTION_CHANGED = "CALL_DIRECTION_CHANGED"; public static final String MUTE = "MUTE"; public static final String UNMUTE = "UNMUTE"; public static final String AUDIO_ROUTE = "AUDIO_ROUTE"; Loading tests/src/com/android/server/telecom/tests/CallTest.java +32 −0 Original line number Diff line number Diff line Loading @@ -301,4 +301,36 @@ public class CallTest extends TelecomTestCase { verify(mMockConnectionService, never()).pullExternalCall(any()); verify(mMockToast).show(); } @Test @SmallTest public void testCallDirection() { Call call = new Call( "1", /* callId */ mContext, mMockCallsManager, mLock, null /* ConnectionServiceRepository */, mMockPhoneNumberUtilsAdapter, TEST_ADDRESS, null /* GatewayInfo */, null /* connectionManagerPhoneAccountHandle */, SIM_1_HANDLE, Call.CALL_DIRECTION_UNDEFINED, false /* shouldAttachToExistingConnection*/, true /* isConference */, mMockClockProxy, mMockToastProxy); boolean[] hasCallDirectionChanged = new boolean[1]; call.addListener(new Call.ListenerBase() { @Override public void onCallDirectionChanged(Call call) { hasCallDirectionChanged[0] = true; } }); assertFalse(call.isIncoming()); call.setCallDirection(Call.CALL_DIRECTION_INCOMING); assertTrue(hasCallDirectionChanged[0]); assertTrue(call.isIncoming()); } } Loading
src/com/android/server/telecom/Call.java +22 −1 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, void onExtrasRemoved(Call c, int source, List<String> keys); void onHandleChanged(Call call); void onCallerDisplayNameChanged(Call call); void onCallDirectionChanged(Call call); void onVideoStateChanged(Call call, int previousVideoState, int newVideoState); void onTargetPhoneAccountChanged(Call call); void onConnectionManagerPhoneAccountChanged(Call call); Loading Loading @@ -197,6 +198,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, @Override public void onCallerDisplayNameChanged(Call call) {} @Override public void onCallDirectionChanged(Call call) {} @Override public void onVideoStateChanged(Call call, int previousVideoState, int newVideoState) {} @Override public void onTargetPhoneAccountChanged(Call call) {} Loading Loading @@ -258,7 +261,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, /** * One of CALL_DIRECTION_INCOMING, CALL_DIRECTION_OUTGOING, or CALL_DIRECTION_UNKNOWN */ private final int mCallDirection; private int mCallDirection; /** * The post-dial digits that were dialed after the network portion of the number Loading Loading @@ -3631,6 +3634,24 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } /** * Change the call direction. This is useful if it was not previously defined (for example in * single caller emulation mode). * @param callDirection The new direction of this call. */ // Make sure the callDirection has been mapped to the Call definition correctly! public void setCallDirection(int callDirection) { if (mCallDirection != callDirection) { Log.addEvent(this, LogUtils.Events.CALL_DIRECTION_CHANGED, "callDirection=" + callDirection); mCallDirection = callDirection; for (Listener l : mListeners) { // Update InCallService directly, do not notify CallsManager. l.onCallDirectionChanged(this); } } } /** * Sets the video history based on the state and state transitions of the call. Always add the * current video state to the video state history during a call transition except for the Loading
src/com/android/server/telecom/ConnectionServiceWrapper.java +30 −0 Original line number Diff line number Diff line Loading @@ -1084,6 +1084,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements if (mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { Log.w(this, "setConferenceState from caller without permission."); Log.endSession(); return; } Loading @@ -1103,6 +1104,35 @@ public class ConnectionServiceWrapper extends ServiceBinder implements Log.endSession(); } } @Override public void setCallDirection(String callId, int direction, Session.Info sessionInfo) { Log.startSession(sessionInfo, "CSW.sCD"); if (mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { Log.w(this, "setCallDirection from caller without permission."); Log.endSession(); return; } long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { logIncoming("setCallDirection %s %d", callId, direction); Call call = mCallIdMapper.getCall(callId); if (call != null) { call.setCallDirection(Call.getRemappedCallDirection(direction)); } } } catch (Throwable t) { Log.e(ConnectionServiceWrapper.this, t, ""); throw t; } finally { Binder.restoreCallingIdentity(token); Log.endSession(); } } } private final Adapter mAdapter = new Adapter(); Loading
src/com/android/server/telecom/InCallController.java +5 −0 Original line number Diff line number Diff line Loading @@ -801,6 +801,11 @@ public class InCallController extends CallsManagerListenerBase { updateCall(call); } @Override public void onCallDirectionChanged(Call call) { updateCall(call); } @Override public void onVideoStateChanged(Call call, int previousVideoState, int newVideoState) { updateCall(call); Loading
src/com/android/server/telecom/LogUtils.java +1 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,7 @@ public class LogUtils { public static final String REMOVE_CHILD = "REMOVE_CHILD"; public static final String SET_PARENT = "SET_PARENT"; public static final String CONF_STATE_CHANGED = "CONF_STATE_CHANGED"; public static final String CALL_DIRECTION_CHANGED = "CALL_DIRECTION_CHANGED"; public static final String MUTE = "MUTE"; public static final String UNMUTE = "UNMUTE"; public static final String AUDIO_ROUTE = "AUDIO_ROUTE"; Loading
tests/src/com/android/server/telecom/tests/CallTest.java +32 −0 Original line number Diff line number Diff line Loading @@ -301,4 +301,36 @@ public class CallTest extends TelecomTestCase { verify(mMockConnectionService, never()).pullExternalCall(any()); verify(mMockToast).show(); } @Test @SmallTest public void testCallDirection() { Call call = new Call( "1", /* callId */ mContext, mMockCallsManager, mLock, null /* ConnectionServiceRepository */, mMockPhoneNumberUtilsAdapter, TEST_ADDRESS, null /* GatewayInfo */, null /* connectionManagerPhoneAccountHandle */, SIM_1_HANDLE, Call.CALL_DIRECTION_UNDEFINED, false /* shouldAttachToExistingConnection*/, true /* isConference */, mMockClockProxy, mMockToastProxy); boolean[] hasCallDirectionChanged = new boolean[1]; call.addListener(new Call.ListenerBase() { @Override public void onCallDirectionChanged(Call call) { hasCallDirectionChanged[0] = true; } }); assertFalse(call.isIncoming()); call.setCallDirection(Call.CALL_DIRECTION_INCOMING); assertTrue(hasCallDirectionChanged[0]); assertTrue(call.isIncoming()); } }