Loading src/com/android/server/telecom/Call.java +9 −55 Original line number Diff line number Diff line Loading @@ -3427,51 +3427,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, */ public void sendCallEvent(String event, int targetSdkVer, Bundle extras) { if (mConnectionService != null || mTransactionalService != null) { if (android.telecom.Call.EVENT_REQUEST_HANDOVER.equals(event)) { if (targetSdkVer > Build.VERSION_CODES.P) { Log.e(this, new Exception(), "sendCallEvent failed. Use public api handoverTo" + " for API > 28(P)"); // Event-based Handover APIs are deprecated, so inform the user. mHandler.post(new Runnable() { @Override public void run() { mToastFactory.makeText(mContext, "WARNING: Event-based handover APIs are deprecated and will no" + " longer function in Android Q.", Toast.LENGTH_LONG).show(); } }); // Uncomment and remove toast at feature complete: return; } // Handover requests are targeted at Telecom, not the ConnectionService. if (extras == null) { Log.w(this, "sendCallEvent: %s event received with null extras.", android.telecom.Call.EVENT_REQUEST_HANDOVER); sendEventToService(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); return; } Parcelable parcelable = extras.getParcelable( android.telecom.Call.EXTRA_HANDOVER_PHONE_ACCOUNT_HANDLE); if (!(parcelable instanceof PhoneAccountHandle) || parcelable == null) { Log.w(this, "sendCallEvent: %s event received with invalid handover acct.", android.telecom.Call.EVENT_REQUEST_HANDOVER); sendEventToService(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); return; } PhoneAccountHandle phoneAccountHandle = (PhoneAccountHandle) parcelable; int videoState = extras.getInt(android.telecom.Call.EXTRA_HANDOVER_VIDEO_STATE, VideoProfile.STATE_AUDIO_ONLY); Parcelable handoverExtras = extras.getParcelable( android.telecom.Call.EXTRA_HANDOVER_EXTRAS); Bundle handoverExtrasBundle = null; if (handoverExtras instanceof Bundle) { handoverExtrasBundle = (Bundle) handoverExtras; } requestHandover(phoneAccountHandle, videoState, handoverExtrasBundle, true); } else { // Relay bluetooth call quality reports to the call diagnostic service. if (BluetoothCallQualityReport.EVENT_BLUETOOTH_CALL_QUALITY_REPORT.equals(event) && extras.containsKey( Loading @@ -3482,7 +3437,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } Log.addEvent(this, LogUtils.Events.CALL_EVENT, event); sendEventToService(this, event, extras); } } else { Log.e(this, new NullPointerException(), "sendCallEvent failed due to null CS callId=%s", getId()); Loading src/com/android/server/telecom/CallsManager.java +1 −33 Original line number Diff line number Diff line Loading @@ -1298,9 +1298,7 @@ public class CallsManager extends Call.ListenerBase @Override public void onHandoverRequested(Call call, PhoneAccountHandle handoverTo, int videoState, Bundle extras, boolean isLegacy) { if (isLegacy) { requestHandoverViaEvents(call, handoverTo, videoState, extras); } else { if (!isLegacy) { requestHandover(call, handoverTo, videoState, extras); } } Loading Loading @@ -4557,10 +4555,6 @@ public class CallsManager extends Call.ListenerBase if (handoverState == HandoverState.HANDOVER_FROM_STARTED) { // Disconnect before handover was accepted. Log.i(this, "setCallState: disconnect before handover accepted"); // Let the handover destination know that the source has disconnected prior to // completion of the handover. call.getHandoverDestinationCall().sendCallEvent( android.telecom.Call.EVENT_HANDOVER_SOURCE_DISCONNECTED, null); } else if (handoverState == HandoverState.HANDOVER_ACCEPTED) { Log.i(this, "setCallState: handover from complete"); completeHandoverFrom(call); Loading @@ -4578,11 +4572,9 @@ public class CallsManager extends Call.ListenerBase // Inform the "from" Call (ie the source call) that the handover from it has // completed; this allows the InCallService to be notified that a handover it // initiated completed. call.onConnectionEvent(Connection.EVENT_HANDOVER_COMPLETE, null); call.onHandoverComplete(); // Inform the "to" ConnectionService that handover to it has completed. handoverTo.sendCallEvent(android.telecom.Call.EVENT_HANDOVER_COMPLETE, null); handoverTo.onHandoverComplete(); answerCall(handoverTo, handoverTo.getVideoState()); call.markFinishedHandoverStateAndCleanup(HandoverState.HANDOVER_COMPLETE); Loading @@ -4605,7 +4597,6 @@ public class CallsManager extends Call.ListenerBase // Inform the "from" Call (ie the source call) that the handover from it has // failed; this allows the InCallService to be notified that a handover it // initiated failed. handoverFrom.onConnectionEvent(Connection.EVENT_HANDOVER_FAILED, null); handoverFrom.onHandoverFailed(android.telecom.Call.Callback.HANDOVER_FAILURE_USER_REJECTED); // Inform the "to" ConnectionService that handover to it has failed. This Loading @@ -4614,7 +4605,6 @@ public class CallsManager extends Call.ListenerBase // Only attempt if the call has a bound ConnectionService if handover failed // early on in the handover process, the CS will be unbound and we won't be // able to send the call event. handoverTo.sendCallEvent(android.telecom.Call.EVENT_HANDOVER_FAILED, null); handoverTo.getConnectionService().handoverFailed(handoverTo, android.telecom.Call.Callback.HANDOVER_FAILURE_USER_REJECTED); } Loading Loading @@ -5907,28 +5897,6 @@ public class CallsManager extends Call.ListenerBase call.disconnect("handover failed"); } /** * Called in response to a {@link Call} receiving a {@link Call#sendCallEvent(String, Bundle)} * of type {@link android.telecom.Call#EVENT_REQUEST_HANDOVER} indicating the * {@link android.telecom.InCallService} has requested a handover to another * {@link android.telecom.ConnectionService}. * * We will explicitly disallow a handover when there is an emergency call present. * * @param handoverFromCall The {@link Call} to be handed over. * @param handoverToHandle The {@link PhoneAccountHandle} to hand over the call to. * @param videoState The desired video state of {@link Call} after handover. * @param initiatingExtras Extras associated with the handover, to be passed to the handover * {@link android.telecom.ConnectionService}. */ private void requestHandoverViaEvents(Call handoverFromCall, PhoneAccountHandle handoverToHandle, int videoState, Bundle initiatingExtras) { handoverFromCall.sendCallEvent(android.telecom.Call.EVENT_HANDOVER_FAILED, null); Log.addEvent(handoverFromCall, LogUtils.Events.HANDOVER_REQUEST, "legacy request denied"); } /** * Called in response to a {@link Call} receiving a {@link Call#handoverTo(PhoneAccountHandle, * int, Bundle)} indicating the {@link android.telecom.InCallService} has requested a Loading tests/src/com/android/server/telecom/tests/CallsManagerTest.java +0 −11 Original line number Diff line number Diff line Loading @@ -3077,11 +3077,9 @@ public class CallsManagerTest extends TelecomTestCase { mCallsManager.createActionSetCallStateAndPerformAction( call, CallState.DISCONNECTED, ""); verify(sourceCall).onConnectionEvent(eq(Connection.EVENT_HANDOVER_FAILED), any()); verify(sourceCall).onHandoverFailed( android.telecom.Call.Callback.HANDOVER_FAILURE_USER_REJECTED); verify(call).sendCallEvent(eq(android.telecom.Call.EVENT_HANDOVER_FAILED), any()); verify(call).markFinishedHandoverStateAndCleanup(HandoverState.HANDOVER_FAILED); } Loading @@ -3094,9 +3092,6 @@ public class CallsManagerTest extends TelecomTestCase { when(call.getHandoverState()).thenReturn(HandoverState.HANDOVER_FROM_STARTED); mCallsManager.createActionSetCallStateAndPerformAction( call, CallState.DISCONNECTED, ""); verify(destinationCall).sendCallEvent( eq(android.telecom.Call.EVENT_HANDOVER_SOURCE_DISCONNECTED), any()); } @SmallTest Loading @@ -3110,11 +3105,8 @@ public class CallsManagerTest extends TelecomTestCase { mCallsManager.createActionSetCallStateAndPerformAction( call, CallState.DISCONNECTED, ""); verify(call).onConnectionEvent(eq(Connection.EVENT_HANDOVER_COMPLETE), any()); verify(call).onHandoverComplete(); verify(call).markFinishedHandoverStateAndCleanup(HandoverState.HANDOVER_COMPLETE); verify(destinationCall).sendCallEvent( eq(android.telecom.Call.EVENT_HANDOVER_COMPLETE), any()); verify(destinationCall).onHandoverComplete(); } Loading @@ -3131,11 +3123,8 @@ public class CallsManagerTest extends TelecomTestCase { mCallsManager.createActionSetCallStateAndPerformAction( call, CallState.DISCONNECTED, ""); verify(call).onConnectionEvent(eq(Connection.EVENT_HANDOVER_COMPLETE), any()); verify(call).onHandoverComplete(); verify(call).markFinishedHandoverStateAndCleanup(HandoverState.HANDOVER_COMPLETE); verify(destinationCall).sendCallEvent( eq(android.telecom.Call.EVENT_HANDOVER_COMPLETE), any()); verify(destinationCall).onHandoverComplete(); verify(otherCall).disconnect(); } Loading Loading
src/com/android/server/telecom/Call.java +9 −55 Original line number Diff line number Diff line Loading @@ -3427,51 +3427,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, */ public void sendCallEvent(String event, int targetSdkVer, Bundle extras) { if (mConnectionService != null || mTransactionalService != null) { if (android.telecom.Call.EVENT_REQUEST_HANDOVER.equals(event)) { if (targetSdkVer > Build.VERSION_CODES.P) { Log.e(this, new Exception(), "sendCallEvent failed. Use public api handoverTo" + " for API > 28(P)"); // Event-based Handover APIs are deprecated, so inform the user. mHandler.post(new Runnable() { @Override public void run() { mToastFactory.makeText(mContext, "WARNING: Event-based handover APIs are deprecated and will no" + " longer function in Android Q.", Toast.LENGTH_LONG).show(); } }); // Uncomment and remove toast at feature complete: return; } // Handover requests are targeted at Telecom, not the ConnectionService. if (extras == null) { Log.w(this, "sendCallEvent: %s event received with null extras.", android.telecom.Call.EVENT_REQUEST_HANDOVER); sendEventToService(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); return; } Parcelable parcelable = extras.getParcelable( android.telecom.Call.EXTRA_HANDOVER_PHONE_ACCOUNT_HANDLE); if (!(parcelable instanceof PhoneAccountHandle) || parcelable == null) { Log.w(this, "sendCallEvent: %s event received with invalid handover acct.", android.telecom.Call.EVENT_REQUEST_HANDOVER); sendEventToService(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); return; } PhoneAccountHandle phoneAccountHandle = (PhoneAccountHandle) parcelable; int videoState = extras.getInt(android.telecom.Call.EXTRA_HANDOVER_VIDEO_STATE, VideoProfile.STATE_AUDIO_ONLY); Parcelable handoverExtras = extras.getParcelable( android.telecom.Call.EXTRA_HANDOVER_EXTRAS); Bundle handoverExtrasBundle = null; if (handoverExtras instanceof Bundle) { handoverExtrasBundle = (Bundle) handoverExtras; } requestHandover(phoneAccountHandle, videoState, handoverExtrasBundle, true); } else { // Relay bluetooth call quality reports to the call diagnostic service. if (BluetoothCallQualityReport.EVENT_BLUETOOTH_CALL_QUALITY_REPORT.equals(event) && extras.containsKey( Loading @@ -3482,7 +3437,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } Log.addEvent(this, LogUtils.Events.CALL_EVENT, event); sendEventToService(this, event, extras); } } else { Log.e(this, new NullPointerException(), "sendCallEvent failed due to null CS callId=%s", getId()); Loading
src/com/android/server/telecom/CallsManager.java +1 −33 Original line number Diff line number Diff line Loading @@ -1298,9 +1298,7 @@ public class CallsManager extends Call.ListenerBase @Override public void onHandoverRequested(Call call, PhoneAccountHandle handoverTo, int videoState, Bundle extras, boolean isLegacy) { if (isLegacy) { requestHandoverViaEvents(call, handoverTo, videoState, extras); } else { if (!isLegacy) { requestHandover(call, handoverTo, videoState, extras); } } Loading Loading @@ -4557,10 +4555,6 @@ public class CallsManager extends Call.ListenerBase if (handoverState == HandoverState.HANDOVER_FROM_STARTED) { // Disconnect before handover was accepted. Log.i(this, "setCallState: disconnect before handover accepted"); // Let the handover destination know that the source has disconnected prior to // completion of the handover. call.getHandoverDestinationCall().sendCallEvent( android.telecom.Call.EVENT_HANDOVER_SOURCE_DISCONNECTED, null); } else if (handoverState == HandoverState.HANDOVER_ACCEPTED) { Log.i(this, "setCallState: handover from complete"); completeHandoverFrom(call); Loading @@ -4578,11 +4572,9 @@ public class CallsManager extends Call.ListenerBase // Inform the "from" Call (ie the source call) that the handover from it has // completed; this allows the InCallService to be notified that a handover it // initiated completed. call.onConnectionEvent(Connection.EVENT_HANDOVER_COMPLETE, null); call.onHandoverComplete(); // Inform the "to" ConnectionService that handover to it has completed. handoverTo.sendCallEvent(android.telecom.Call.EVENT_HANDOVER_COMPLETE, null); handoverTo.onHandoverComplete(); answerCall(handoverTo, handoverTo.getVideoState()); call.markFinishedHandoverStateAndCleanup(HandoverState.HANDOVER_COMPLETE); Loading @@ -4605,7 +4597,6 @@ public class CallsManager extends Call.ListenerBase // Inform the "from" Call (ie the source call) that the handover from it has // failed; this allows the InCallService to be notified that a handover it // initiated failed. handoverFrom.onConnectionEvent(Connection.EVENT_HANDOVER_FAILED, null); handoverFrom.onHandoverFailed(android.telecom.Call.Callback.HANDOVER_FAILURE_USER_REJECTED); // Inform the "to" ConnectionService that handover to it has failed. This Loading @@ -4614,7 +4605,6 @@ public class CallsManager extends Call.ListenerBase // Only attempt if the call has a bound ConnectionService if handover failed // early on in the handover process, the CS will be unbound and we won't be // able to send the call event. handoverTo.sendCallEvent(android.telecom.Call.EVENT_HANDOVER_FAILED, null); handoverTo.getConnectionService().handoverFailed(handoverTo, android.telecom.Call.Callback.HANDOVER_FAILURE_USER_REJECTED); } Loading Loading @@ -5907,28 +5897,6 @@ public class CallsManager extends Call.ListenerBase call.disconnect("handover failed"); } /** * Called in response to a {@link Call} receiving a {@link Call#sendCallEvent(String, Bundle)} * of type {@link android.telecom.Call#EVENT_REQUEST_HANDOVER} indicating the * {@link android.telecom.InCallService} has requested a handover to another * {@link android.telecom.ConnectionService}. * * We will explicitly disallow a handover when there is an emergency call present. * * @param handoverFromCall The {@link Call} to be handed over. * @param handoverToHandle The {@link PhoneAccountHandle} to hand over the call to. * @param videoState The desired video state of {@link Call} after handover. * @param initiatingExtras Extras associated with the handover, to be passed to the handover * {@link android.telecom.ConnectionService}. */ private void requestHandoverViaEvents(Call handoverFromCall, PhoneAccountHandle handoverToHandle, int videoState, Bundle initiatingExtras) { handoverFromCall.sendCallEvent(android.telecom.Call.EVENT_HANDOVER_FAILED, null); Log.addEvent(handoverFromCall, LogUtils.Events.HANDOVER_REQUEST, "legacy request denied"); } /** * Called in response to a {@link Call} receiving a {@link Call#handoverTo(PhoneAccountHandle, * int, Bundle)} indicating the {@link android.telecom.InCallService} has requested a Loading
tests/src/com/android/server/telecom/tests/CallsManagerTest.java +0 −11 Original line number Diff line number Diff line Loading @@ -3077,11 +3077,9 @@ public class CallsManagerTest extends TelecomTestCase { mCallsManager.createActionSetCallStateAndPerformAction( call, CallState.DISCONNECTED, ""); verify(sourceCall).onConnectionEvent(eq(Connection.EVENT_HANDOVER_FAILED), any()); verify(sourceCall).onHandoverFailed( android.telecom.Call.Callback.HANDOVER_FAILURE_USER_REJECTED); verify(call).sendCallEvent(eq(android.telecom.Call.EVENT_HANDOVER_FAILED), any()); verify(call).markFinishedHandoverStateAndCleanup(HandoverState.HANDOVER_FAILED); } Loading @@ -3094,9 +3092,6 @@ public class CallsManagerTest extends TelecomTestCase { when(call.getHandoverState()).thenReturn(HandoverState.HANDOVER_FROM_STARTED); mCallsManager.createActionSetCallStateAndPerformAction( call, CallState.DISCONNECTED, ""); verify(destinationCall).sendCallEvent( eq(android.telecom.Call.EVENT_HANDOVER_SOURCE_DISCONNECTED), any()); } @SmallTest Loading @@ -3110,11 +3105,8 @@ public class CallsManagerTest extends TelecomTestCase { mCallsManager.createActionSetCallStateAndPerformAction( call, CallState.DISCONNECTED, ""); verify(call).onConnectionEvent(eq(Connection.EVENT_HANDOVER_COMPLETE), any()); verify(call).onHandoverComplete(); verify(call).markFinishedHandoverStateAndCleanup(HandoverState.HANDOVER_COMPLETE); verify(destinationCall).sendCallEvent( eq(android.telecom.Call.EVENT_HANDOVER_COMPLETE), any()); verify(destinationCall).onHandoverComplete(); } Loading @@ -3131,11 +3123,8 @@ public class CallsManagerTest extends TelecomTestCase { mCallsManager.createActionSetCallStateAndPerformAction( call, CallState.DISCONNECTED, ""); verify(call).onConnectionEvent(eq(Connection.EVENT_HANDOVER_COMPLETE), any()); verify(call).onHandoverComplete(); verify(call).markFinishedHandoverStateAndCleanup(HandoverState.HANDOVER_COMPLETE); verify(destinationCall).sendCallEvent( eq(android.telecom.Call.EVENT_HANDOVER_COMPLETE), any()); verify(destinationCall).onHandoverComplete(); verify(otherCall).disconnect(); } Loading