Remove unused handover code.
Remove unused hidden handover code.
These extras are not used anywhere. Removing them and the associated
code.
Flag: Code cleanup only; no functional impact since this is orphaned code.
Test: Compile code to verify no build errors.
Bug: 308003610
Change-Id: I59bc7fefcdf7d2c9f40c06b0a1a44809db055067
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 1ec113c..8b9d07d 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -3427,62 +3427,16 @@
*/
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(
- BluetoothCallQualityReport.EXTRA_BLUETOOTH_CALL_QUALITY_REPORT)) {
- notifyBluetoothCallQualityReport(extras.getParcelable(
- BluetoothCallQualityReport.EXTRA_BLUETOOTH_CALL_QUALITY_REPORT
- ));
- }
- Log.addEvent(this, LogUtils.Events.CALL_EVENT, event);
- sendEventToService(this, event, extras);
+ // Relay bluetooth call quality reports to the call diagnostic service.
+ if (BluetoothCallQualityReport.EVENT_BLUETOOTH_CALL_QUALITY_REPORT.equals(event)
+ && extras.containsKey(
+ BluetoothCallQualityReport.EXTRA_BLUETOOTH_CALL_QUALITY_REPORT)) {
+ notifyBluetoothCallQualityReport(extras.getParcelable(
+ BluetoothCallQualityReport.EXTRA_BLUETOOTH_CALL_QUALITY_REPORT
+ ));
}
+ 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());
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index b04e9fa..22d8a02 100755
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -1298,9 +1298,7 @@
@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);
}
}
@@ -4557,10 +4555,6 @@
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);
@@ -4578,11 +4572,9 @@
// 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);
@@ -4605,7 +4597,6 @@
// 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
@@ -4614,7 +4605,6 @@
// 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);
}
@@ -5908,28 +5898,6 @@
}
/**
- * 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
* handover to another {@link android.telecom.ConnectionService}.
diff --git a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
index 6e0e660..c3baf24 100644
--- a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
@@ -3077,11 +3077,9 @@
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);
}
@@ -3094,9 +3092,6 @@
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
@@ -3110,11 +3105,8 @@
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();
}
@@ -3131,11 +3123,8 @@
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();
}