Loading src/com/android/server/telecom/Call.java +21 −3 Original line number Diff line number Diff line Loading @@ -1667,7 +1667,15 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, */ @VisibleForTesting public void disconnect(long disconnectionTimeout) { Log.addEvent(this, LogUtils.Events.REQUEST_DISCONNECT); disconnect(disconnectionTimeout, "internal" /** callingPackage */); } /** * Attempts to disconnect the call through the connection service. */ @VisibleForTesting public void disconnect(long disconnectionTimeout, String callingPackage) { Log.addEvent(this, LogUtils.Events.REQUEST_DISCONNECT, callingPackage); // Track that the call is now locally disconnecting. setLocallyDisconnecting(true); Loading Loading @@ -1788,6 +1796,17 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, */ @VisibleForTesting public void reject(boolean rejectWithMessage, String textMessage) { reject(rejectWithMessage, textMessage, "internal" /** callingPackage */); } /** * Rejects the call if it is ringing. * * @param rejectWithMessage Whether to send a text message as part of the call rejection. * @param textMessage An optional text message to send as part of the rejection. */ @VisibleForTesting public void reject(boolean rejectWithMessage, String textMessage, String callingPackage) { // Check to verify that the call is still in the ringing state. A call can change states // between the time the user hits 'reject' and Telecomm receives the command. if (isRinging("reject")) { Loading @@ -1800,8 +1819,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, Log.e(this, new NullPointerException(), "reject call failed due to null CS callId=%s", getId()); } Log.addEvent(this, LogUtils.Events.REQUEST_REJECT); Log.addEvent(this, LogUtils.Events.REQUEST_REJECT, callingPackage); } } Loading src/com/android/server/telecom/TelecomServiceImpl.java +5 −5 Original line number Diff line number Diff line Loading @@ -766,7 +766,7 @@ public class TelecomServiceImpl { * @see android.telecom.TelecomManager#endCall */ @Override public boolean endCall() { public boolean endCall(String callingPackage) { try { Log.startSession("TSI.eC"); synchronized (mLock) { Loading @@ -774,7 +774,7 @@ public class TelecomServiceImpl { long token = Binder.clearCallingIdentity(); try { return endCallInternal(); return endCallInternal(callingPackage); } finally { Binder.restoreCallingIdentity(token); } Loading Loading @@ -1560,7 +1560,7 @@ public class TelecomServiceImpl { } } private boolean endCallInternal() { private boolean endCallInternal(String callingPackage) { // Always operate on the foreground call if one exists, otherwise get the first call in // priority order by call-state. Call call = mCallsManager.getForegroundCall(); Loading @@ -1575,9 +1575,9 @@ public class TelecomServiceImpl { if (call != null) { if (call.getState() == CallState.RINGING) { call.reject(false /* rejectWithMessage */, null); call.reject(false /* rejectWithMessage */, null, callingPackage); } else { call.disconnect(); call.disconnect(0 /* disconnectionTimeout */, callingPackage); } return true; } Loading tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -843,7 +843,7 @@ public class TelecomServiceImplTest extends TelecomTestCase { Call call = mock(Call.class); when(call.getState()).thenReturn(CallState.RINGING); when(mFakeCallsManager.getForegroundCall()).thenReturn(call); assertTrue(mTSIBinder.endCall()); assertTrue(mTSIBinder.endCall(null)); verify(call).reject(false, null); } Loading @@ -853,7 +853,7 @@ public class TelecomServiceImplTest extends TelecomTestCase { Call call = mock(Call.class); when(call.getState()).thenReturn(CallState.ACTIVE); when(mFakeCallsManager.getForegroundCall()).thenReturn(call); assertTrue(mTSIBinder.endCall()); assertTrue(mTSIBinder.endCall(null)); verify(call).disconnect(); } Loading @@ -864,14 +864,14 @@ public class TelecomServiceImplTest extends TelecomTestCase { when(call.getState()).thenReturn(CallState.ACTIVE); when(mFakeCallsManager.getFirstCallWithState(any())) .thenReturn(call); assertTrue(mTSIBinder.endCall()); assertTrue(mTSIBinder.endCall(null)); verify(call).disconnect(); } @SmallTest @Test public void testEndCallWithNoCalls() throws Exception { assertFalse(mTSIBinder.endCall()); assertFalse(mTSIBinder.endCall(null)); } @SmallTest Loading Loading
src/com/android/server/telecom/Call.java +21 −3 Original line number Diff line number Diff line Loading @@ -1667,7 +1667,15 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, */ @VisibleForTesting public void disconnect(long disconnectionTimeout) { Log.addEvent(this, LogUtils.Events.REQUEST_DISCONNECT); disconnect(disconnectionTimeout, "internal" /** callingPackage */); } /** * Attempts to disconnect the call through the connection service. */ @VisibleForTesting public void disconnect(long disconnectionTimeout, String callingPackage) { Log.addEvent(this, LogUtils.Events.REQUEST_DISCONNECT, callingPackage); // Track that the call is now locally disconnecting. setLocallyDisconnecting(true); Loading Loading @@ -1788,6 +1796,17 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, */ @VisibleForTesting public void reject(boolean rejectWithMessage, String textMessage) { reject(rejectWithMessage, textMessage, "internal" /** callingPackage */); } /** * Rejects the call if it is ringing. * * @param rejectWithMessage Whether to send a text message as part of the call rejection. * @param textMessage An optional text message to send as part of the rejection. */ @VisibleForTesting public void reject(boolean rejectWithMessage, String textMessage, String callingPackage) { // Check to verify that the call is still in the ringing state. A call can change states // between the time the user hits 'reject' and Telecomm receives the command. if (isRinging("reject")) { Loading @@ -1800,8 +1819,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, Log.e(this, new NullPointerException(), "reject call failed due to null CS callId=%s", getId()); } Log.addEvent(this, LogUtils.Events.REQUEST_REJECT); Log.addEvent(this, LogUtils.Events.REQUEST_REJECT, callingPackage); } } Loading
src/com/android/server/telecom/TelecomServiceImpl.java +5 −5 Original line number Diff line number Diff line Loading @@ -766,7 +766,7 @@ public class TelecomServiceImpl { * @see android.telecom.TelecomManager#endCall */ @Override public boolean endCall() { public boolean endCall(String callingPackage) { try { Log.startSession("TSI.eC"); synchronized (mLock) { Loading @@ -774,7 +774,7 @@ public class TelecomServiceImpl { long token = Binder.clearCallingIdentity(); try { return endCallInternal(); return endCallInternal(callingPackage); } finally { Binder.restoreCallingIdentity(token); } Loading Loading @@ -1560,7 +1560,7 @@ public class TelecomServiceImpl { } } private boolean endCallInternal() { private boolean endCallInternal(String callingPackage) { // Always operate on the foreground call if one exists, otherwise get the first call in // priority order by call-state. Call call = mCallsManager.getForegroundCall(); Loading @@ -1575,9 +1575,9 @@ public class TelecomServiceImpl { if (call != null) { if (call.getState() == CallState.RINGING) { call.reject(false /* rejectWithMessage */, null); call.reject(false /* rejectWithMessage */, null, callingPackage); } else { call.disconnect(); call.disconnect(0 /* disconnectionTimeout */, callingPackage); } return true; } Loading
tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -843,7 +843,7 @@ public class TelecomServiceImplTest extends TelecomTestCase { Call call = mock(Call.class); when(call.getState()).thenReturn(CallState.RINGING); when(mFakeCallsManager.getForegroundCall()).thenReturn(call); assertTrue(mTSIBinder.endCall()); assertTrue(mTSIBinder.endCall(null)); verify(call).reject(false, null); } Loading @@ -853,7 +853,7 @@ public class TelecomServiceImplTest extends TelecomTestCase { Call call = mock(Call.class); when(call.getState()).thenReturn(CallState.ACTIVE); when(mFakeCallsManager.getForegroundCall()).thenReturn(call); assertTrue(mTSIBinder.endCall()); assertTrue(mTSIBinder.endCall(null)); verify(call).disconnect(); } Loading @@ -864,14 +864,14 @@ public class TelecomServiceImplTest extends TelecomTestCase { when(call.getState()).thenReturn(CallState.ACTIVE); when(mFakeCallsManager.getFirstCallWithState(any())) .thenReturn(call); assertTrue(mTSIBinder.endCall()); assertTrue(mTSIBinder.endCall(null)); verify(call).disconnect(); } @SmallTest @Test public void testEndCallWithNoCalls() throws Exception { assertFalse(mTSIBinder.endCall()); assertFalse(mTSIBinder.endCall(null)); } @SmallTest Loading