Loading src/com/android/server/telecom/Call.java +32 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ import android.widget.Toast; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telecom.IVideoProvider; import com.android.internal.util.Preconditions; import com.android.server.telecom.ui.DisconnectedCallNotifier; import com.android.server.telecom.ui.ToastFactory; import java.io.IOException; Loading Loading @@ -2273,6 +2272,38 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } /** * Reject this Telecom call with the user-indicated reason. * @param rejectReason The user-indicated reason fore rejecting the call. */ public void reject(@android.telecom.Call.RejectReason int rejectReason) { if (mState == CallState.SIMULATED_RINGING) { // This handles the case where the user manually rejects a call that's in simulated // ringing. Since the call is already active on the connectionservice side, we want to // hangup, not reject. // Since its simulated reason we can't pass along the reject reason. setOverrideDisconnectCauseCode(new DisconnectCause(DisconnectCause.REJECTED)); if (mConnectionService != null) { mConnectionService.disconnect(this); } else { Log.e(this, new NullPointerException(), "reject call failed due to null CS callId=%s", getId()); } Log.addEvent(this, LogUtils.Events.REQUEST_REJECT); } else if (isRinging("reject")) { // Ensure video state history tracks video state at time of rejection. mVideoStateHistory |= mVideoState; if (mConnectionService != null) { mConnectionService.rejectWithReason(this, rejectReason); } else { Log.e(this, new NullPointerException(), "reject call failed due to null CS callId=%s", getId()); } Log.addEvent(this, LogUtils.Events.REQUEST_REJECT, rejectReason); } } /** * Puts the call on hold if it is currently active. */ Loading src/com/android/server/telecom/CallsManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -2363,6 +2363,25 @@ public class CallsManager extends Call.ListenerBase } } /** * Instructs Telecom to reject the specified call. Intended to be invoked by the in-call * app through {@link InCallAdapter} after Telecom notifies it of an incoming call followed by * the user opting to reject said call. */ @VisibleForTesting public void rejectCall(Call call, @android.telecom.Call.RejectReason int rejectReason) { if (!mCalls.contains(call)) { Log.i(this, "Request to reject a non-existent call %s", call); } else { for (CallsManagerListener listener : mListeners) { listener.onIncomingCallRejected(call, false /* rejectWithMessage */, null /* textMessage */); } call.reject(rejectReason); } } /** * Instructs Telecom to play the specified DTMF tone within the specified call. * Loading src/com/android/server/telecom/ConnectionServiceWrapper.java +13 −0 Original line number Diff line number Diff line Loading @@ -1551,6 +1551,19 @@ public class ConnectionServiceWrapper extends ServiceBinder implements } } /** @see IConnectionService#reject(String, Session.Info) */ void rejectWithReason(Call call, @android.telecom.Call.RejectReason int rejectReason) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("rejectReason")) { try { logOutgoing("rejectReason %s, %d", callId, rejectReason); mServiceInterface.rejectWithReason(callId, rejectReason, Log.getExternalSession()); } catch (RemoteException e) { } } } /** @see IConnectionService#playDtmfTone(String, char, Session.Info) */ void playDtmfTone(Call call, char digit) { final String callId = mCallIdMapper.getCallId(call); Loading src/com/android/server/telecom/InCallAdapter.java +26 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,32 @@ class InCallAdapter extends IInCallAdapter.Stub { } } @Override public void rejectCallWithReason(String callId, @android.telecom.Call.RejectReason int rejectReason) { try { Log.startSession(LogUtils.Sessions.ICA_REJECT_CALL, mOwnerPackageName); int callingUid = Binder.getCallingUid(); long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Log.d(this, "rejectCallWithReason(%s,%d)", callId, rejectReason); Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.rejectCall(call, rejectReason); } else { Log.w(this, "rejectCallWithReason, unknown call id: %s", callId); } } } finally { Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); } } @Override public void playDtmfTone(String callId, char digit) { try { Loading tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java +5 −0 Original line number Diff line number Diff line Loading @@ -306,6 +306,11 @@ public class ConnectionServiceFixture implements TestFixture<IConnectionService> rejectedCallIds.add(callId); } @Override public void rejectWithReason(java.lang.String callId, int rejectReason, android.telecom.Logging.Session.Info sessionInfo) throws RemoteException { rejectedCallIds.add(callId); } @Override public void rejectWithMessage(String callId, String message, Session.Info info) throws RemoteException { Loading Loading
src/com/android/server/telecom/Call.java +32 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ import android.widget.Toast; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telecom.IVideoProvider; import com.android.internal.util.Preconditions; import com.android.server.telecom.ui.DisconnectedCallNotifier; import com.android.server.telecom.ui.ToastFactory; import java.io.IOException; Loading Loading @@ -2273,6 +2272,38 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } /** * Reject this Telecom call with the user-indicated reason. * @param rejectReason The user-indicated reason fore rejecting the call. */ public void reject(@android.telecom.Call.RejectReason int rejectReason) { if (mState == CallState.SIMULATED_RINGING) { // This handles the case where the user manually rejects a call that's in simulated // ringing. Since the call is already active on the connectionservice side, we want to // hangup, not reject. // Since its simulated reason we can't pass along the reject reason. setOverrideDisconnectCauseCode(new DisconnectCause(DisconnectCause.REJECTED)); if (mConnectionService != null) { mConnectionService.disconnect(this); } else { Log.e(this, new NullPointerException(), "reject call failed due to null CS callId=%s", getId()); } Log.addEvent(this, LogUtils.Events.REQUEST_REJECT); } else if (isRinging("reject")) { // Ensure video state history tracks video state at time of rejection. mVideoStateHistory |= mVideoState; if (mConnectionService != null) { mConnectionService.rejectWithReason(this, rejectReason); } else { Log.e(this, new NullPointerException(), "reject call failed due to null CS callId=%s", getId()); } Log.addEvent(this, LogUtils.Events.REQUEST_REJECT, rejectReason); } } /** * Puts the call on hold if it is currently active. */ Loading
src/com/android/server/telecom/CallsManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -2363,6 +2363,25 @@ public class CallsManager extends Call.ListenerBase } } /** * Instructs Telecom to reject the specified call. Intended to be invoked by the in-call * app through {@link InCallAdapter} after Telecom notifies it of an incoming call followed by * the user opting to reject said call. */ @VisibleForTesting public void rejectCall(Call call, @android.telecom.Call.RejectReason int rejectReason) { if (!mCalls.contains(call)) { Log.i(this, "Request to reject a non-existent call %s", call); } else { for (CallsManagerListener listener : mListeners) { listener.onIncomingCallRejected(call, false /* rejectWithMessage */, null /* textMessage */); } call.reject(rejectReason); } } /** * Instructs Telecom to play the specified DTMF tone within the specified call. * Loading
src/com/android/server/telecom/ConnectionServiceWrapper.java +13 −0 Original line number Diff line number Diff line Loading @@ -1551,6 +1551,19 @@ public class ConnectionServiceWrapper extends ServiceBinder implements } } /** @see IConnectionService#reject(String, Session.Info) */ void rejectWithReason(Call call, @android.telecom.Call.RejectReason int rejectReason) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("rejectReason")) { try { logOutgoing("rejectReason %s, %d", callId, rejectReason); mServiceInterface.rejectWithReason(callId, rejectReason, Log.getExternalSession()); } catch (RemoteException e) { } } } /** @see IConnectionService#playDtmfTone(String, char, Session.Info) */ void playDtmfTone(Call call, char digit) { final String callId = mCallIdMapper.getCallId(call); Loading
src/com/android/server/telecom/InCallAdapter.java +26 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,32 @@ class InCallAdapter extends IInCallAdapter.Stub { } } @Override public void rejectCallWithReason(String callId, @android.telecom.Call.RejectReason int rejectReason) { try { Log.startSession(LogUtils.Sessions.ICA_REJECT_CALL, mOwnerPackageName); int callingUid = Binder.getCallingUid(); long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Log.d(this, "rejectCallWithReason(%s,%d)", callId, rejectReason); Call call = mCallIdMapper.getCall(callId); if (call != null) { mCallsManager.rejectCall(call, rejectReason); } else { Log.w(this, "rejectCallWithReason, unknown call id: %s", callId); } } } finally { Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); } } @Override public void playDtmfTone(String callId, char digit) { try { Loading
tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java +5 −0 Original line number Diff line number Diff line Loading @@ -306,6 +306,11 @@ public class ConnectionServiceFixture implements TestFixture<IConnectionService> rejectedCallIds.add(callId); } @Override public void rejectWithReason(java.lang.String callId, int rejectReason, android.telecom.Logging.Session.Info sessionInfo) throws RemoteException { rejectedCallIds.add(callId); } @Override public void rejectWithMessage(String callId, String message, Session.Info info) throws RemoteException { Loading