From 1d62ab209130bdacdb64b2cd824b5ff35817b89f Mon Sep 17 00:00:00 2001 From: wangqi Date: Wed, 29 Nov 2017 14:29:31 -0800 Subject: Enable timer in emergency call. "This phone's number: xxx" is shown for emergency call which replaces in call timer. This change move it to under emergency location service so timer could be shown again. Bug: 69810801 Test: manual PiperOrigin-RevId: 177363955 Change-Id: I543fbbee869923800ffd92a5799819b712f0b953 --- .../incallui/contactgrid/ContactGridManager.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'java/com/android/incallui/contactgrid/ContactGridManager.java') diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java index 8deee8263..1bac97842 100644 --- a/java/com/android/incallui/contactgrid/ContactGridManager.java +++ b/java/com/android/incallui/contactgrid/ContactGridManager.java @@ -81,9 +81,14 @@ public class ContactGridManager { private boolean middleRowVisible = true; private boolean isTimerStarted; + // Row in emergency call: This phone's number: +1 (650) 253-0000 + private final TextView deviceNumberTextView; + private final View deviceNumberDivider; + private PrimaryInfo primaryInfo = PrimaryInfo.createEmptyPrimaryInfo(); private PrimaryCallState primaryCallState = PrimaryCallState.createEmptyPrimaryCallState(); private final LetterTileDrawable letterTile; + private boolean isInMultiWindowMode; public ContactGridManager( View view, @Nullable ImageView avatarImageView, int avatarSize, boolean showAnonymousAvatar) { @@ -109,6 +114,9 @@ public class ContactGridManager { contactGridLayout = (View) contactNameTextView.getParent(); letterTile = new LetterTileDrawable(context.getResources()); isTimerStarted = false; + + deviceNumberTextView = view.findViewById(R.id.contactgrid_device_number_text); + deviceNumberDivider = view.findViewById(R.id.contactgrid_location_divider); } public void show() { @@ -148,6 +156,7 @@ public class ContactGridManager { this.primaryInfo = primaryInfo; updatePrimaryNameAndPhoto(); updateBottomRow(); + updateDeviceNumberRow(); } public void setCallState(PrimaryCallState primaryCallState) { @@ -155,6 +164,7 @@ public class ContactGridManager { updatePrimaryNameAndPhoto(); updateBottomRow(); updateTopRow(); + updateDeviceNumberRow(); } public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { @@ -174,6 +184,14 @@ public class ContactGridManager { updatePrimaryNameAndPhoto(); } + public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { + if (this.isInMultiWindowMode == isInMultiWindowMode) { + return; + } + this.isInMultiWindowMode = isInMultiWindowMode; + updateDeviceNumberRow(); + } + private void dispatchPopulateAccessibilityEvent(AccessibilityEvent event, View view) { final List eventText = event.getText(); int size = eventText.size(); @@ -379,4 +397,19 @@ public class ContactGridManager { isTimerStarted = false; } } + + private void updateDeviceNumberRow() { + if (isInMultiWindowMode || TextUtils.isEmpty(primaryCallState.callbackNumber)) { + deviceNumberTextView.setVisibility(View.GONE); + deviceNumberDivider.setVisibility(View.GONE); + return; + } + // This is used for carriers like Project Fi to show the callback number for emergency calls. + deviceNumberTextView.setText( + context.getString(R.string.contact_grid_callback_number, primaryCallState.callbackNumber)); + deviceNumberTextView.setVisibility(View.VISIBLE); + if (primaryInfo.shouldShowLocation) { + deviceNumberDivider.setVisibility(View.VISIBLE); + } + } } -- cgit v1.2.3