summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/contactgrid/ContactGridManager.java
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-11-29 14:29:31 -0800
committerCopybara-Service <copybara-piper@google.com>2017-11-29 16:32:46 -0800
commit1d62ab209130bdacdb64b2cd824b5ff35817b89f (patch)
tree04e535956686bb2a8ddc98977fb305faa19bb77f /java/com/android/incallui/contactgrid/ContactGridManager.java
parentb33463c7cdf3a4d481767452d3a21c09527ffcb1 (diff)
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
Diffstat (limited to 'java/com/android/incallui/contactgrid/ContactGridManager.java')
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java33
1 files changed, 33 insertions, 0 deletions
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<CharSequence> 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);
+ }
+ }
}