diff options
Diffstat (limited to 'java/com/android/dialer')
8 files changed, 28 insertions, 43 deletions
diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java index 8a986dc41..f50751e2b 100644 --- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java +++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java @@ -260,9 +260,11 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> { if (call.accountComponentName == null || call.accountId == null) { continue; } - PhoneAccountHandle phoneAccountHandle = - new PhoneAccountHandle( - ComponentName.unflattenFromString(call.accountComponentName), call.accountId); + ComponentName componentName = ComponentName.unflattenFromString(call.accountComponentName); + if (componentName == null) { + continue; + } + PhoneAccountHandle phoneAccountHandle = new PhoneAccountHandle(componentName, call.accountId); PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle); if (phoneAccount == null) { continue; diff --git a/java/com/android/dialer/app/res/layout/search_edittext.xml b/java/com/android/dialer/app/res/layout/search_edittext.xml index 63786dfb0..5fc492d29 100644 --- a/java/com/android/dialer/app/res/layout/search_edittext.xml +++ b/java/com/android/dialer/app/res/layout/search_edittext.xml @@ -39,6 +39,7 @@ android:layout_width="@dimen/search_box_icon_size" android:layout_height="@dimen/search_box_icon_size" android:layout_marginStart="8dp" + android:layout_centerVertical="true" android:importantForAccessibility="no" android:scaleType="center" android:src="@drawable/quantum_ic_search_vd_theme_24" diff --git a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java index 74ddff245..0a6f2c156 100644 --- a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java +++ b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java @@ -32,6 +32,7 @@ import com.android.dialer.app.calllog.LegacyVoicemailNotifier; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.PerAccountSharedPreferences; +import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.util.DialerUtils; import com.android.voicemail.VoicemailClient; import com.android.voicemail.VoicemailComponent; @@ -44,16 +45,8 @@ import com.android.voicemail.VoicemailComponent; @TargetApi(VERSION_CODES.O) public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { - private static final String LEGACY_VOICEMAIL_COUNT = "legacy_voicemail_count"; @VisibleForTesting static final String LEGACY_VOICEMAIL_DISMISSED = "legacy_voicemail_dismissed"; - /** - * Whether the notification is just a refresh or for a new voicemail. The phone should not play a - * ringtone or vibrate during a refresh if the notification is already showing. This is Hidden in - * O and public in O MR1. - */ - @VisibleForTesting static final String EXTRA_IS_REFRESH = "is_refresh"; - @Override public void onReceive(Context context, Intent intent) { @@ -79,7 +72,8 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { PhoneAccountHandle phoneAccountHandle = Assert.isNotNull(intent.getParcelableExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE)); int count = intent.getIntExtra(TelephonyManager.EXTRA_NOTIFICATION_COUNT, -1); - boolean isRefresh = intent.getBooleanExtra(EXTRA_IS_REFRESH, false); + + boolean isRefresh = intent.getBooleanExtra(TelephonyManagerCompat.EXTRA_IS_REFRESH, false); LogUtil.i("LegacyVoicemailNotificationReceiver.onReceive", "isRefresh: " + isRefresh); PerAccountSharedPreferences preferences = getSharedPreferences(context, phoneAccountHandle); if (isRefresh) { @@ -93,13 +87,6 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { setDismissed(context, phoneAccountHandle, false); } - if (!hasVoicemailCountChanged(preferences, count)) { - LogUtil.i( - "LegacyVoicemailNotificationReceiver.onReceive", - "voicemail count hasn't changed, ignoring"); - return; - } - if (count == -1) { // Carrier might not send voicemail count. Missing extra means there are unknown numbers of // voicemails (One or more). Treat it as 1 so the generic version will be shown. ("Voicemail" @@ -149,21 +136,6 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { .apply(); } - private static boolean hasVoicemailCountChanged( - PerAccountSharedPreferences preferences, int newCount) { - if (newCount == -1) { - // Carrier does not report voicemail count - return true; - } - - // Carriers may send multiple notifications for the same voicemail. - if (newCount != 0 && newCount == preferences.getInt(LEGACY_VOICEMAIL_COUNT, -1)) { - return false; - } - preferences.edit().putInt(LEGACY_VOICEMAIL_COUNT, newCount).apply(); - return true; - } - @VisibleForTesting static PerAccountSharedPreferences getSharedPreferences( Context context, PhoneAccountHandle phoneAccountHandle) { diff --git a/java/com/android/dialer/app/widget/SearchEditTextLayout.java b/java/com/android/dialer/app/widget/SearchEditTextLayout.java index 95bd12aa1..9da0e245f 100644 --- a/java/com/android/dialer/app/widget/SearchEditTextLayout.java +++ b/java/com/android/dialer/app/widget/SearchEditTextLayout.java @@ -274,7 +274,6 @@ public class SearchEditTextLayout extends FrameLayout { mCollapsedSearchBox.setVisibility(collapsedViewVisibility); mVoiceSearchButtonView.setVisibility(collapsedViewVisibility); mOverflowButtonView.setVisibility(collapsedViewVisibility); - mBackButtonView.setVisibility(expandedViewVisibility); // TODO: Prevents keyboard from jumping up in landscape mode after exiting the // SearchFragment when the query string is empty. More elegant fix? //mExpandedSearchBox.setVisibility(expandedViewVisibility); diff --git a/java/com/android/dialer/assisteddialing/TransformationInfo.java b/java/com/android/dialer/assisteddialing/TransformationInfo.java index 03e565c51..de8f27d01 100644 --- a/java/com/android/dialer/assisteddialing/TransformationInfo.java +++ b/java/com/android/dialer/assisteddialing/TransformationInfo.java @@ -57,19 +57,20 @@ public abstract class TransformationInfo { return new AutoValue_TransformationInfo.Builder(); } + /** A builder for TransformationInfo. */ @AutoValue.Builder - abstract static class Builder { - abstract Builder setOriginalNumber(String value); + public abstract static class Builder { + public abstract Builder setOriginalNumber(String value); - abstract Builder setTransformedNumber(String value); + public abstract Builder setTransformedNumber(String value); - abstract Builder setUserHomeCountryCode(String value); + public abstract Builder setUserHomeCountryCode(String value); - abstract Builder setUserRoamingCountryCode(String value); + public abstract Builder setUserRoamingCountryCode(String value); - abstract Builder setTransformedNumberCountryCallingCode(int value); + public abstract Builder setTransformedNumberCountryCallingCode(int value); - abstract TransformationInfo build(); + public abstract TransformationInfo build(); } public static TransformationInfo newInstanceFromBundle(@NonNull Bundle transformationInfoBundle) { diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java index 61c44b9f4..fbc789900 100644 --- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java +++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java @@ -73,6 +73,9 @@ public class TelephonyManagerCompat { public static final String ASSISTED_DIALING_EXTRAS = "android.telecom.extra.ASSISTED_DIALING_EXTRAS"; + public static final String EXTRA_IS_REFRESH = + BuildCompat.isAtLeastOMR1() ? "android.telephony.extra.IS_REFRESH" : "is_refresh"; + /** * Returns the number of phones available. Returns 1 for Single standby mode (Single SIM * functionality) Returns 2 for Dual standby mode.(Dual SIM functionality) diff --git a/java/com/android/dialer/location/GeoUtil.java b/java/com/android/dialer/location/GeoUtil.java index b39256d32..27fbf2315 100644 --- a/java/com/android/dialer/location/GeoUtil.java +++ b/java/com/android/dialer/location/GeoUtil.java @@ -17,6 +17,7 @@ package com.android.dialer.location; import android.content.Context; +import android.os.Trace; /** Static methods related to Geo. */ public class GeoUtil { @@ -24,6 +25,9 @@ public class GeoUtil { /** @return the ISO 3166-1 two letters country code of the country the user is in. */ public static String getCurrentCountryIso(Context context) { // The {@link CountryDetector} should never return null so this is safe to return as-is. - return CountryDetector.getInstance(context).getCurrentCountryIso(); + Trace.beginSection("GeoUtil.getCurrentCountryIso"); + String countryIso = CountryDetector.getInstance(context).getCurrentCountryIso(); + Trace.endSection(); + return countryIso; } } diff --git a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java index b25e4d7fe..cc9b73081 100644 --- a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java +++ b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java @@ -17,6 +17,7 @@ package com.android.dialer.phonenumberutil; import android.content.Context; +import android.os.Trace; import android.provider.CallLog; import android.support.annotation.Nullable; import android.telecom.PhoneAccountHandle; @@ -113,6 +114,7 @@ public class PhoneNumberHelper { */ public static String getCurrentCountryIso( Context context, @Nullable PhoneAccountHandle phoneAccountHandle) { + Trace.beginSection("PhoneNumberHelper.getCurrentCountryIso"); // Without framework function calls, this seems to be the most accurate location service // we can rely on. String countryIso = @@ -125,6 +127,7 @@ public class PhoneNumberHelper { "No CountryDetector; falling back to countryIso based on locale: " + countryIso); } countryIso = countryIso.toUpperCase(); + Trace.endSection(); return countryIso; } |