diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-17 16:52:28 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-17 16:52:28 +0000 |
commit | 0d1362b28afb4a71b8b2a56bad2be3fcf2802de6 (patch) | |
tree | 91fb2d0f5c065f024a7332ec664c794cdf30f413 /java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java | |
parent | 5a6cb962ae30ad9e308b5bcc00920daf84618808 (diff) | |
parent | c114cce52656e6ace2ffdfd075b0e8cd140cd498 (diff) |
Merge changes I84ec0ac5,I2b92e1e0,Ic30fa6c6
* changes:
Move Duo related constants out of interface
Dismissing location prompt now actually prevents it from reshowing.
Add GSM conference calling to simulator.
Diffstat (limited to 'java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java')
-rw-r--r-- | java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java b/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java index 8eefb48d9..f478d55d0 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java +++ b/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java @@ -25,6 +25,7 @@ import android.view.ActionProvider; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.ThreadUtil; +import com.android.dialer.simulator.Simulator; import com.android.dialer.simulator.Simulator.Event; /** Entry point in the simulator to create voice calls. */ @@ -37,7 +38,10 @@ final class SimulatorVoiceCall return new SimulatorSubMenu(context) .addItem("Incoming call", () -> new SimulatorVoiceCall(context).addNewIncomingCall(false)) .addItem("Outgoing call", () -> new SimulatorVoiceCall(context).addNewOutgoingCall()) - .addItem("Spam call", () -> new SimulatorVoiceCall(context).addNewIncomingCall(true)); + .addItem("Spam call", () -> new SimulatorVoiceCall(context).addNewIncomingCall(true)) + .addItem( + "GSM conference", + () -> new SimulatorConferenceCreator(context, Simulator.CONFERENCE_TYPE_GSM).start(5)); } private SimulatorVoiceCall(@NonNull Context context) { @@ -62,21 +66,28 @@ final class SimulatorVoiceCall @Override public void onNewOutgoingConnection(@NonNull SimulatorConnection connection) { - if (connection.getExtras().getBoolean(connectionTag)) { + if (isMyConnection(connection)) { LogUtil.i("SimulatorVoiceCall.onNewOutgoingConnection", "connection created"); handleNewConnection(connection); - connection.setActive(); + + // Telecom will force the connection to switch to Dialing when we return it. Wait until after + // we're returned it before changing call state. + ThreadUtil.postOnUiThread(connection::setActive); } } @Override public void onNewIncomingConnection(@NonNull SimulatorConnection connection) { - if (connection.getExtras().getBoolean(connectionTag)) { + if (isMyConnection(connection)) { LogUtil.i("SimulatorVoiceCall.onNewIncomingConnection", "connection created"); handleNewConnection(connection); } } + @Override + public void onConference( + @NonNull SimulatorConnection connection1, @NonNull SimulatorConnection connection2) {} + private void handleNewConnection(@NonNull SimulatorConnection connection) { connection.addListener(this); connection.setConnectionCapabilities( @@ -85,6 +96,10 @@ final class SimulatorVoiceCall | Connection.CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL); } + private boolean isMyConnection(@NonNull Connection connection) { + return connection.getExtras().getBoolean(connectionTag); + } + @Override public void onEvent(@NonNull SimulatorConnection connection, @NonNull Event event) { switch (event.type) { @@ -105,15 +120,12 @@ final class SimulatorVoiceCall case Event.DISCONNECT: connection.setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); break; - case Event.STATE_CHANGE: - break; - case Event.DTMF: - break; case Event.SESSION_MODIFY_REQUEST: ThreadUtil.postDelayedOnUiThread(() -> connection.handleSessionModifyRequest(event), 2000); break; default: - throw Assert.createIllegalStateFailException(); + LogUtil.i("SimulatorVoiceCall.onEvent", "unexpected event: " + event.type); + break; } } } |