diff options
Diffstat (limited to 'java/com/android/dialer/simulator')
10 files changed, 369 insertions, 30 deletions
diff --git a/java/com/android/dialer/simulator/Simulator.java b/java/com/android/dialer/simulator/Simulator.java index 3c2526be7..11a07d974 100644 --- a/java/com/android/dialer/simulator/Simulator.java +++ b/java/com/android/dialer/simulator/Simulator.java @@ -101,6 +101,9 @@ public interface Simulator { MERGE, SEPARATE, SWAP, + START_RTT, + STOP_RTT, + HANDLE_RTT_UPGRADE_RESPONSE, }) public @interface Type {} @@ -118,6 +121,9 @@ public interface Simulator { public static final int MERGE = 11; public static final int SEPARATE = 12; public static final int SWAP = 13; + public static final int START_RTT = 14; + public static final int STOP_RTT = 15; + public static final int HANDLE_RTT_UPGRADE_RESPONSE = 16; @Type public final int type; /** Holds event specific information. For example, for DTMF this could be the keycode. */ diff --git a/java/com/android/dialer/simulator/impl/RttChatBot.java b/java/com/android/dialer/simulator/impl/RttChatBot.java new file mode 100644 index 000000000..9c2989a07 --- /dev/null +++ b/java/com/android/dialer/simulator/impl/RttChatBot.java @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.dialer.simulator.impl; + +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Looper; +import android.support.annotation.MainThread; +import android.telecom.Connection.RttTextStream; +import com.android.dialer.common.Assert; +import com.android.dialer.common.LogUtil; +import com.android.incallui.rtt.protocol.Constants; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** Chat bot to generate remote RTT chat messages. */ +public class RttChatBot { + + interface Callback { + void type(String text); + } + + private static final int START_SENDING = 1; + private static final int SEND_MESSAGE = 2; + + private static final String[] CANDIDATE_MESSAGES = + new String[] { + "To RTT or not to RTT, that is the question...", + "Making TTY great again!", + "I would be more comfortable with real \"Thyme\" chatting." + + " I don't know how to end this pun", + "お疲れ様でした", + "The FCC has mandated that I respond... I will do so begrudgingly", + "😂😂😂💯" + }; + + private final MessageHandler messageHandler; + private final HandlerThread handlerThread; + + RttChatBot(RttTextStream rttTextStream) { + handlerThread = new HandlerThread("RttChatBot"); + handlerThread.start(); + messageHandler = new MessageHandler(handlerThread.getLooper(), rttTextStream); + } + + @MainThread + public void start() { + Assert.isMainThread(); + LogUtil.enterBlock("RttChatBot.start"); + messageHandler.sendEmptyMessage(START_SENDING); + } + + @MainThread + public void stop() { + Assert.isMainThread(); + LogUtil.enterBlock("RttChatBot.stop"); + if (handlerThread != null && handlerThread.isAlive()) { + handlerThread.quit(); + } + } + + private static class MessageHandler extends Handler { + private final RttTextStream rttTextStream; + private final Random random = new Random(); + private final List<String> messageQueue = new ArrayList<>(); + private int currentTypingPosition = -1; + private String currentTypingMessage = null; + + MessageHandler(Looper looper, RttTextStream rttTextStream) { + super(looper); + this.rttTextStream = rttTextStream; + } + + @Override + public void handleMessage(android.os.Message msg) { + switch (msg.what) { + case START_SENDING: + sendMessage(obtainMessage(SEND_MESSAGE, nextTyping())); + break; + case SEND_MESSAGE: + String message = (String) msg.obj; + LogUtil.w("test", "type: %s, to stream: %s", message, rttTextStream); + try { + rttTextStream.write(message); + } catch (IOException e) { + LogUtil.e("RttChatBot.MessageHandler", "write message", e); + } + if (Constants.BUBBLE_BREAKER.equals(message)) { + // Wait 1-11s between two messages. + sendMessageDelayed( + obtainMessage(SEND_MESSAGE, nextTyping()), 1000 * (1 + random.nextInt(10))); + } else { + // Wait up to 2s between typing. + sendMessageDelayed(obtainMessage(SEND_MESSAGE, nextTyping()), 200 * random.nextInt(10)); + } + break; + default: // fall out + } + } + + private String nextTyping() { + if (currentTypingPosition < 0 || currentTypingMessage == null) { + if (messageQueue.isEmpty()) { + String text = CANDIDATE_MESSAGES[random.nextInt(CANDIDATE_MESSAGES.length)]; + messageQueue.add(text); + } + currentTypingMessage = messageQueue.remove(0); + currentTypingPosition = 0; + } + if (currentTypingPosition < currentTypingMessage.length()) { + int size = random.nextInt(currentTypingMessage.length() - currentTypingPosition + 1); + String messageToType = + currentTypingMessage.substring(currentTypingPosition, currentTypingPosition + size); + currentTypingPosition = currentTypingPosition + size; + return messageToType; + } else { + currentTypingPosition = -1; + currentTypingMessage = null; + return Constants.BUBBLE_BREAKER; + } + } + } +} diff --git a/java/com/android/dialer/simulator/impl/SimulatorConferenceCreator.java b/java/com/android/dialer/simulator/impl/SimulatorConferenceCreator.java index 2bfa98247..81a3d30de 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorConferenceCreator.java +++ b/java/com/android/dialer/simulator/impl/SimulatorConferenceCreator.java @@ -97,7 +97,8 @@ final class SimulatorConferenceCreator default: break; } - SimulatorSimCallManager.addNewIncomingCall(context, number, false /* isVideo */, extras); + SimulatorSimCallManager.addNewIncomingCall( + context, number, SimulatorSimCallManager.CALL_TYPE_VOICE, extras); } @Override diff --git a/java/com/android/dialer/simulator/impl/SimulatorConnection.java b/java/com/android/dialer/simulator/impl/SimulatorConnection.java index d7427dd12..c832a5051 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorConnection.java +++ b/java/com/android/dialer/simulator/impl/SimulatorConnection.java @@ -121,6 +121,24 @@ public final class SimulatorConnection extends Connection { onEvent(new Event(Event.DTMF, Character.toString(c), null)); } + @Override + public void onStartRtt(@NonNull RttTextStream rttTextStream) { + LogUtil.enterBlock("SimulatorConnection.onStartRtt"); + onEvent(new Event(Event.START_RTT)); + } + + @Override + public void onStopRtt() { + LogUtil.enterBlock("SimulatorConnection.onStopRtt"); + onEvent(new Event(Event.STOP_RTT)); + } + + @Override + public void handleRttUpgradeResponse(RttTextStream rttTextStream) { + LogUtil.enterBlock("SimulatorConnection.handleRttUpgradeResponse"); + onEvent(new Event(Event.HANDLE_RTT_UPGRADE_RESPONSE)); + } + void onEvent(@NonNull Event event) { events.add(Assert.isNotNull(event)); for (Listener listener : new ArrayList<>(listeners)) { diff --git a/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java b/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java index 0bd1c0f22..1bf4b2a00 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java +++ b/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java @@ -33,7 +33,6 @@ import com.android.dialer.enrichedcall.simulator.EnrichedCallSimulatorActivity; import com.android.dialer.persistentlog.PersistentLogger; import com.android.dialer.preferredsim.PreferredSimFallbackContract; import com.android.dialer.simulator.SimulatorComponent; -import com.android.incallui.rtt.impl.RttChatActivity; /** Implements the top level simulator menu. */ final class SimulatorMainMenu { @@ -42,9 +41,9 @@ final class SimulatorMainMenu { SimulatorSubMenu simulatorSubMenu = new SimulatorSubMenu(activity.getApplicationContext()); simulatorSubMenu .addItem("Voice call", SimulatorVoiceCall.getActionProvider(activity)) + .addItem("Rtt call", SimulatorRttCall.getActionProvider(activity.getApplicationContext())) .addItem( "IMS video", SimulatorVideoCall.getActionProvider(activity.getApplicationContext())) - .addItem("Rtt call mock", () -> simulateRttCallMock(activity.getApplicationContext())) .addItem( "Notifications", SimulatorNotifications.getActionProvider(activity.getApplicationContext())) @@ -79,10 +78,6 @@ final class SimulatorMainMenu { return simulatorSubMenu; } - private static void simulateRttCallMock(@NonNull Context context) { - context.startActivity(new Intent(context, RttChatActivity.class)); - } - private static void populateDatabase(@NonNull Context context) { DialerExecutorComponent.get(context) .dialerExecutorFactory() diff --git a/java/com/android/dialer/simulator/impl/SimulatorMissedCallCreator.java b/java/com/android/dialer/simulator/impl/SimulatorMissedCallCreator.java index 6d4a26278..b8556156b 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorMissedCallCreator.java +++ b/java/com/android/dialer/simulator/impl/SimulatorMissedCallCreator.java @@ -78,7 +78,8 @@ final class SimulatorMissedCallCreator implements SimulatorConnectionService.Lis extras.putInt(EXTRA_CALL_COUNT, callCount - 1); extras.putBoolean(EXTRA_IS_MISSED_CALL_CONNECTION, true); - SimulatorSimCallManager.addNewIncomingCall(context, callerId, false /* isVideo */, extras); + SimulatorSimCallManager.addNewIncomingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_VOICE, extras); } private static boolean isMissedCallConnection(@NonNull Connection connection) { diff --git a/java/com/android/dialer/simulator/impl/SimulatorRttCall.java b/java/com/android/dialer/simulator/impl/SimulatorRttCall.java new file mode 100644 index 000000000..7b0066719 --- /dev/null +++ b/java/com/android/dialer/simulator/impl/SimulatorRttCall.java @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.dialer.simulator.impl; + +import android.content.Context; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.telecom.Connection; +import android.telecom.DisconnectCause; +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. */ +final class SimulatorRttCall + implements SimulatorConnectionService.Listener, SimulatorConnection.Listener { + + @NonNull private final Context context; + @Nullable private String connectionTag; + + static ActionProvider getActionProvider(@NonNull Context context) { + return new SimulatorSubMenu(context) + .addItem("Incoming call", () -> new SimulatorRttCall(context).addNewIncomingCall(false)) + .addItem("Outgoing call", () -> new SimulatorRttCall(context).addNewOutgoingCall()) + .addItem("Emergency call", () -> new SimulatorRttCall(context).addNewEmergencyCall()); + } + + private SimulatorRttCall(@NonNull Context context) { + this.context = Assert.isNotNull(context); + SimulatorConnectionService.addListener(this); + SimulatorConnectionService.addListener( + new SimulatorConferenceCreator(context, Simulator.CONFERENCE_TYPE_GSM)); + } + + private void addNewIncomingCall(boolean isSpam) { + String callerId = + isSpam + ? "+1-661-778-3020" /* Blacklisted custom spam number */ + : "+44 (0) 20 7031 3000" /* Google London office */; + connectionTag = + SimulatorSimCallManager.addNewIncomingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_RTT); + } + + private void addNewOutgoingCall() { + String callerId = "+55-31-2128-6800"; // Brazil office. + connectionTag = + SimulatorSimCallManager.addNewOutgoingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_RTT); + } + + private void addNewEmergencyCall() { + String callerId = "911"; + connectionTag = + SimulatorSimCallManager.addNewIncomingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_RTT); + } + + @Override + public void onNewOutgoingConnection(@NonNull SimulatorConnection connection) { + if (isMyConnection(connection)) { + LogUtil.i("SimulatorRttCall.onNewOutgoingConnection", "connection created"); + handleNewConnection(connection); + + // 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 (isMyConnection(connection)) { + LogUtil.i("SimulatorRttCall.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.setConnectionProperties( + connection.getConnectionProperties() | Connection.PROPERTY_IS_RTT); + } + + private boolean isMyConnection(@NonNull Connection connection) { + return connection.getExtras().getBoolean(connectionTag); + } + + @Override + public void onEvent(@NonNull SimulatorConnection connection, @NonNull Event event) { + switch (event.type) { + case Event.NONE: + throw Assert.createIllegalStateFailException(); + case Event.ANSWER: + connection.setActive(); + break; + case Event.REJECT: + connection.setDisconnected(new DisconnectCause(DisconnectCause.REJECTED)); + break; + case Event.HOLD: + connection.setOnHold(); + break; + case Event.UNHOLD: + connection.setActive(); + break; + case Event.DISCONNECT: + connection.setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); + break; + case Event.SESSION_MODIFY_REQUEST: + ThreadUtil.postDelayedOnUiThread(() -> connection.handleSessionModifyRequest(event), 2000); + break; + default: + LogUtil.i("SimulatorRttCall.onEvent", "unexpected event: " + event.type); + break; + } + } +} diff --git a/java/com/android/dialer/simulator/impl/SimulatorSimCallManager.java b/java/com/android/dialer/simulator/impl/SimulatorSimCallManager.java index f28393c0c..d51e06816 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorSimCallManager.java +++ b/java/com/android/dialer/simulator/impl/SimulatorSimCallManager.java @@ -20,6 +20,7 @@ import android.content.ComponentName; import android.content.Context; import android.net.Uri; import android.os.Bundle; +import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.telecom.Connection; import android.telecom.ConnectionRequest; @@ -30,6 +31,8 @@ import android.telephony.TelephonyManager; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.strictmode.StrictModeUtils; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import java.util.List; import java.util.Random; @@ -46,10 +49,20 @@ import java.util.Random; */ public class SimulatorSimCallManager { + public static final int CALL_TYPE_VOICE = 1; + public static final int CALL_TYPE_VIDEO = 2; + public static final int CALL_TYPE_RTT = 3; + + /** Call type of a simulator call. */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({CALL_TYPE_VOICE, CALL_TYPE_VIDEO, CALL_TYPE_RTT}) + public @interface CallType {} + private static final String SIM_CALL_MANAGER_ACCOUNT_ID = "SIMULATOR_ACCOUNT_ID"; private static final String VIDEO_PROVIDER_ACCOUNT_ID = "SIMULATOR_VIDEO_ACCOUNT_ID"; private static final String EXTRA_IS_SIMULATOR_CONNECTION = "is_simulator_connection"; private static final String EXTRA_CONNECTION_TAG = "connection_tag"; + private static final String EXTRA_CONNECTION_CALL_TYPE = "connection_call_type"; static void register(@NonNull Context context) { LogUtil.enterBlock("SimulatorSimCallManager.register"); @@ -75,15 +88,15 @@ public class SimulatorSimCallManager { @NonNull public static String addNewOutgoingCall( - @NonNull Context context, @NonNull String phoneNumber, boolean isVideo) { - return addNewOutgoingCall(context, phoneNumber, isVideo, new Bundle()); + @NonNull Context context, @NonNull String phoneNumber, @CallType int callType) { + return addNewOutgoingCall(context, phoneNumber, callType, new Bundle()); } @NonNull public static String addNewOutgoingCall( @NonNull Context context, @NonNull String phoneNumber, - boolean isVideo, + @CallType int callType, @NonNull Bundle extras) { LogUtil.enterBlock("SimulatorSimCallManager.addNewOutgoingCall"); Assert.isNotNull(context); @@ -94,13 +107,18 @@ public class SimulatorSimCallManager { register(context); extras = new Bundle(extras); - extras.putAll(createSimulatorConnectionExtras()); + extras.putAll(createSimulatorConnectionExtras(callType)); Bundle outgoingCallExtras = new Bundle(); outgoingCallExtras.putBundle(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, extras); outgoingCallExtras.putParcelable( TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, - isVideo ? getVideoProviderHandle(context) : getSystemPhoneAccountHandle(context)); + callType == CALL_TYPE_VIDEO + ? getVideoProviderHandle(context) + : getSystemPhoneAccountHandle(context)); + if (callType == CALL_TYPE_RTT) { + outgoingCallExtras.putBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT, true); + } TelecomManager telecomManager = context.getSystemService(TelecomManager.class); try { @@ -114,13 +132,16 @@ public class SimulatorSimCallManager { @NonNull public static String addNewIncomingCall( - @NonNull Context context, @NonNull String callerId, boolean isVideo) { - return addNewIncomingCall(context, callerId, isVideo, new Bundle()); + @NonNull Context context, @NonNull String callerId, @CallType int callType) { + return addNewIncomingCall(context, callerId, callType, new Bundle()); } @NonNull public static String addNewIncomingCall( - @NonNull Context context, @NonNull String callerId, boolean isVideo, @NonNull Bundle extras) { + @NonNull Context context, + @NonNull String callerId, + @CallType int callType, + @NonNull Bundle extras) { LogUtil.enterBlock("SimulatorSimCallManager.addNewIncomingCall"); Assert.isNotNull(context); Assert.isNotNull(callerId); @@ -130,18 +151,21 @@ public class SimulatorSimCallManager { extras = new Bundle(extras); extras.putString(TelephonyManager.EXTRA_INCOMING_NUMBER, callerId); - extras.putAll(createSimulatorConnectionExtras()); + extras.putAll(createSimulatorConnectionExtras(callType)); TelecomManager telecomManager = context.getSystemService(TelecomManager.class); telecomManager.addNewIncomingCall( - isVideo ? getVideoProviderHandle(context) : getSystemPhoneAccountHandle(context), extras); + callType == CALL_TYPE_VIDEO + ? getVideoProviderHandle(context) + : getSystemPhoneAccountHandle(context), + extras); return extras.getString(EXTRA_CONNECTION_TAG); } @NonNull private static PhoneAccount buildSimCallManagerAccount(Context context) { return new PhoneAccount.Builder(getSimCallManagerHandle(context), "Simulator SIM call manager") - .setCapabilities(PhoneAccount.CAPABILITY_CONNECTION_MANAGER) + .setCapabilities(PhoneAccount.CAPABILITY_CONNECTION_MANAGER | PhoneAccount.CAPABILITY_RTT) .setShortDescription("Simulator SIM call manager") .setSupportedUriSchemes(Arrays.asList(PhoneAccount.SCHEME_TEL)) .build(); @@ -218,12 +242,16 @@ public class SimulatorSimCallManager { } @NonNull - static Bundle createSimulatorConnectionExtras() { + static Bundle createSimulatorConnectionExtras(@CallType int callType) { Bundle extras = new Bundle(); extras.putBoolean(EXTRA_IS_SIMULATOR_CONNECTION, true); String connectionTag = createUniqueConnectionTag(); extras.putString(EXTRA_CONNECTION_TAG, connectionTag); extras.putBoolean(connectionTag, true); + extras.putInt(EXTRA_CONNECTION_CALL_TYPE, callType); + if (callType == CALL_TYPE_RTT) { + extras.putBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT, true); + } return extras; } diff --git a/java/com/android/dialer/simulator/impl/SimulatorVideoCall.java b/java/com/android/dialer/simulator/impl/SimulatorVideoCall.java index f7256a11c..0bb56f1f9 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorVideoCall.java +++ b/java/com/android/dialer/simulator/impl/SimulatorVideoCall.java @@ -77,7 +77,8 @@ final class SimulatorVideoCall } String callerId = "+44 (0) 20 7031 3000"; // Google London office connectionTag = - SimulatorSimCallManager.addNewIncomingCall(context, callerId, true /* isVideo */); + SimulatorSimCallManager.addNewIncomingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_VIDEO); } private void addNewOutgoingCall() { @@ -87,7 +88,8 @@ final class SimulatorVideoCall } String phoneNumber = "+44 (0) 20 7031 3000"; // Google London office connectionTag = - SimulatorSimCallManager.addNewOutgoingCall(context, phoneNumber, true /* isVideo */); + SimulatorSimCallManager.addNewOutgoingCall( + context, phoneNumber, SimulatorSimCallManager.CALL_TYPE_VIDEO); } @Override diff --git a/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java b/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java index 67a2db804..d4c7ee458 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java +++ b/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java @@ -104,7 +104,10 @@ final class SimulatorVoiceCall extras.putBoolean(Simulator.IS_ENRICHED_CALL, true); connectionTag = SimulatorSimCallManager.addNewIncomingCall( - context, Simulator.ENRICHED_CALL_INCOMING_NUMBER, false, extras); + context, + Simulator.ENRICHED_CALL_INCOMING_NUMBER, + SimulatorSimCallManager.CALL_TYPE_VOICE, + extras); }, DialerExecutorComponent.get(context).uiExecutor()); } @@ -119,7 +122,10 @@ final class SimulatorVoiceCall extras.putBoolean(Simulator.IS_ENRICHED_CALL, true); connectionTag = SimulatorSimCallManager.addNewOutgoingCall( - context, Simulator.ENRICHED_CALL_OUTGOING_NUMBER, false, extras); + context, + Simulator.ENRICHED_CALL_OUTGOING_NUMBER, + SimulatorSimCallManager.CALL_TYPE_VOICE, + extras); }, DialerExecutorComponent.get(context).uiExecutor()); } @@ -127,7 +133,8 @@ final class SimulatorVoiceCall private void addNewIncomingCall() { String callerId = "+44 (0) 20 7031 3000" /* Google London office */; connectionTag = - SimulatorSimCallManager.addNewIncomingCall(context, callerId, false /* isVideo */); + SimulatorSimCallManager.addNewIncomingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_VOICE); } private void addNewIncomingCall(AppCompatActivity activity) { @@ -137,7 +144,7 @@ final class SimulatorVoiceCall extras.putInt(Simulator.PRESENTATION_CHOICE, callerIdPresentation); connectionTag = SimulatorSimCallManager.addNewIncomingCall( - context, callerId, false /* isVideo */, extras); + context, callerId, SimulatorSimCallManager.CALL_TYPE_VOICE, extras); }) .show(activity.getSupportFragmentManager(), "SimulatorDialog"); } @@ -145,7 +152,8 @@ final class SimulatorVoiceCall private void addNewOutgoingCall() { String callerId = "+55-31-2128-6800"; // Brazil office. connectionTag = - SimulatorSimCallManager.addNewOutgoingCall(context, callerId, false /* isVideo */); + SimulatorSimCallManager.addNewOutgoingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_VOICE); } private void addNewOutgoingCall(AppCompatActivity activity) { @@ -155,7 +163,7 @@ final class SimulatorVoiceCall extras.putInt(Simulator.PRESENTATION_CHOICE, callerIdPresentation); connectionTag = SimulatorSimCallManager.addNewOutgoingCall( - context, callerId, false /* isVideo */, extras); + context, callerId, SimulatorSimCallManager.CALL_TYPE_VOICE, extras); }) .show(activity.getSupportFragmentManager(), "SimulatorDialog"); } @@ -163,12 +171,15 @@ final class SimulatorVoiceCall private void addSpamIncomingCall() { String callerId = "+1-661-778-3020"; /* Blacklisted custom spam number */ connectionTag = - SimulatorSimCallManager.addNewIncomingCall(context, callerId, false /* isVideo */); + SimulatorSimCallManager.addNewIncomingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_VOICE); } private void addNewEmergencyCallBack() { String callerId = "911"; - connectionTag = SimulatorSimCallManager.addNewIncomingCall(context, callerId, false); + connectionTag = + SimulatorSimCallManager.addNewIncomingCall( + context, callerId, SimulatorSimCallManager.CALL_TYPE_VOICE); } @Override |