From 5d8ed9309625302dee3407b320a52f2b7f30227f Mon Sep 17 00:00:00 2001 From: wangqi Date: Thu, 26 Oct 2017 17:24:22 -0700 Subject: Fix HOLD option not displayed in voice calls in CDMA + GSM. Add hold button for all phone types and rely on SUPPORT_HOLD capability to show it. The issue is that if GSM call is made on devices with CDMA + GSM sim, the default phone type is CDMA so the hold button is not available. This change is a workaround that adding hold button to CDMA button chooser so button choose of all phone type has hold button available and it's totally controlled by telecom's CAPABILITY_SUPPORT_HOLD and CAPABILITY_HOLD. It shouldn't affect CDMA call. Idealy we should use correct phone type but unfortunately it's not well supported on pre-O device. This is upstream change from https://android-review.googlesource.com/#/c/platform/packages/apps/Dialer/+/482377/ Bug: 63911282 Test: ButtonChooserIntegrationTest PiperOrigin-RevId: 173614690 Change-Id: I6e17c1cc69ad50b1ba4c9b09804d5a7b5eeaf496 --- java/com/android/incallui/incall/impl/ButtonChooserFactory.java | 4 ++++ java/com/android/incallui/incall/impl/InCallFragment.java | 1 + 2 files changed, 5 insertions(+) (limited to 'java/com/android/incallui') diff --git a/java/com/android/incallui/incall/impl/ButtonChooserFactory.java b/java/com/android/incallui/incall/impl/ButtonChooserFactory.java index 0d0a93256..2a0894047 100644 --- a/java/com/android/incallui/incall/impl/ButtonChooserFactory.java +++ b/java/com/android/incallui/incall/impl/ButtonChooserFactory.java @@ -74,6 +74,10 @@ class ButtonChooserFactory { mapping.put( InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO, MappingInfo.builder(4).setSlotOrder(10).build()); mapping.put(InCallButtonIds.BUTTON_SWAP, MappingInfo.builder(5).setSlotOrder(0).build()); + // For multi-sim devices, the first sim's phoneType is used so hold button might be not + // available for CDMA + GSM devices calling with GSM sim. Adding hold button as low priority + // here to let telecom control whether it should be shown. + mapping.put(InCallButtonIds.BUTTON_HOLD, MappingInfo.builder(5).setSlotOrder(5).build()); mapping.put( InCallButtonIds.BUTTON_SWITCH_TO_SECONDARY, MappingInfo.builder(5) diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index ddad61d27..fc31c74e2 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -175,6 +175,7 @@ public class InCallFragment extends Fragment ? getContext().getSystemService(TelephonyManager.class).getVoiceNetworkType() : TelephonyManager.NETWORK_TYPE_UNKNOWN; } + // TODO(a bug): Change to use corresponding phone type used for current call. phoneType = getContext().getSystemService(TelephonyManager.class).getPhoneType(); View space = view.findViewById(R.id.navigation_bar_background); space.getLayoutParams().height = ViewUtil.getNavigationBarHeight(getContext()); -- cgit v1.2.3