diff options
author | twyen <twyen@google.com> | 2018-03-27 06:54:00 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-03-27 06:54:00 +0000 |
commit | 88bc8981da17f0d9d80649948d904171b334fad7 (patch) | |
tree | 82f29a4bee02b6366d2bdaed79a081c0128b0d9b | |
parent | 50df6ca7cde9d7a79b24987f4f680e71de006e51 (diff) | |
parent | aef5d068e59b2b9a4f609dc887c7887639436b5d (diff) |
Merge changes I9a8bf666,Icb9f26a9
am: aef5d068e5
Change-Id: I540c4c4462fe333618304535aaacc0ba84311305
6 files changed, 95 insertions, 13 deletions
diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java index 3a7733436..917870ec7 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java +++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java @@ -89,7 +89,7 @@ import javax.annotation.concurrent.ThreadSafe; * calls into this class from outside must be done from the main UI thread. */ @NotThreadSafe -@TargetApi(VERSION_CODES.M) +@TargetApi(VERSION_CODES.N) public class VoicemailPlaybackPresenter implements MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener, diff --git a/java/com/android/dialer/callintent/CallIntentBuilder.java b/java/com/android/dialer/callintent/CallIntentBuilder.java index 9d9fcf4da..0f9f8905d 100644 --- a/java/com/android/dialer/callintent/CallIntentBuilder.java +++ b/java/com/android/dialer/callintent/CallIntentBuilder.java @@ -46,7 +46,8 @@ public class CallIntentBuilder implements Parcelable { private String callSubject; private boolean allowAssistedDial; - private final Bundle outgoingCallExtras = new Bundle(); + private final Bundle inCallUiIntentExtras = new Bundle(); + private final Bundle placeCallExtras = new Bundle(); private static int lightbringerButtonAppearInExpandedCallLogItemCount = 0; private static int lightbringerButtonAppearInCollapsedCallLogItemCount = 0; @@ -110,7 +111,7 @@ public class CallIntentBuilder implements Parcelable { isVideoCall = parcel.readInt() != 0; callSubject = parcel.readString(); allowAssistedDial = parcel.readInt() != 0; - outgoingCallExtras.putAll(parcel.readBundle(classLoader)); + inCallUiIntentExtras.putAll(parcel.readBundle(classLoader)); } public static CallIntentBuilder forVoicemail( @@ -170,8 +171,16 @@ public class CallIntentBuilder implements Parcelable { } /** Additional data the in call UI can read with {@link Details#getIntentExtras()} */ - public Bundle getOutgoingCallExtras() { - return outgoingCallExtras; + public Bundle getInCallUiIntentExtras() { + return inCallUiIntentExtras; + } + + /** + * Other extras that should be used with {@link TelecomManager#placeCall(Uri, Bundle)}. This will + * override everything set by the CallIntentBuilder + */ + public Bundle getPlaceCallExtras() { + return placeCallExtras; } /** @@ -186,11 +195,11 @@ public class CallIntentBuilder implements Parcelable { TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, isVideoCall ? VideoProfile.STATE_BIDIRECTIONAL : VideoProfile.STATE_AUDIO_ONLY); - outgoingCallExtras.putLong( + inCallUiIntentExtras.putLong( Constants.EXTRA_CALL_CREATED_TIME_MILLIS, SystemClock.elapsedRealtime()); - CallIntentParser.putCallSpecificAppData(outgoingCallExtras, callSpecificAppData); + CallIntentParser.putCallSpecificAppData(inCallUiIntentExtras, callSpecificAppData); - intent.putExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, outgoingCallExtras); + intent.putExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, inCallUiIntentExtras); if (phoneAccountHandle != null) { intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); @@ -200,6 +209,8 @@ public class CallIntentBuilder implements Parcelable { intent.putExtra(TelecomManager.EXTRA_CALL_SUBJECT, callSubject); } + intent.putExtras(placeCallExtras); + return intent; } @@ -257,7 +268,7 @@ public class CallIntentBuilder implements Parcelable { dest.writeInt(isVideoCall ? 1 : 0); dest.writeString(callSubject); dest.writeInt(allowAssistedDial ? 1 : 0); - dest.writeBundle(outgoingCallExtras); + dest.writeBundle(inCallUiIntentExtras); } public static final Creator<CallIntentBuilder> CREATOR = diff --git a/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java b/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java index 8bd8335a2..a6067d368 100644 --- a/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java +++ b/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java @@ -53,7 +53,7 @@ import java.util.List; * worker thread. */ @SuppressWarnings("AndroidApiChecker") // lambdas -@TargetApi(VERSION_CODES.M) +@TargetApi(VERSION_CODES.N) final class PersistentLogFileHandler { private static final String LOG_DIRECTORY = "persistent_log"; diff --git a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java index 6096d5192..bf7995a0c 100644 --- a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java +++ b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java @@ -23,13 +23,16 @@ import android.os.Bundle; import android.support.annotation.Nullable; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; +import android.telecom.VideoProfile; import com.android.dialer.callintent.CallInitiationType.Type; import com.android.dialer.callintent.CallIntentBuilder; +import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProvider; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.precall.PreCall; +import com.google.common.collect.ImmutableList; /** * Activity that forwards to {@link PreCall#start(Context, CallIntentBuilder)} so the pre-call flow @@ -50,6 +53,17 @@ public class LaunchPreCallActivity extends Activity { public static final String EXTRA_ALLOW_ASSISTED_DIAL = "allow_assisted_dial"; + private static final ImmutableList<String> HANDLED_INTENT_EXTRAS = + ImmutableList.of( + TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, + TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, + TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, + TelecomManager.EXTRA_CALL_SUBJECT, + EXTRA_PHONE_ACCOUNT_HANDLE, + EXTRA_IS_VIDEO_CALL, + EXTRA_CALL_SUBJECT, + EXTRA_ALLOW_ASSISTED_DIAL); + @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -72,7 +86,62 @@ public class LaunchPreCallActivity extends Activity { intent.getBooleanExtra( EXTRA_ALLOW_ASSISTED_DIAL, configProvider.getBoolean("assisted_dialing_default_precall_state", false))); + filterExtras(intent.getExtras(), builder); PreCall.start(this, builder); finish(); } + + /** + * Move key-value pairs that {@link CallIntentBuilder} can handle from {@code intentExtras} to + * {@code builder} + */ + private void filterExtras(@Nullable Bundle intentExtras, CallIntentBuilder builder) { + if (intentExtras == null) { + return; + } + Bundle bundle = new Bundle(); + bundle.putAll(intentExtras); + + if (intentExtras.containsKey(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE)) { + int videoState = intentExtras.getInt(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE); + switch (videoState) { + case VideoProfile.STATE_BIDIRECTIONAL: + builder.setIsVideoCall(true); + break; + case VideoProfile.STATE_AUDIO_ONLY: + builder.setIsVideoCall(false); + break; + case VideoProfile.STATE_RX_ENABLED: + case VideoProfile.STATE_TX_ENABLED: + LogUtil.w( + "LaunchPreCallActivity.filterExtras", + "unsupported video state " + videoState + ", overriding to STATE_BIDIRECTIONAL"); + builder.setIsVideoCall(true); + break; + default: + LogUtil.w("LaunchPreCallActivity.filterExtras", "unknown video state " + videoState); + builder.setIsVideoCall(false); + } + } + + if (intentExtras.containsKey(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS)) { + builder + .getInCallUiIntentExtras() + .putAll(intentExtras.getBundle(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS)); + } + + if (intentExtras.containsKey(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE)) { + builder.setPhoneAccountHandle( + intentExtras.getParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE)); + } + + if (intentExtras.containsKey(TelecomManager.EXTRA_CALL_SUBJECT)) { + builder.setCallSubject(intentExtras.getString(TelecomManager.EXTRA_CALL_SUBJECT)); + } + + for (String handledKey : HANDLED_INTENT_EXTRAS) { + bundle.remove(handledKey); + } + builder.getPlaceCallExtras().putAll(bundle); + } } diff --git a/java/com/android/dialer/precall/impl/AssistedDialAction.java b/java/com/android/dialer/precall/impl/AssistedDialAction.java index 9ed37ac8c..e4e525559 100644 --- a/java/com/android/dialer/precall/impl/AssistedDialAction.java +++ b/java/com/android/dialer/precall/impl/AssistedDialAction.java @@ -69,10 +69,12 @@ public class AssistedDialAction implements PreCallAction { Optional<TransformationInfo> transformedNumber = assistedDialingMediator.attemptAssistedDial(phoneNumber); if (transformedNumber.isPresent()) { - builder.getOutgoingCallExtras().putBoolean(TelephonyManagerCompat.USE_ASSISTED_DIALING, true); + builder + .getInCallUiIntentExtras() + .putBoolean(TelephonyManagerCompat.USE_ASSISTED_DIALING, true); Bundle assistedDialingExtras = transformedNumber.get().toBundle(); builder - .getOutgoingCallExtras() + .getInCallUiIntentExtras() .putBundle(TelephonyManagerCompat.ASSISTED_DIALING_EXTRAS, assistedDialingExtras); builder.setUri( CallUtil.getCallUri(Assert.isNotNull(transformedNumber.get().transformedNumber()))); diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java index a5dc6a097..56b392b19 100644 --- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java +++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java @@ -160,7 +160,7 @@ public class CallingAccountSelector implements PreCallAction { "CallingAccountSelector.processPreferredAccount", "Auto selected suggestion"); builder.setPhoneAccountHandle(result.getSuggestion().get().phoneAccountHandle); builder - .getOutgoingCallExtras() + .getInCallUiIntentExtras() .putString( SuggestionProvider.EXTRA_SIM_SUGGESTION_REASON, result.getSuggestion().get().reason.name()); |