From 89e3d1bb7941993206861fe9115778f816262c07 Mon Sep 17 00:00:00 2001 From: erfanian Date: Wed, 2 May 2018 18:50:59 -0700 Subject: More refactoring Test: unit PiperOrigin-RevId: 195188099 Change-Id: Ie2273229c257a9a767715831c15d90a6985fdda8 --- java/com/android/incallui/call/DialerCall.java | 5 ----- 1 file changed, 5 deletions(-) (limited to 'java/com/android/incallui/call') diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 1a0de1960..70678dbac 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -86,7 +86,6 @@ import com.android.incallui.audiomode.AudioModeProvider; import com.android.incallui.call.state.DialerCallState; import com.android.incallui.latencyreport.LatencyReport; import com.android.incallui.rtt.protocol.RttChatMessage; -import com.android.incallui.speakeasy.runtime.Constraints; import com.android.incallui.videotech.VideoTech; import com.android.incallui.videotech.VideoTech.VideoTechListener; import com.android.incallui.videotech.duo.DuoVideoTech; @@ -1697,10 +1696,6 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa /** Indicates the call is eligible for SpeakEasy */ public boolean isSpeakEasyEligible() { - if (!Constraints.isAvailable(context)) { - return false; - } - return !isPotentialEmergencyCallback() && !isEmergencyCall() && !isActiveRttCall() -- cgit v1.2.3 From c1401221314601a479a7ad293cc382416f2304f3 Mon Sep 17 00:00:00 2001 From: maxwelb Date: Thu, 3 May 2018 11:51:02 -0700 Subject: Add spam status tests for CallList#onCallAdded There are some upcoming changes to CallList#onCallAdded, so this CL adds the tests needed to verify that behavior doesn't regress. This became something of a rabbit hole because: 1) CallListTest needed to use a FakeSpam so spam status could be changed 2) FakeSpam needed updates so it wouldn't crash when CallList calls it. This was implemented as a no-op for simplicity. It also needed to support the single number lookup method. 3) FakeCall needed updates to support setting the details' extras (needed tests) 4) ShadowCall needed updates to support setting the details' extras 5) DetailsProperty needed a new value 6) There was an old TODO to use a string that's now visible in the SDK 7) SharedPrefConfigProvider needed a new method to set the emergency call window long. Bug: 33779976,79171382 Test: Tap PiperOrigin-RevId: 195287258 Change-Id: Ib8b9fde35263183393e9bcbdcf73eeada24f28eb --- java/com/android/incallui/call/DialerCall.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'java/com/android/incallui/call') diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 70678dbac..9e1e17e2a 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -50,7 +50,6 @@ import android.telecom.VideoProfile; import android.text.TextUtils; import android.widget.Toast; import com.android.contacts.common.compat.CallCompat; -import com.android.contacts.common.compat.telecom.TelecomManagerCompat; import com.android.dialer.assisteddialing.ConcreteCreator; import com.android.dialer.assisteddialing.TransformationInfo; import com.android.dialer.callintent.CallInitiationType; @@ -117,8 +116,11 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa public static final int PROPERTY_CODEC_KNOWN = 0x04000000; private static final String ID_PREFIX = "DialerCall_"; - private static final String CONFIG_EMERGENCY_CALLBACK_WINDOW_MILLIS = + + @VisibleForTesting + public static final String CONFIG_EMERGENCY_CALLBACK_WINDOW_MILLIS = "emergency_callback_window_millis"; + private static int idCounter = 0; /** @@ -821,10 +823,9 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa // We want to treat any incoming call that arrives a short time after an outgoing emergency call // as a potential emergency callback. if (getExtras() != null - && getExtras().getLong(TelecomManagerCompat.EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS, 0) - > 0) { + && getExtras().getLong(Call.EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS, 0) > 0) { long lastEmergencyCallMillis = - getExtras().getLong(TelecomManagerCompat.EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS, 0); + getExtras().getLong(Call.EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS, 0); if (isInEmergencyCallbackWindow(lastEmergencyCallMillis)) { return true; } -- cgit v1.2.3 From 49f90b332c6e716196276dab0f3d7e21b56b696e Mon Sep 17 00:00:00 2001 From: wangqi Date: Thu, 3 May 2018 12:34:08 -0700 Subject: Add test to verify no crash on multiple DialerCall#onRemovedFromCallList. This change also add a null check for RttCall when saving RTT transcript. Test: DialerCallTest PiperOrigin-RevId: 195293823 Change-Id: I67cf3410480ac106933486d9d31f0fbb3183b074 --- java/com/android/incallui/call/DialerCall.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'java/com/android/incallui/call') diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 9e1e17e2a..77e2ea30b 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -1058,6 +1058,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa } @TargetApi(28) + @Nullable public RttCall getRttCall() { if (!isActiveRttCall()) { return null; @@ -1111,16 +1112,18 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa if (!BuildCompat.isAtLeastP()) { return; } - // Save any remaining text in the buffer that's not shown by UI yet. - // This may happen when the call is switched to background before disconnect. - try { - String messageLeft = getRttCall().readImmediately(); - if (!TextUtils.isEmpty(messageLeft)) { - rttTranscript = - RttChatMessage.getRttTranscriptWithNewRemoteMessage(rttTranscript, messageLeft); + if (getRttCall() != null) { + // Save any remaining text in the buffer that's not shown by UI yet. + // This may happen when the call is switched to background before disconnect. + try { + String messageLeft = getRttCall().readImmediately(); + if (!TextUtils.isEmpty(messageLeft)) { + rttTranscript = + RttChatMessage.getRttTranscriptWithNewRemoteMessage(rttTranscript, messageLeft); + } + } catch (IOException e) { + LogUtil.e("DialerCall.saveRttTranscript", "error when reading remaining message", e); } - } catch (IOException e) { - LogUtil.e("DialerCall.saveRttTranscript", "error when reading remaining message", e); } // Don't save transcript if it's empty. if (rttTranscript.getMessagesCount() == 0) { @@ -1662,7 +1665,6 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa if (videoTechManager != null) { videoTechManager.dispatchRemovedFromCallList(); } - // TODO(a bug): Add tests for it to make sure no crash on subsequent call to this method. // TODO(wangqi): Consider moving this to a DialerCallListener. if (rttTranscript != null && !isCallRemoved) { saveRttTranscript(); -- cgit v1.2.3 From 4ef430e759b7e4f07bd1fbc273a7b6937b581b4a Mon Sep 17 00:00:00 2001 From: yueg Date: Fri, 4 May 2018 10:47:35 -0700 Subject: Use Telecom Bluetooth API instead of system Bluetooth API. Bug: 74238896 Test: manual PiperOrigin-RevId: 195437669 Change-Id: I1cb26187b8b90664b72de2a4451283a9fbdc0f10 --- java/com/android/incallui/call/TelecomAdapter.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'java/com/android/incallui/call') diff --git a/java/com/android/incallui/call/TelecomAdapter.java b/java/com/android/incallui/call/TelecomAdapter.java index a7e10d37c..4ae1bc1db 100644 --- a/java/com/android/incallui/call/TelecomAdapter.java +++ b/java/com/android/incallui/call/TelecomAdapter.java @@ -16,7 +16,9 @@ package com.android.incallui.call; +import android.annotation.TargetApi; import android.app.Notification; +import android.bluetooth.BluetoothDevice; import android.content.ActivityNotFoundException; import android.content.Intent; import android.os.Looper; @@ -193,4 +195,13 @@ public class TelecomAdapter implements InCallServiceListener { "no inCallService available for stopping foreground notification"); } } + + @TargetApi(28) + public void requestBluetoothAudio(BluetoothDevice bluetoothDevice) { + if (inCallService != null) { + inCallService.requestBluetoothAudio(bluetoothDevice); + } else { + LogUtil.e("TelecomAdapter.requestBluetoothAudio", "inCallService is null"); + } + } } -- cgit v1.2.3