From 8285ff9bbd576d31b7b0770152578f0c6811a3f5 Mon Sep 17 00:00:00 2001 From: erfanian Date: Wed, 18 Oct 2017 13:56:00 -0700 Subject: Check AD eligibility before utilizing the feature. Bug: 67914094 Test: unit tests PiperOrigin-RevId: 172650441 Change-Id: Ie7df3174a07df2de3a102fb70a126004f704b22f --- .../android/dialer/assisteddialing/AssistedDialingMediator.java | 3 +++ .../dialer/assisteddialing/AssistedDialingMediatorImpl.java | 7 +++++++ .../dialer/assisteddialing/AssistedDialingMediatorStub.java | 5 +++++ java/com/android/dialer/callintent/CallIntentBuilder.java | 4 +++- 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'java/com') 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 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 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( -- cgit v1.2.3 From 6b864300238962f896ab78eaedea3b04814e3bff Mon Sep 17 00:00:00 2001 From: mdooley Date: Wed, 18 Oct 2017 14:34:08 -0700 Subject: wrapping %s in in tags to prevent translation Bug: 67322107 Test: manual PiperOrigin-RevId: 172656296 Change-Id: Ia8b7d508ef35ff0091b762c28e1091af60ce15b4 --- .../android/dialer/app/voicemail/error/res/values/strings.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'java/com') 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 @@ (800) 922–0204 Turn on visual voicemail - %1$s By turning on visual voicemail you agree to the Verizon Wireless terms and conditions:\n\n%2$s + %1$s By turning on visual voicemail you agree to the Verizon Wireless terms and conditions:\n\n%2$s Turn on visual voicemail - %s + %s 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 %s\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 %s\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 - 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. %s -- cgit v1.2.3 From c18ad7a8c917c6388668784461456cc779031e0b Mon Sep 17 00:00:00 2001 From: yueg Date: Wed, 18 Oct 2017 14:45:05 -0700 Subject: Fix NPE in TelecomAdapter.stopForegroundNotification(). In InCallServiceImpl.tearDown(), we should only clear inCallService after InCallPresenter.tearDown() where we remove all notification. Also remove null assertion in stopForegroundNotification() since other crash should only happens when there is no notification. Test: StatusBarNotifierTest PiperOrigin-RevId: 172657924 Change-Id: I86e720b80f885aa93f12215fda899ee62eeaba5b --- java/com/android/incallui/InCallServiceImpl.java | 2 +- java/com/android/incallui/call/TelecomAdapter.java | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'java/com') 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"); + } } } -- cgit v1.2.3 From 4041c22d478a8a0f052c437cbfcee7ea5834e479 Mon Sep 17 00:00:00 2001 From: roldenburg Date: Wed, 18 Oct 2017 16:11:59 -0700 Subject: Move more Video Share stuff to third_party Bug: 36565933 Test: manual, just moving PiperOrigin-RevId: 172671853 Change-Id: I415f5b7e518cca22fad96b017a573322af3f73be --- .../videoshare/VideoShareException.java | 25 ++++++++++++++++ .../videoshare/VideoShareSessionListener.java | 33 ++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 java/com/android/dialer/enrichedcall/videoshare/VideoShareException.java create mode 100644 java/com/android/dialer/enrichedcall/videoshare/VideoShareSessionListener.java (limited to 'java/com') 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); +} -- cgit v1.2.3 From b8337d12753806ac478621a0a1e53a5d9b21c996 Mon Sep 17 00:00:00 2001 From: linyuh Date: Wed, 18 Oct 2017 17:48:58 -0700 Subject: Take into account special dialable characters when grouping calls in the call log UI. Currently we use PhoneNumberUtils#compare(String, String) to determine whether two numbers in the call log should be grouped. The method ignores special dialable characters such as "#", "*", "+", etc, which can cause phone numbers and service dialing numbers to be grouped. For example, suppose the user has a contact named "John Smith" with number 123456789 and a contact named "Service" with number #123456789, and called each contact once. The old grouping logic will put the two numbers in the same group. The new grouping logic in this CL can separate the two numbers. Bug: 30225112 Test: CallLogGroupBuilderTest, PhoneNumberHelperTest PiperOrigin-RevId: 172683494 Change-Id: Ie9e7b7418d6d7c74830cbae09c04ff1feb1b827d --- .../dialer/app/calllog/CallLogGroupBuilder.java | 3 +- .../dialer/phonenumberutil/PhoneNumberHelper.java | 76 ++++++++++++++-------- 2 files changed, 49 insertions(+), 30 deletions(-) (limited to 'java/com') 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/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)}. + * + *

The two phone numbers are considered "identical enough" if + * + *

    + *
  • 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 + *
  • at least one of the raw numbers is not a global phone number and the two raw numbers are + * exactly the same. + *
+ * + * 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. + * + *

See the description of {@link PhoneNumberHelper#compare(String, String)} for the definition + * of "identical enough". * *

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. * *

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. - * - *

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. - * - *

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. - * - *

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; -- cgit v1.2.3 From 88041ae80c81fc4dfab1e17f937baa35688b0040 Mon Sep 17 00:00:00 2001 From: maxwelb Date: Wed, 18 Oct 2017 18:00:47 -0700 Subject: Automated g4 rollback of changelist 172154863. *** Reason for rollback *** Causes crashes on rotation: http://b/67839843 *** Original change description *** Do not load every DialtactsActivity fragment on app open With this change we now only load the Favorites and Call Log Fragments when the app opens. Paging to the CallLogFragment makes the ContactsFragment load as we would want. This should result in a faster app start time. I'll need to verify the impact of this using the same method as http://cl/170422671 I verified the change in behavior by adding my own log line to the onCreate of each Fragment. I saw all of them get created before the ch... *** Bug: 64541209,65460373 Test: Manually verified regression fixed PiperOrigin-RevId: 172684553 Change-Id: I9a5b30d6619d930adfb82b19ac3ff9da00decaaa --- java/com/android/dialer/app/list/ListsFragment.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'java/com') 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); -- cgit v1.2.3