summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-10-19 17:05:55 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-10-19 17:05:55 +0000
commit958b292fc04ad15879fff47df929d6d1a826615c (patch)
tree7f16f98729404c79ed9d2d8dd6894e05a4049539 /java
parent5cb3ecff08854c7b3da976f7981d1b9c3ff5bee0 (diff)
parent88041ae80c81fc4dfab1e17f937baa35688b0040 (diff)
Merge changes I9a5b30d6,Ie9e7b741,I415f5b7e,I86e720b8,Ia8b7d508, ...
* changes: Automated g4 rollback of changelist 172154863. Take into account special dialable characters when grouping calls in the call log UI. Move more Video Share stuff to third_party Fix NPE in TelecomAdapter.stopForegroundNotification(). wrapping %s in in <xliff:g> </xliff:g> tags to prevent translation Check AD eligibility before utilizing the feature.
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/app/calllog/CallLogGroupBuilder.java3
-rw-r--r--java/com/android/dialer/app/list/ListsFragment.java6
-rw-r--r--java/com/android/dialer/app/voicemail/error/res/values/strings.xml10
-rw-r--r--java/com/android/dialer/assisteddialing/AssistedDialingMediator.java3
-rw-r--r--java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java7
-rw-r--r--java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java5
-rw-r--r--java/com/android/dialer/callintent/CallIntentBuilder.java4
-rw-r--r--java/com/android/dialer/enrichedcall/videoshare/VideoShareException.java25
-rw-r--r--java/com/android/dialer/enrichedcall/videoshare/VideoShareSessionListener.java33
-rw-r--r--java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java76
-rw-r--r--java/com/android/incallui/InCallServiceImpl.java2
-rw-r--r--java/com/android/incallui/call/TelecomAdapter.java10
12 files changed, 139 insertions, 45 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
index 513c8aa59..f689571bd 100644
--- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
+++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
@@ -21,7 +21,6 @@ import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
-import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.text.format.Time;
import com.android.contacts.common.util.DateUtils;
@@ -194,7 +193,7 @@ public class CallLogGroupBuilder {
if (PhoneNumberHelper.isUriNumber(number1) || PhoneNumberHelper.isUriNumber(number2)) {
return compareSipAddresses(number1, number2);
} else {
- return PhoneNumberUtils.compare(number1, number2);
+ return PhoneNumberHelper.compare(number1, number2);
}
}
diff --git a/java/com/android/dialer/app/list/ListsFragment.java b/java/com/android/dialer/app/list/ListsFragment.java
index 05c647aec..362997a5a 100644
--- a/java/com/android/dialer/app/list/ListsFragment.java
+++ b/java/com/android/dialer/app/list/ListsFragment.java
@@ -203,11 +203,7 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
mPrefs.getBoolean(
VisualVoicemailEnabledChecker.PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER, false));
mViewPager.setAdapter(mAdapter);
-
- // This is deliberate. See cl/172018946 for the app startup implications of using 1 here
- // versus loading more fragments upfront.
- mViewPager.setOffscreenPageLimit(1);
-
+ mViewPager.setOffscreenPageLimit(DialtactsPagerAdapter.TAB_COUNT_WITH_VOICEMAIL - 1);
mViewPager.addOnPageChangeListener(this);
showTab(DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL);
diff --git a/java/com/android/dialer/app/voicemail/error/res/values/strings.xml b/java/com/android/dialer/app/voicemail/error/res/values/strings.xml
index bf5794b0b..eb4877a4b 100644
--- a/java/com/android/dialer/app/voicemail/error/res/values/strings.xml
+++ b/java/com/android/dialer/app/voicemail/error/res/values/strings.xml
@@ -137,10 +137,10 @@
<string translatable="false" name="verizon_domestic_customer_support_display_number">(800) 922–0204</string>
<string name="verizon_terms_and_conditions_title">Turn on visual voicemail</string>
- <string name="verizon_terms_and_conditions_message">%1$s By turning on visual voicemail you agree to the Verizon Wireless terms and conditions:\n\n%2$s</string>
+ <string name="verizon_terms_and_conditions_message"><xliff:g>%1$s</xliff:g> By turning on visual voicemail you agree to the Verizon Wireless terms and conditions:\n\n<xliff:g>%2$s</xliff:g></string>
<string name="dialer_terms_and_conditions_title">Turn on visual voicemail</string>
- <string name="dialer_terms_and_conditions_message">%s</string>
+ <string name="dialer_terms_and_conditions_message"><xliff:g>%s</xliff:g></string>
<string translatable="false" name="verizon_terms_and_conditions_1.1_english">
Visual Voice Mail (VVM) is a service that provides access to voice mail messages directly on the device, without the need to call *86. This service requires traditional Voice Mail but does not support all traditional Voice Mail features, which you can access by dialing *86 from your handset. Use of this feature will be billed on a per-megabyte basis, or according to any data package you have. Mobile to mobile minutes do not apply. Standard rates apply to any calls, emails or messages initiated from Visual Voice Mail.\n
@@ -149,7 +149,7 @@ You may disable VVM in settings. This will revert you to basic voice mail. In so
\n
For the Premium Visual Voice Mail service, some voice messages may not be completely transcribed; incomplete messages will end with [...]. Only the first 45 seconds of each voice message will be transcribed, so for longer messages, you will need to listen to the voice message itself. Any profane or offensive language also will not be transcribed and will appear as [...] in the transcription.\n
\n
-Speech recordings may be collected and stored for a period of 30 days, solely for the purpose of testing and improving transcription technology and performance, subject to the Verizon Wireless Privacy Policy, which can be found at %s\n
+Speech recordings may be collected and stored for a period of 30 days, solely for the purpose of testing and improving transcription technology and performance, subject to the Verizon Wireless Privacy Policy, which can be found at <xliff:g>%s</xliff:g>\n
\n
You understand that by selecting ACCEPT, your messages will be stored and anyone in possession of this device will have access to your voice mail. You further understand that your voice mail messages may be stored in electronic format on this device. To limit unauthorized access to your voice mail, you should consider locking your phone when not in use. Not available in all areas or over Wi\u2011Fi.\n
\n
@@ -162,7 +162,7 @@ Puede inhabilitar el VVM en la configuración. Esto le permite volver al buzón
\n
En el caso del servicio de buzón de voz visual premium, es posible que algunos mensajes no se transcriban totalmente; los mensajes incompletos finalizan con "[…]". Solo se transcriben los primeros 45 segundos de cada mensaje de voz, por lo que debe escuchar los mensajes de voz más largos. Tampoco se transcribe ninguna palabra ofensiva o profana; aparece como "[…]" en la transcripción.\n
\n
-Es posible que reunamos y almacenemos grabaciones de voz durante 30 días, con el único fin de probar y mejorar el rendimiento y la tecnología de la transcripción, sujeto a la Política de privacidad de Verizon Wireless, disponible en %s\n
+Es posible que reunamos y almacenemos grabaciones de voz durante 30 días, con el único fin de probar y mejorar el rendimiento y la tecnología de la transcripción, sujeto a la Política de privacidad de Verizon Wireless, disponible en <xliff:g>%s</xliff:g>\n
\n
Entiende que, al seleccionar ACEPTAR, sus mensajes se almacenarán, y cualquier persona que disponga de este dispositivo tendrá acceso al buzón de voz. Entiende, además, que los mensajes de voz pueden almacenarse en formato electrónico en este dispositivo. Para limitar el acceso no autorizado al buzón de voz, debe considerar el bloqueo del teléfono cuando no está en uso. No está disponible en todas las áreas ni mediante Wi\u2011Fi.\n
\n
@@ -170,7 +170,7 @@ Si no acepta todos estos términos y condiciones, no use el buzón de voz visual
</string>
<string name="dialer_terms_and_conditions_1.0">
- See and listen to your messages, without having to call voicemail. Transcripts of your voicemail are provided by Google’s free transcription service. %s
+ See and listen to your messages, without having to call voicemail. Transcripts of your voicemail are provided by Google’s free transcription service. <xliff:g>%s</xliff:g>
</string>
<string name="dialer_terms_and_conditions_for_verizon_1.0">
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
index 4dc87a772..004d2f7da 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
@@ -24,6 +24,9 @@ import java.util.Optional;
/** The core interface for the AssistedDialingMediator. */
public interface AssistedDialingMediator {
+ /** Returns {@code true} if the current client platform supports Assisted Dialing. */
+ public boolean isPlatformEligible();
+
@SuppressWarnings("AndroidApiChecker") // Use of optional
@TargetApi(VERSION_CODES.N)
public Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform);
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
index 1692614bb..202760751 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
@@ -17,6 +17,7 @@
package com.android.dialer.assisteddialing;
import android.annotation.TargetApi;
+import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import com.android.dialer.common.LogUtil;
@@ -47,6 +48,12 @@ final class AssistedDialingMediatorImpl implements AssistedDialingMediator {
this.numberTransformer = numberTransformer;
}
+ @Override
+ public boolean isPlatformEligible() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
+ && Build.VERSION.SDK_INT <= Build.VERSION_CODES.O;
+ }
+
/**
* Returns an Optional of type String containing the transformed number that was provided. The
* transformed number should be capable of dialing out of the User's current country and
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
index c7a821214..fe32e2c9a 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
@@ -31,4 +31,9 @@ public final class AssistedDialingMediatorStub implements AssistedDialingMediato
public Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform) {
return Optional.empty();
}
+
+ @Override
+ public boolean isPlatformEligible() {
+ return false;
+ }
}
diff --git a/java/com/android/dialer/callintent/CallIntentBuilder.java b/java/com/android/dialer/callintent/CallIntentBuilder.java
index dc239dc6b..2bbd124fb 100644
--- a/java/com/android/dialer/callintent/CallIntentBuilder.java
+++ b/java/com/android/dialer/callintent/CallIntentBuilder.java
@@ -126,7 +126,9 @@ public class CallIntentBuilder {
Intent intent = new Intent(Intent.ACTION_CALL, uri);
Bundle extras = new Bundle();
- if (allowAssistedDial && this.assistedDialingMediator != null) {
+ if (allowAssistedDial
+ && this.assistedDialingMediator != null
+ && this.assistedDialingMediator.isPlatformEligible()) {
intent = buildAssistedDialingParameters(intent, extras);
}
intent.putExtra(
diff --git a/java/com/android/dialer/enrichedcall/videoshare/VideoShareException.java b/java/com/android/dialer/enrichedcall/videoshare/VideoShareException.java
new file mode 100644
index 000000000..9d3a9ab23
--- /dev/null
+++ b/java/com/android/dialer/enrichedcall/videoshare/VideoShareException.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dialer.enrichedcall.videoshare;
+
+/** Exceptions occurring from using DreamVideo and video share configuration. */
+public class VideoShareException extends Exception {
+
+ public VideoShareException(String message) {
+ super(message);
+ }
+}
diff --git a/java/com/android/dialer/enrichedcall/videoshare/VideoShareSessionListener.java b/java/com/android/dialer/enrichedcall/videoshare/VideoShareSessionListener.java
new file mode 100644
index 000000000..1e612bf2e
--- /dev/null
+++ b/java/com/android/dialer/enrichedcall/videoshare/VideoShareSessionListener.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dialer.enrichedcall.videoshare;
+
+/** Interface for receiving updates on session initialization failure or termination. */
+public interface VideoShareSessionListener {
+
+ void onSessionTerminated(VideoShareSession session);
+
+ void onSessionInitializationFailed(VideoShareSession session, Exception e);
+
+ /**
+ * Called when a session hasn't received a keep-alive or video packet within the timeout time
+ * period.
+ *
+ * @param session The session that timed out
+ */
+ void onSessionTimedOut(VideoShareSession session);
+}
diff --git a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
index 84cbb6947..a53676b9a 100644
--- a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
+++ b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
@@ -34,6 +34,7 @@ import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtilComponent;
import com.android.dialer.telecom.TelecomUtil;
import java.util.Arrays;
import java.util.HashSet;
+import java.util.Objects;
import java.util.Set;
public class PhoneNumberHelper {
@@ -50,7 +51,46 @@ public class PhoneNumberHelper {
}
/**
- * Find the cursor pointing to a number that matches the number in a contact lookup URI.
+ * Compare two phone numbers, return true if they're identical enough for caller ID purposes. This
+ * is an enhanced version of {@link PhoneNumberUtils#compare(String, String)}.
+ *
+ * <p>The two phone numbers are considered "identical enough" if
+ *
+ * <ul>
+ * <li>their corresponding raw numbers are both global phone numbers (i.e., they can be accepted
+ * by {@link PhoneNumberUtils#isGlobalPhoneNumber(String)}) and {@link
+ * PhoneNumberUtils#compare(String, String)} deems them as "identical enough"; OR
+ * <li>at least one of the raw numbers is not a global phone number and the two raw numbers are
+ * exactly the same.
+ * </ul>
+ *
+ * The raw number of a phone number is obtained by first translating any alphabetic letters
+ * ([A-Za-z]) into the equivalent numeric digits and then removing all separators. See {@link
+ * PhoneNumberUtils#convertKeypadLettersToDigits(String)} and {@link
+ * PhoneNumberUtils#stripSeparators(String)}.
+ */
+ public static boolean compare(@Nullable String number1, @Nullable String number2) {
+ if (number1 == null || number2 == null) {
+ return Objects.equals(number1, number2);
+ }
+
+ String rawNumber1 =
+ PhoneNumberUtils.stripSeparators(PhoneNumberUtils.convertKeypadLettersToDigits(number1));
+ String rawNumber2 =
+ PhoneNumberUtils.stripSeparators(PhoneNumberUtils.convertKeypadLettersToDigits(number2));
+
+ return PhoneNumberUtils.isGlobalPhoneNumber(rawNumber1)
+ && PhoneNumberUtils.isGlobalPhoneNumber(rawNumber2)
+ ? PhoneNumberUtils.compare(rawNumber1, rawNumber2)
+ : rawNumber1.equals(rawNumber2);
+ }
+
+ /**
+ * Find the cursor pointing to the row in which a number is identical enough to the number in a
+ * contact lookup URI.
+ *
+ * <p>See the description of {@link PhoneNumberHelper#compare(String, String)} for the definition
+ * of "identical enough".
*
* <p>When determining whether two phone numbers are identical enough for caller ID purposes, the
* Contacts Provider uses {@link PhoneNumberUtils#compare(String, String)}, which ignores special
@@ -58,25 +98,17 @@ public class PhoneNumberHelper {
* by the Contacts Provider to have multiple rows even when the URI asks for a specific number.
*
* <p>For example, suppose the user has two contacts whose numbers are "#123" and "123",
- * respectively. When the URI asks for number "123", both numbers will be returned. Therefore, the
- * following strategy is employed to find a match.
- *
- * <p>If the cursor points to a global phone number (i.e., a number that can be accepted by {@link
- * PhoneNumberUtils#isGlobalPhoneNumber(String)}) and the lookup number in the URI is a PARTIAL
- * match, return the cursor.
- *
- * <p>If the cursor points to a number that is not a global phone number, return the cursor iff
- * the lookup number in the URI is an EXACT match.
- *
- * <p>Return null in all other circumstances.
+ * respectively. When the URI asks for number "123", both numbers will be returned. Therefore,
+ * {@link PhoneNumberHelper#compare(String, String)}, which is an enhanced version of {@link
+ * PhoneNumberUtils#compare(String, String)}, is employed to find a match.
*
* @param cursor A cursor returned by the Contacts Provider.
* @param columnIndexForNumber The index of the column where phone numbers are stored. It is the
* caller's responsibility to pass the correct column index.
* @param contactLookupUri A URI used to retrieve a contact via the Contacts Provider. It is the
* caller's responsibility to ensure the URI is one that asks for a specific phone number.
- * @return The cursor considered as a match by the description above or null if no such cursor can
- * be found.
+ * @return The cursor pointing to the row in which the number is considered a match by the
+ * description above or null if no such cursor can be found.
*/
public static Cursor getCursorMatchForContactLookupUri(
Cursor cursor, int columnIndexForNumber, Uri contactLookupUri) {
@@ -96,22 +128,10 @@ public class PhoneNumberHelper {
return null;
}
- boolean isMatchFound;
do {
- // All undialable characters should be converted/removed before comparing the lookup number
- // and the existing contact number.
- String rawExistingContactNumber =
- PhoneNumberUtils.stripSeparators(
- PhoneNumberUtils.convertKeypadLettersToDigits(
- cursor.getString(columnIndexForNumber)));
- String rawQueryNumber =
- PhoneNumberUtils.stripSeparators(
- PhoneNumberUtils.convertKeypadLettersToDigits(lookupNumber));
+ String existingContactNumber = cursor.getString(columnIndexForNumber);
- isMatchFound =
- PhoneNumberUtils.isGlobalPhoneNumber(rawExistingContactNumber)
- ? rawExistingContactNumber.contains(rawQueryNumber)
- : rawExistingContactNumber.equals(rawQueryNumber);
+ boolean isMatchFound = compare(existingContactNumber, lookupNumber);
if (isMatchFound) {
return cursor;
diff --git a/java/com/android/incallui/InCallServiceImpl.java b/java/com/android/incallui/InCallServiceImpl.java
index 8570c58c4..2c45cb375 100644
--- a/java/com/android/incallui/InCallServiceImpl.java
+++ b/java/com/android/incallui/InCallServiceImpl.java
@@ -119,8 +119,8 @@ public class InCallServiceImpl extends InCallService {
Trace.beginSection("InCallServiceImpl.tearDown");
Log.v(this, "tearDown");
// Tear down the InCall system
- TelecomAdapter.getInstance().clearInCallService();
InCallPresenter.getInstance().tearDown();
+ TelecomAdapter.getInstance().clearInCallService();
if (returnToCallController != null) {
returnToCallController.tearDown();
returnToCallController = null;
diff --git a/java/com/android/incallui/call/TelecomAdapter.java b/java/com/android/incallui/call/TelecomAdapter.java
index 0c0bbd473..d48ab68c2 100644
--- a/java/com/android/incallui/call/TelecomAdapter.java
+++ b/java/com/android/incallui/call/TelecomAdapter.java
@@ -185,8 +185,12 @@ public class TelecomAdapter implements InCallServiceListener {
* Stop a started foreground notification. This does not stop {@code mInCallService} from running.
*/
public void stopForegroundNotification() {
- Assert.isNotNull(
- mInCallService, "No inCallService available for stopping foreground notification");
- mInCallService.stopForeground(true /*removeNotification*/);
+ if (mInCallService != null) {
+ mInCallService.stopForeground(true /*removeNotification*/);
+ } else {
+ LogUtil.e(
+ "TelecomAdapter.stopForegroundNotification",
+ "no inCallService available for stopping foreground notification");
+ }
}
}