summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/com/android/dialer/calllog/database/Coalescer.java2
-rw-r--r--java/com/android/dialer/phonenumberproto/DialerPhoneNumberUtil.java26
-rw-r--r--java/com/android/incallui/InCallActivity.java18
-rw-r--r--java/com/android/incallui/InCallPresenter.java6
-rw-r--r--java/com/android/newbubble/NewBubble.java8
5 files changed, 37 insertions, 23 deletions
diff --git a/java/com/android/dialer/calllog/database/Coalescer.java b/java/com/android/dialer/calllog/database/Coalescer.java
index 9b788140a..3c2585e01 100644
--- a/java/com/android/dialer/calllog/database/Coalescer.java
+++ b/java/com/android/dialer/calllog/database/Coalescer.java
@@ -181,7 +181,7 @@ public class Coalescer {
if (!meetsAssistedDialingCriteria(row1, row2)) {
return false;
}
- return dialerPhoneNumberUtil.isExactMatch(number1, number2);
+ return dialerPhoneNumberUtil.isMatch(number1, number2);
}
/**
diff --git a/java/com/android/dialer/phonenumberproto/DialerPhoneNumberUtil.java b/java/com/android/dialer/phonenumberproto/DialerPhoneNumberUtil.java
index 8969737d4..d37f7fa1d 100644
--- a/java/com/android/dialer/phonenumberproto/DialerPhoneNumberUtil.java
+++ b/java/com/android/dialer/phonenumberproto/DialerPhoneNumberUtil.java
@@ -70,6 +70,14 @@ public class DialerPhoneNumberUtil {
}
dialerPhoneNumber.setRawInput(rawInput.build());
+ // If the number is a service number, just store the raw input and don't bother trying to parse
+ // it. PhoneNumberUtil#parse ignores these characters which can lead to confusing behavior, such
+ // as the numbers "#123" and "123" being considered the same. The "#" can appear in the middle
+ // of a service number and the "*" can appear at the beginning (see a bug).
+ if (numberToParse != null && (numberToParse.contains("#") || numberToParse.startsWith("*"))) {
+ return dialerPhoneNumber.build();
+ }
+
try {
dialerPhoneNumber.setDialerInternalPhoneNumber(
Converter.pojoToProto(phoneNumberUtil.parse(numberToParse, defaultRegion)));
@@ -95,21 +103,27 @@ public class DialerPhoneNumberUtil {
}
/**
- * Returns true if the two numbers were parseable by libphonenumber and are an {@link
- * MatchType#EXACT_MATCH} or if they have the same raw input.
+ * Returns true if the two numbers were parseable by libphonenumber and are a {@link
+ * MatchType#SHORT_NSN_MATCH} or {@link MatchType#NSN_MATCH} or {@link MatchType#EXACT_MATCH} or
+ * if they have the same raw input.
+ *
+ * @see PhoneNumberUtil#isNumberMatch(PhoneNumber, PhoneNumber)
*/
@WorkerThread
- public boolean isExactMatch(
+ public boolean isMatch(
@NonNull DialerPhoneNumber firstNumberIn, @NonNull DialerPhoneNumber secondNumberIn) {
Assert.isWorkerThread();
if (!Assert.isNotNull(firstNumberIn).hasDialerInternalPhoneNumber()
|| !Assert.isNotNull(secondNumberIn).hasDialerInternalPhoneNumber()) {
return firstNumberIn.getRawInput().equals(secondNumberIn.getRawInput());
}
- return isNumberMatch(
+ MatchType matchType =
+ isNumberMatch(
firstNumberIn.getDialerInternalPhoneNumber(),
- secondNumberIn.getDialerInternalPhoneNumber())
- == MatchType.EXACT_MATCH;
+ secondNumberIn.getDialerInternalPhoneNumber());
+ return matchType == MatchType.SHORT_NSN_MATCH
+ || matchType == MatchType.NSN_MATCH
+ || matchType == MatchType.EXACT_MATCH;
}
/**
diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java
index 0a5666690..990560674 100644
--- a/java/com/android/incallui/InCallActivity.java
+++ b/java/com/android/incallui/InCallActivity.java
@@ -406,6 +406,10 @@ public class InCallActivity extends TransactionSafeFragmentActivity
== InCallOrientationEventListener.ACTIVITY_PREFERENCE_ALLOW_ROTATION);
InCallPresenter.getInstance().onActivityStarted();
+ if (!isRecreating) {
+ InCallPresenter.getInstance().onUiShowing(true);
+ }
+
if (ActivityCompat.isInMultiWindowMode(this)
&& !getResources().getBoolean(R.bool.incall_dialpad_allowed)) {
// Hide the dialpad because there may not be enough room
@@ -422,7 +426,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
if (!InCallPresenter.getInstance().isReadyForTearDown()) {
updateTaskDescription();
- InCallPresenter.getInstance().onUiShowing(true);
+ InCallPresenter.getInstance().updateNotification();
}
// If there is a pending request to show or hide the dialpad, handle that now.
@@ -479,12 +483,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
dialpadFragment.onDialerKeyUp(null);
}
- if (!isRecreating) {
- InCallPresenter.getInstance().onUiShowing(false);
- }
- if (isFinishing()) {
- InCallPresenter.getInstance().unsetActivity(this);
- }
+ InCallPresenter.getInstance().updateNotification();
InCallPresenter.getInstance().getPseudoScreenState().removeListener(this);
Trace.endSection();
@@ -513,11 +512,16 @@ public class InCallActivity extends TransactionSafeFragmentActivity
InCallPresenter.getInstance().updateIsChangingConfigurations();
InCallPresenter.getInstance().onActivityStopped();
if (!isRecreating) {
+ InCallPresenter.getInstance().onUiShowing(false);
if (errorDialog != null) {
errorDialog.dismiss();
}
}
+ if (isFinishing()) {
+ InCallPresenter.getInstance().unsetActivity(this);
+ }
+
Trace.endSection();
}
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index f0d3adc7a..558ca33fc 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -1044,14 +1044,16 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
"updateIsChangingConfigurations = " + isChangingConfigurations);
}
- /** Called when the activity goes in/out of the foreground. */
- public void onUiShowing(boolean showing) {
+ void updateNotification() {
// We need to update the notification bar when we leave the UI because that
// could trigger it to show again.
if (statusBarNotifier != null) {
statusBarNotifier.updateNotification();
}
+ }
+ /** Called when the activity goes in/out of the foreground. */
+ public void onUiShowing(boolean showing) {
if (proximitySensor != null) {
proximitySensor.onInCallShowing(showing);
}
diff --git a/java/com/android/newbubble/NewBubble.java b/java/com/android/newbubble/NewBubble.java
index 65f7a0aab..09634b572 100644
--- a/java/com/android/newbubble/NewBubble.java
+++ b/java/com/android/newbubble/NewBubble.java
@@ -926,13 +926,7 @@ public class NewBubble {
root.setOnConfigurationChangedListener(
(configuration) -> {
if (expanded) {
- // Collapse immediately without animation
- if (collapseAnimatorSet != null) {
- collapseAnimatorSet.removeAllListeners();
- collapseAnimatorSet.cancel();
- }
- setDrawerVisibility(View.GONE);
- expanded = false;
+ startCollapse(CollapseEnd.NOTHING, false /* shouldRecoverYPosition */);
}
// The values in the current MoveHandler may be stale, so replace it. Then ensure the
// Window is in bounds