diff options
author | zachh <zachh@google.com> | 2018-04-19 16:47:59 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-19 16:49:34 -0700 |
commit | 5f1d084c67e20296e5d2372c59c837ab1d701409 (patch) | |
tree | 44ccdbc094775020e29f39d6f39b3ce314d01bc3 /java/com/android/dialer/precall | |
parent | ac069a79d2f0701d1ce0371a11e3d2ed63afc4de (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/precall')
-rw-r--r-- | java/com/android/dialer/precall/impl/PreCallImpl.java | 18 | ||||
-rw-r--r-- | java/com/android/dialer/precall/impl/PreCallModule.java | 18 |
2 files changed, 25 insertions, 11 deletions
diff --git a/java/com/android/dialer/precall/impl/PreCallImpl.java b/java/com/android/dialer/precall/impl/PreCallImpl.java index bd23f9ece..2f9b2784c 100644 --- a/java/com/android/dialer/precall/impl/PreCallImpl.java +++ b/java/com/android/dialer/precall/impl/PreCallImpl.java @@ -25,7 +25,6 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.precall.PreCall; import com.android.dialer.precall.PreCallAction; -import com.android.dialer.precall.PreCallComponent; import com.android.dialer.precall.PreCallCoordinator; import com.google.common.collect.ImmutableList; import javax.inject.Inject; @@ -33,17 +32,16 @@ import javax.inject.Inject; /** Implementation of {@link PreCall} */ public class PreCallImpl implements PreCall { + private final ImmutableList<PreCallAction> actions; + @Inject - PreCallImpl() {} + PreCallImpl(ImmutableList<PreCallAction> actions) { + this.actions = actions; + } @Override public ImmutableList<PreCallAction> getActions() { - return ImmutableList.of( - new PermissionCheckAction(), - new MalformedNumberRectifier( - ImmutableList.of(new UkRegionPrefixInInternationalFormatHandler())), - new CallingAccountSelector(), - new AssistedDialAction()); + return actions; } @NonNull @@ -52,7 +50,7 @@ public class PreCallImpl implements PreCall { Logger.get(context).logImpression(DialerImpression.Type.PRECALL_INITIATED); if (!requiresUi(context, builder)) { LogUtil.i("PreCallImpl.buildIntent", "No UI requested, running pre-call directly"); - for (PreCallAction action : PreCallComponent.get(context).getPreCall().getActions()) { + for (PreCallAction action : actions) { action.runWithoutUi(context, builder); } return builder.build(); @@ -64,7 +62,7 @@ public class PreCallImpl implements PreCall { } private boolean requiresUi(Context context, CallIntentBuilder builder) { - for (PreCallAction action : PreCallComponent.get(context).getPreCall().getActions()) { + for (PreCallAction action : actions) { if (action.requiresUi(context, builder)) { LogUtil.i("PreCallImpl.requiresUi", action + " requested UI"); return true; diff --git a/java/com/android/dialer/precall/impl/PreCallModule.java b/java/com/android/dialer/precall/impl/PreCallModule.java index 608cd5a8f..4643b1976 100644 --- a/java/com/android/dialer/precall/impl/PreCallModule.java +++ b/java/com/android/dialer/precall/impl/PreCallModule.java @@ -17,15 +17,31 @@ package com.android.dialer.precall.impl; import com.android.dialer.precall.PreCall; +import com.android.dialer.precall.PreCallAction; +import com.google.common.collect.ImmutableList; import dagger.Binds; import dagger.Module; +import dagger.Provides; import javax.inject.Singleton; /** Dagger module for {@link PreCall}. */ @Module public abstract class PreCallModule { + private PreCallModule() {} + @Binds @Singleton - public abstract PreCall bindPreCall(PreCallImpl simulator); + public abstract PreCall to(PreCallImpl impl); + + @Provides + @Singleton + public static ImmutableList<PreCallAction> provideActions() { + return ImmutableList.of( + new PermissionCheckAction(), + new MalformedNumberRectifier( + ImmutableList.of(new UkRegionPrefixInInternationalFormatHandler())), + new CallingAccountSelector(), + new AssistedDialAction()); + } } |