summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllogutils
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2018-04-19 16:47:59 -0700
committerCopybara-Service <copybara-piper@google.com>2018-04-19 16:49:34 -0700
commit5f1d084c67e20296e5d2372c59c837ab1d701409 (patch)
tree44ccdbc094775020e29f39d6f39b3ce314d01bc3 /java/com/android/dialer/calllogutils
parentac069a79d2f0701d1ce0371a11e3d2ed63afc4de (diff)
Use PreCall.start instead of context.startActivity when starting calls from call log.
For some reason not understood, startActivity with the call intent causes the current activity (MainActivity) to be paused, resumed, and paused again. This results in an opportunity to double-tap the row which causes the InCallUi to open in bubble mode (this is also not well understood). In any event, PreCall.start eventually uses TelecomManager to place the call rather than startActivity, which is presumably the thing that fixes the problem. Also refactored TestPreCallModule to remove the many test implementations of PreCall and remove the static field in the module which could cause test interference. TEST=manual Bug: 78187587 Test: manual PiperOrigin-RevId: 193596093 Change-Id: I933020d33db1c158628f14b30c2681c59c86201b
Diffstat (limited to 'java/com/android/dialer/calllogutils')
-rw-r--r--java/com/android/dialer/calllogutils/CallLogRowActions.java (renamed from java/com/android/dialer/calllogutils/CallLogIntents.java)30
1 files changed, 10 insertions, 20 deletions
diff --git a/java/com/android/dialer/calllogutils/CallLogIntents.java b/java/com/android/dialer/calllogutils/CallLogRowActions.java
index 18927f77d..2090fc32f 100644
--- a/java/com/android/dialer/calllogutils/CallLogIntents.java
+++ b/java/com/android/dialer/calllogutils/CallLogRowActions.java
@@ -15,39 +15,29 @@
*/
package com.android.dialer.calllogutils;
-import android.content.Context;
-import android.content.Intent;
+import android.app.Activity;
import android.provider.CallLog.Calls;
-import android.support.annotation.Nullable;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.calllog.model.CoalescedRow;
-import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.precall.PreCall;
import com.android.dialer.telecom.TelecomUtil;
-/** Provides intents related to call log entries. */
-public final class CallLogIntents {
+/** Actions which can be performed on a call log row. */
+public final class CallLogRowActions {
/**
- * Returns an intent which can be used to call back for the provided row.
+ * Places a call to the number in the provided {@link CoalescedRow}.
*
* <p>If the call was a video call, a video call will be placed, and if the call was an audio
- * call, an audio call will be placed.
- *
- * @return null if the provided {@code row} doesn't have a number
+ * call, an audio call will be placed. The phone account corresponding to the row is used.
*/
- @Nullable
- public static Intent getCallBackIntent(Context context, CoalescedRow row) {
- String normalizedNumber = row.getNumber().getNormalizedNumber();
- if (!PhoneNumberHelper.canPlaceCallsTo(normalizedNumber, row.getNumberPresentation())) {
- return null;
- }
-
+ public static void startCallForRow(Activity activity, CoalescedRow row) {
// TODO(zachh): More granular logging?
- return PreCall.getIntent(
- context,
- new CallIntentBuilder(normalizedNumber, CallInitiationType.Type.CALL_LOG)
+ PreCall.start(
+ activity,
+ new CallIntentBuilder(
+ row.getNumber().getNormalizedNumber(), CallInitiationType.Type.CALL_LOG)
.setPhoneAccountHandle(
TelecomUtil.composePhoneAccountHandle(
row.getPhoneAccountComponentName(), row.getPhoneAccountId()))