diff options
101 files changed, 714 insertions, 407 deletions
diff --git a/java/com/android/dialer/app/DialtactsActivity.java b/java/com/android/dialer/app/DialtactsActivity.java index 06f094d5e..25a69564d 100644 --- a/java/com/android/dialer/app/DialtactsActivity.java +++ b/java/com/android/dialer/app/DialtactsActivity.java @@ -93,7 +93,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.common.UiUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.ThreadUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.contactsfragment.ContactsFragment; import com.android.dialer.contactsfragment.ContactsFragment.OnContactSelectedListener; @@ -367,7 +367,8 @@ public class DialtactsActivity extends TransactionSafeActivity super.onCreate(savedInstanceState); firstLaunch = true; - isLastTabEnabled = ConfigProviderBindings.get(this).getBoolean("last_tab_enabled", false); + isLastTabEnabled = + ConfigProviderComponent.get(this).getConfigProvider().getBoolean("last_tab_enabled", false); final Resources resources = getResources(); actionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height_large); @@ -1622,6 +1623,8 @@ public class DialtactsActivity extends TransactionSafeActivity } private boolean newFavoritesIsEnabled() { - return ConfigProviderBindings.get(this).getBoolean("enable_new_favorites_tab", false); + return ConfigProviderComponent.get(this) + .getConfigProvider() + .getBoolean("enable_new_favorites_tab", false); } } diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index 143af367a..a4479da9e 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -73,7 +73,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.AsyncTaskExecutor; import com.android.dialer.common.concurrent.AsyncTaskExecutors; import com.android.dialer.compat.android.provider.VoicemailCompat; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.duo.Duo; import com.android.dialer.duo.DuoComponent; import com.android.dialer.duo.DuoListener; @@ -287,7 +287,8 @@ public class CallLogAdapter extends GroupingListAdapter new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { - if (ConfigProviderBindings.get(v.getContext()) + if (ConfigProviderComponent.get(v.getContext()) + .getConfigProvider() .getBoolean(ENABLE_CALL_LOG_MULTI_SELECT, ENABLE_CALL_LOG_MULTI_SELECT_FLAG) && voicemailPlaybackPresenter != null) { if (v.getId() == R.id.primary_action_view || v.getId() == R.id.quick_contact_photo) { @@ -852,7 +853,9 @@ public class CallLogAdapter extends GroupingListAdapter } private boolean isHideableEmergencyNumberRow(@Nullable String number) { - if (!ConfigProviderBindings.get(activity).getBoolean(FILTER_EMERGENCY_CALLS_FLAG, false)) { + if (!ConfigProviderComponent.get(activity) + .getConfigProvider() + .getBoolean(FILTER_EMERGENCY_CALLS_FLAG, false)) { return false; } return number != null && PhoneNumberUtils.isEmergencyNumber(number); @@ -1058,7 +1061,8 @@ public class CallLogAdapter extends GroupingListAdapter details.countryIso, details.cachedContactInfo, position - < ConfigProviderBindings.get(activity) + < ConfigProviderComponent.get(activity) + .getConfigProvider() .getLong("number_of_call_to_do_remote_lookup", 5L)); logCp2Metrics(details, info); } diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index 1e55c6358..771254ee8 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -58,7 +58,7 @@ import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; import com.android.dialer.common.Assert; import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.database.CallLogQueryHandler; import com.android.dialer.database.CallLogQueryHandler.Listener; import com.android.dialer.location.GeoUtil; @@ -297,7 +297,9 @@ public class CallLogFragment extends Fragment protected void setupView(View view) { recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); - if (ConfigProviderBindings.get(getContext()).getBoolean("is_call_log_item_anim_null", false)) { + if (ConfigProviderComponent.get(getContext()) + .getConfigProvider() + .getBoolean("is_call_log_item_anim_null", false)) { recyclerView.setItemAnimator(null); } recyclerView.setHasFixedSize(true); diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 9b7741df4..5b579f50f 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -69,7 +69,7 @@ import com.android.dialer.clipboard.ClipboardUtils; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.AsyncTaskExecutors; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.dialercontact.DialerContact; @@ -309,7 +309,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder primaryActionButtonView.setOnClickListener(this); primaryActionView.setOnClickListener(this.expandCollapseListener); if (this.voicemailPlaybackPresenter != null - && ConfigProviderBindings.get(this.context) + && ConfigProviderComponent.get(this.context) + .getConfigProvider() .getBoolean( CallLogAdapter.ENABLE_CALL_LOG_MULTI_SELECT, CallLogAdapter.ENABLE_CALL_LOG_MULTI_SELECT_FLAG)) { @@ -599,6 +600,29 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder setUpVideoButtonView.setVisibility(View.GONE); inviteVideoButtonView.setVisibility(View.GONE); + // For an emergency number, show "Call details" only. + if (PhoneNumberHelper.isLocalEmergencyNumber(context, number)) { + createNewContactButtonView.setVisibility(View.GONE); + addToExistingContactButtonView.setVisibility(View.GONE); + sendMessageView.setVisibility(View.GONE); + callWithNoteButtonView.setVisibility(View.GONE); + callComposeButtonView.setVisibility(View.GONE); + blockReportView.setVisibility(View.GONE); + blockView.setVisibility(View.GONE); + unblockView.setVisibility(View.GONE); + reportNotSpamView.setVisibility(View.GONE); + voicemailPlaybackView.setVisibility(View.GONE); + + detailsButtonView.setVisibility(View.VISIBLE); + detailsButtonView.setTag( + IntentProvider.getCallDetailIntentProvider( + callDetailsEntries, + buildContact(), + /* canReportCallerId = */ false, + /* canSupportAssistedDialing = */ false)); + return; + } + if (isFullyUndialableVoicemail()) { // Sometimes the voicemail server will report the message is from some non phone number // source. If the number does not contains any dialable digit treat it as it is from a unknown @@ -687,7 +711,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder videoCallButtonView.setVisibility(View.VISIBLE); CallIntentBuilder.increaseLightbringerCallButtonAppearInExpandedCallLogItemCount(); } else if (duo.isActivated(context) && !identifiedSpamCall) { - if (ConfigProviderBindings.get(context) + if (ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("enable_call_log_duo_invite_button", false)) { inviteVideoButtonView.setTag(IntentProvider.getDuoInviteIntentProvider(number)); inviteVideoButtonView.setVisibility(View.VISIBLE); @@ -696,7 +721,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } } else if (duo.isEnabled(context) && !identifiedSpamCall) { if (!duo.isInstalled(context)) { - if (ConfigProviderBindings.get(context) + if (ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("enable_call_log_install_duo_button", false)) { setUpVideoButtonView.setTag(IntentProvider.getInstallDuoIntentProvider()); setUpVideoButtonView.setVisibility(View.VISIBLE); @@ -705,7 +731,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder CallIntentBuilder.increaseLightbringerCallButtonAppearInExpandedCallLogItemCount(); } } else { - if (ConfigProviderBindings.get(context) + if (ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("enable_call_log_activate_duo_button", false)) { setUpVideoButtonView.setTag(IntentProvider.getSetUpDuoIntentProvider()); setUpVideoButtonView.setVisibility(View.VISIBLE); diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java index d13702931..b5ca0901b 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java @@ -39,7 +39,7 @@ import com.android.dialer.calllogutils.PhoneNumberDisplayUtil; import com.android.dialer.common.LogUtil; import com.android.dialer.common.database.Selection; import com.android.dialer.compat.android.provider.VoicemailCompat; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.location.GeoUtil; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.phonenumbercache.ContactInfoHelper; @@ -167,7 +167,8 @@ public class CallLogNotificationsQueryHelper { return newCallsQuery.query( Calls.VOICEMAIL_TYPE, System.currentTimeMillis() - - ConfigProviderBindings.get(context) + - ConfigProviderComponent.get(context) + .getConfigProvider() .getLong( CONFIG_NEW_VOICEMAIL_NOTIFICATION_THRESHOLD_OFFSET, TimeUnit.DAYS.toMillis(7))); } diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java index 2632fb380..9d04cb2c8 100644 --- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java +++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java @@ -48,6 +48,8 @@ import com.android.dialer.compat.android.provider.VoicemailCompat; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.logging.ContactSource; import com.android.dialer.oem.MotorolaUtils; +import com.android.dialer.phonenumbercache.CachedNumberLookupService; +import com.android.dialer.phonenumbercache.PhoneNumberCache; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.spannable.ContentWithLearnMoreSpanner; import com.android.dialer.storage.StorageComponent; @@ -76,6 +78,8 @@ public class PhoneCallDetailsHelper private final CallLogCache callLogCache; /** Calendar used to construct dates */ private final Calendar calendar; + + private final CachedNumberLookupService cachedNumberLookupService; /** The injected current time in milliseconds since the epoch. Used only by tests. */ private Long currentTimeMillisForTest; @@ -95,6 +99,7 @@ public class PhoneCallDetailsHelper this.resources = resources; this.callLogCache = callLogCache; calendar = Calendar.getInstance(); + cachedNumberLookupService = PhoneNumberCache.get(context).getCachedNumberLookupService(); } static boolean shouldShowVoicemailDonationPromo( @@ -125,7 +130,7 @@ public class PhoneCallDetailsHelper } /** Returns true if primary name is empty or the data is from Cequint Caller ID. */ - private static boolean shouldShowLocation(PhoneCallDetails details) { + private boolean shouldShowLocation(PhoneCallDetails details) { if (TextUtils.isEmpty(details.geocode)) { return false; } @@ -133,6 +138,11 @@ public class PhoneCallDetailsHelper if (details.sourceType == ContactSource.Type.SOURCE_TYPE_CEQUINT_CALLER_ID) { return true; } + if (cachedNumberLookupService != null + && cachedNumberLookupService.isBusiness(details.sourceType)) { + return true; + } + // Don't bother showing geo location for contacts. if (!TextUtils.isEmpty(details.namePrimary)) { return false; @@ -482,7 +492,6 @@ public class PhoneCallDetailsHelper : Phone.getTypeLabel(resources, details.numberType, details.numberLabel); } } - if (!TextUtils.isEmpty(details.namePrimary) && TextUtils.isEmpty(numberFormattedLabel)) { numberFormattedLabel = details.displayNumber; } diff --git a/java/com/android/dialer/app/res/layout/call_log_list_item.xml b/java/com/android/dialer/app/res/layout/call_log_list_item.xml index fd73e0bb4..c9c1a6739 100644 --- a/java/com/android/dialer/app/res/layout/call_log_list_item.xml +++ b/java/com/android/dialer/app/res/layout/call_log_list_item.xml @@ -97,7 +97,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="@dimen/call_log_name_margin_bottom" android:layout_marginEnd="@dimen/call_log_icon_margin" - style="Dialer.TextAppearance.Primary.Ellipsize"/> + style="@style/Dialer.TextAppearance.Primary.Ellipsize"/> <LinearLayout android:id="@+id/call_type" diff --git a/java/com/android/dialer/app/res/layout/empty_content_view_dialpad_search.xml b/java/com/android/dialer/app/res/layout/empty_content_view_dialpad_search.xml index 437fa7d18..d5f315eef 100644 --- a/java/com/android/dialer/app/res/layout/empty_content_view_dialpad_search.xml +++ b/java/com/android/dialer/app/res/layout/empty_content_view_dialpad_search.xml @@ -32,7 +32,7 @@ android:paddingLeft="16dp" android:paddingTop="8dp" android:paddingBottom="8dp" - style="Dialer.TextAppearance.Primary.Ellipsize"/> + style="@style/Dialer.TextAppearance.Primary.Ellipsize"/> <TextView android:id="@+id/empty_list_view_action" diff --git a/java/com/android/dialer/app/settings/DialerSettingsActivity.java b/java/com/android/dialer/app/settings/DialerSettingsActivity.java index 6b763aeb3..9cd01b64b 100644 --- a/java/com/android/dialer/app/settings/DialerSettingsActivity.java +++ b/java/com/android/dialer/app/settings/DialerSettingsActivity.java @@ -38,7 +38,7 @@ import com.android.dialer.assisteddialing.ConcreteCreator; import com.android.dialer.blocking.FilteredNumberCompat; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.telephony.TelephonyManagerCompat; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.proguard.UsedByReflection; import com.android.dialer.util.PermissionsUtil; import com.android.dialer.voicemail.settings.VoicemailSettingsFragment; @@ -160,7 +160,7 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { boolean isAssistedDialingEnabled = ConcreteCreator.isAssistedDialingEnabled( - ConfigProviderBindings.get(getApplicationContext())); + ConfigProviderComponent.get(getApplicationContext()).getConfigProvider()); LogUtil.i( "DialerSettingsActivity.onBuildHeaders", "showing assisted dialing header: " + isAssistedDialingEnabled); diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java index 917870ec7..e4c075b7d 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java +++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java @@ -52,7 +52,7 @@ import com.android.dialer.common.concurrent.AsyncTaskExecutor; import com.android.dialer.common.concurrent.AsyncTaskExecutors; import com.android.dialer.common.concurrent.DialerExecutor; import com.android.dialer.common.concurrent.DialerExecutorComponent; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.constants.Constants; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; @@ -870,7 +870,9 @@ public class VoicemailPlaybackPresenter } private static boolean isShareVoicemailAllowed(Context context) { - return ConfigProviderBindings.get(context).getBoolean(CONFIG_SHARE_VOICEMAIL_ALLOWED, true); + return ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean(CONFIG_SHARE_VOICEMAIL_ALLOWED, true); } private static class ShareVoicemailWorker diff --git a/java/com/android/dialer/assisteddialing/ConcreteCreator.java b/java/com/android/dialer/assisteddialing/ConcreteCreator.java index dfd28a661..050774340 100644 --- a/java/com/android/dialer/assisteddialing/ConcreteCreator.java +++ b/java/com/android/dialer/assisteddialing/ConcreteCreator.java @@ -27,7 +27,7 @@ import android.support.v4.os.UserManagerCompat; import android.telephony.TelephonyManager; import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProvider; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.strictmode.StrictModeUtils; /** @@ -55,7 +55,7 @@ public final class ConcreteCreator { public static AssistedDialingMediator createNewAssistedDialingMediator( @NonNull TelephonyManager telephonyManager, @NonNull Context context) { - ConfigProvider configProvider = ConfigProviderBindings.get(context); + ConfigProvider configProvider = ConfigProviderComponent.get(context).getConfigProvider(); if (telephonyManager == null) { LogUtil.i( diff --git a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java index f1ea4c9dc..965a16975 100644 --- a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java +++ b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java @@ -29,7 +29,7 @@ import com.android.dialer.assisteddialing.AssistedDialingMediator; import com.android.dialer.assisteddialing.ConcreteCreator; import com.android.dialer.assisteddialing.CountryCodeProvider; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.google.auto.value.AutoValue; @@ -70,7 +70,8 @@ public class AssistedDialingSettingFragment extends PreferenceFragment { getContext().getSystemService(TelephonyManager.class), getContext()); countryCodeProvider = - ConcreteCreator.getCountryCodeProvider(ConfigProviderBindings.get(getContext())); + ConcreteCreator.getCountryCodeProvider( + ConfigProviderComponent.get(getContext()).getConfigProvider()); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.assisted_dialing_setting); diff --git a/java/com/android/dialer/blocking/Blocking.java b/java/com/android/dialer/blocking/Blocking.java index e86d0a6ac..a1d8b4fb3 100644 --- a/java/com/android/dialer/blocking/Blocking.java +++ b/java/com/android/dialer/blocking/Blocking.java @@ -16,14 +16,27 @@ package com.android.dialer.blocking; +import android.content.ContentProviderOperation; +import android.content.ContentProviderResult; +import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; +import android.content.OperationApplicationException; +import android.database.Cursor; +import android.os.RemoteException; +import android.provider.BlockedNumberContract; import android.provider.BlockedNumberContract.BlockedNumbers; import android.support.annotation.Nullable; import android.telephony.PhoneNumberUtils; +import android.util.ArrayMap; +import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.database.Selection; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** Blocks and unblocks number. */ public final class Blocking { @@ -47,7 +60,7 @@ public final class Blocking { } /** - * Block a number. + * Block a list of numbers. * * @param countryIso the current location used to guess the country code of the number if not * available. If {@code null} and {@code number} does not have a country code, only the @@ -55,29 +68,31 @@ public final class Blocking { * @throws BlockingFailedException in the returned future if the operation failed. */ public static ListenableFuture<Void> block( - Context context, - ListeningExecutorService executorService, - String number, - @Nullable String countryIso) { - return executorService.submit( - () -> { - ContentValues values = new ContentValues(); - values.put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, number); - String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso); - if (e164Number != null) { - values.put(BlockedNumbers.COLUMN_E164_NUMBER, e164Number); - } - try { - context.getContentResolver().insert(BlockedNumbers.CONTENT_URI, values); - } catch (SecurityException e) { - throw new BlockingFailedException(e); - } - return null; - }); + Context context, ImmutableCollection<String> numbers, @Nullable String countryIso) { + return DialerExecutorComponent.get(context) + .backgroundExecutor() + .submit( + () -> { + ArrayList<ContentProviderOperation> operations = new ArrayList<>(); + for (String number : numbers) { + ContentValues values = new ContentValues(); + values.put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, number); + String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso); + if (e164Number != null) { + values.put(BlockedNumbers.COLUMN_E164_NUMBER, e164Number); + } + operations.add( + ContentProviderOperation.newInsert(BlockedNumbers.CONTENT_URI) + .withValues(values) + .build()); + } + applyBatchOps(context.getContentResolver(), operations); + return null; + }); } /** - * Unblock a number. + * Unblock a list of number. * * @param countryIso the current location used to guess the country code of the number if not * available. If {@code null} and {@code number} does not have a country code, only the @@ -85,33 +100,95 @@ public final class Blocking { * @throws BlockingFailedException in the returned future if the operation failed. */ public static ListenableFuture<Void> unblock( - Context context, - ListeningExecutorService executorService, - String number, - @Nullable String countryIso) { - return executorService.submit( - () -> { - Selection selection = - Selection.column(BlockedNumbers.COLUMN_ORIGINAL_NUMBER).is("=", number); - String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso); - if (e164Number != null) { - selection = - selection - .buildUpon() - .or(Selection.column(BlockedNumbers.COLUMN_E164_NUMBER).is("=", e164Number)) - .build(); - } - try { - context - .getContentResolver() - .delete( - BlockedNumbers.CONTENT_URI, - selection.getSelection(), - selection.getSelectionArgs()); - } catch (SecurityException e) { - throw new BlockingFailedException(e); - } - return null; - }); + Context context, ImmutableCollection<String> numbers, @Nullable String countryIso) { + return DialerExecutorComponent.get(context) + .backgroundExecutor() + .submit( + () -> { + ArrayList<ContentProviderOperation> operations = new ArrayList<>(); + for (String number : numbers) { + Selection selection = + Selection.column(BlockedNumbers.COLUMN_ORIGINAL_NUMBER).is("=", number); + String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso); + if (e164Number != null) { + selection = + selection + .buildUpon() + .or( + Selection.column(BlockedNumbers.COLUMN_E164_NUMBER) + .is("=", e164Number)) + .build(); + } + operations.add( + ContentProviderOperation.newDelete(BlockedNumbers.CONTENT_URI) + .withSelection(selection.getSelection(), selection.getSelectionArgs()) + .build()); + } + applyBatchOps(context.getContentResolver(), operations); + return null; + }); + } + + /** + * Get blocked numbers from a list of number. + * + * @param countryIso the current location used to guess the country code of the number if not + * available. If {@code null} and {@code number} does not have a country code, only the + * original number will be used to check blocked status. + * @throws BlockingFailedException in the returned future if the operation failed. + */ + public static ListenableFuture<ImmutableMap<String, Boolean>> isBlocked( + Context context, ImmutableCollection<String> numbers, @Nullable String countryIso) { + return DialerExecutorComponent.get(context) + .backgroundExecutor() + .submit( + () -> { + Map<String, Boolean> blockedStatus = new ArrayMap<>(); + List<String> e164Numbers = new ArrayList<>(); + + for (String number : numbers) { + // Initialize as unblocked + blockedStatus.put(number, false); + String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso); + if (e164Number != null) { + e164Numbers.add(e164Number); + } + } + + Selection selection = + Selection.builder() + .or(Selection.column(BlockedNumbers.COLUMN_ORIGINAL_NUMBER).in(numbers)) + .or(Selection.column(BlockedNumbers.COLUMN_E164_NUMBER).in(e164Numbers)) + .build(); + + try (Cursor cursor = + context + .getContentResolver() + .query( + BlockedNumbers.CONTENT_URI, + new String[] {BlockedNumbers.COLUMN_ORIGINAL_NUMBER}, + selection.getSelection(), + selection.getSelectionArgs(), + null)) { + if (cursor == null) { + return ImmutableMap.copyOf(blockedStatus); + } + while (cursor.moveToNext()) { + // Update blocked status + blockedStatus.put(cursor.getString(0), true); + } + } + return ImmutableMap.copyOf(blockedStatus); + }); + } + + private static ContentProviderResult[] applyBatchOps( + ContentResolver resolver, ArrayList<ContentProviderOperation> ops) + throws BlockingFailedException { + try { + return resolver.applyBatch(BlockedNumberContract.AUTHORITY, ops); + } catch (RemoteException | OperationApplicationException | SecurityException e) { + throw new BlockingFailedException(e); + } } } diff --git a/java/com/android/dialer/blocking/FilteredNumberCompat.java b/java/com/android/dialer/blocking/FilteredNumberCompat.java index d263d212c..71af3408c 100644 --- a/java/com/android/dialer/blocking/FilteredNumberCompat.java +++ b/java/com/android/dialer/blocking/FilteredNumberCompat.java @@ -30,7 +30,7 @@ import android.support.annotation.VisibleForTesting; import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.database.FilteredNumberContract.FilteredNumber; import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; import com.android.dialer.database.FilteredNumberContract.FilteredNumberSources; @@ -115,7 +115,9 @@ public class FilteredNumberCompat { * migration has been performed, {@code false} otherwise. */ public static boolean useNewFiltering(Context context) { - return !ConfigProviderBindings.get(context).getBoolean("debug_force_dialer_filtering", false) + return !ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean("debug_force_dialer_filtering", false) && canUseNewFiltering() && hasMigratedToNewBlocking(context); } diff --git a/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java b/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java index fb0399d9a..28ac7bfcc 100644 --- a/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java +++ b/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java @@ -40,6 +40,7 @@ import com.android.dialer.protos.ProtoParsers; import com.android.dialer.spam.Spam; import com.android.dialer.spam.SpamComponent; import com.android.dialer.spam.SpamSettings; +import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; @@ -225,8 +226,7 @@ public final class ShowBlockReportSpamDialogReceiver extends BroadcastReceiver { Futures.addCallback( Blocking.block( context, - DialerExecutorComponent.get(context).backgroundExecutor(), - dialogInfo.getNormalizedNumber(), + ImmutableList.of(dialogInfo.getNormalizedNumber()), dialogInfo.getCountryIso()), new FutureCallback<Void>() { @Override @@ -252,8 +252,7 @@ public final class ShowBlockReportSpamDialogReceiver extends BroadcastReceiver { Futures.addCallback( Blocking.unblock( context, - DialerExecutorComponent.get(context).backgroundExecutor(), - dialogInfo.getNormalizedNumber(), + ImmutableList.of(dialogInfo.getNormalizedNumber()), dialogInfo.getCountryIso()), new FutureCallback<Void>() { @Override diff --git a/java/com/android/dialer/callcomposer/CallComposerActivity.java b/java/com/android/dialer/callcomposer/CallComposerActivity.java index ce3f7f270..921bbbaea 100644 --- a/java/com/android/dialer/callcomposer/CallComposerActivity.java +++ b/java/com/android/dialer/callcomposer/CallComposerActivity.java @@ -60,7 +60,7 @@ import com.android.dialer.common.UiUtil; import com.android.dialer.common.concurrent.DialerExecutor; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.ThreadUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.constants.Constants; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.dialercontact.DialerContact; @@ -78,6 +78,7 @@ import com.android.dialer.storage.StorageComponent; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.UriUtils; import com.android.dialer.util.ViewUtil; +import com.android.dialer.widget.BidiTextView; import com.android.dialer.widget.DialerToolbar; import com.android.dialer.widget.LockableViewPager; import com.android.incallui.callpending.CallPendingActivity; @@ -135,7 +136,7 @@ public class CallComposerActivity extends AppCompatActivity private Long sessionId = Session.NO_SESSION_ID; private TextView nameView; - private TextView numberView; + private BidiTextView numberView; private QuickContactBadge contactPhoto; private RelativeLayout contactContainer; private DialerToolbar toolbar; @@ -345,7 +346,9 @@ public class CallComposerActivity extends AppCompatActivity @VisibleForTesting public long getSessionStartedTimeoutMillis() { - return ConfigProviderBindings.get(this).getLong("ec_session_started_timeout", 10_000); + return ConfigProviderComponent.get(this) + .getConfigProvider() + .getLong("ec_session_started_timeout", 10_000); } @Override @@ -441,7 +444,9 @@ public class CallComposerActivity extends AppCompatActivity getEnrichedCallManager().sendCallComposerData(sessionId, data); maybeShowPrivacyToast(data); if (data.hasImageData() - && ConfigProviderBindings.get(this).getBoolean("enable_delayed_ec_images", true) + && ConfigProviderComponent.get(this) + .getConfigProvider() + .getBoolean("enable_delayed_ec_images", true) && !TelecomUtil.isInManagedCall(this)) { timeoutHandler.postDelayed(placeTelecomCallRunnable, getRCSTimeoutMillis()); startActivity( @@ -476,7 +481,9 @@ public class CallComposerActivity extends AppCompatActivity @VisibleForTesting public long getRCSTimeoutMillis() { - return ConfigProviderBindings.get(this).getLong("ec_image_upload_timeout", 15_000); + return ConfigProviderComponent.get(this) + .getConfigProvider() + .getLong("ec_image_upload_timeout", 15_000); } private void placeTelecomCall() { diff --git a/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml b/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml index 49d278f30..8b982b9dc 100644 --- a/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml +++ b/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml @@ -57,7 +57,7 @@ android:textColor="?android:attr/textColorPrimaryInverse" android:textSize="@dimen/call_composer_name_text_size"/> - <TextView + <com.android.dialer.widget.BidiTextView android:id="@+id/phone_number" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java index 44b5a4319..84a60c16e 100644 --- a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java +++ b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java @@ -40,6 +40,7 @@ import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.glidephotomanager.GlidePhotoManagerComponent; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; +import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.widget.BidiTextView; /** @@ -53,7 +54,7 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder private final CallDetailsHeaderListener callDetailsHeaderListener; private final ImageView callbackButton; private final BidiTextView nameView; - private final TextView numberView; + private final BidiTextView numberView; private final TextView networkView; private final QuickContactBadge contactPhoto; private final Context context; @@ -157,20 +158,26 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder contact.getNameOrNumber(), contact.getContactType()); - nameView.setText(contact.getNameOrNumber()); - if (!TextUtils.isEmpty(contact.getDisplayNumber())) { - numberView.setVisibility(View.VISIBLE); - String secondaryInfo = - TextUtils.isEmpty(contact.getNumberLabel()) - ? contact.getDisplayNumber() - : context.getString( - com.android.contacts.common.R.string.call_subject_type_and_number, - contact.getNumberLabel(), - contact.getDisplayNumber()); - numberView.setText(secondaryInfo); + // Hide the secondary text of the header by default. + // We will show it if needed (see below). + numberView.setVisibility(View.GONE); + numberView.setText(null); + + if (PhoneNumberHelper.isLocalEmergencyNumber(context, contact.getNumber())) { + nameView.setText(context.getResources().getString(R.string.emergency_number)); } else { - numberView.setVisibility(View.GONE); - numberView.setText(null); + nameView.setText(contact.getNameOrNumber()); + if (!TextUtils.isEmpty(contact.getDisplayNumber())) { + numberView.setVisibility(View.VISIBLE); + String secondaryInfo = + TextUtils.isEmpty(contact.getNumberLabel()) + ? contact.getDisplayNumber() + : context.getString( + com.android.contacts.common.R.string.call_subject_type_and_number, + contact.getNumberLabel(), + contact.getDisplayNumber()); + numberView.setText(secondaryInfo); + } } if (!TextUtils.isEmpty(contact.getSimDetails().getNetwork())) { diff --git a/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml b/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml index cb2faa762..bfbb4f8a9 100644 --- a/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml +++ b/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml @@ -40,11 +40,12 @@ <TextView android:id="@+id/call_time" - style="@style/Dialer.TextAppearance.Secondary.Ellipsize" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/call_entry_bottom_padding" android:layout_marginStart="@dimen/call_entry_text_left_margin" + android:layout_marginEnd="16dp" android:layout_below="@+id/call_type"/> <TextView diff --git a/java/com/android/dialer/calldetails/res/layout/contact_container.xml b/java/com/android/dialer/calldetails/res/layout/contact_container.xml index e918feb69..4df81f152 100644..100755 --- a/java/com/android/dialer/calldetails/res/layout/contact_container.xml +++ b/java/com/android/dialer/calldetails/res/layout/contact_container.xml @@ -51,7 +51,7 @@ android:layout_height="wrap_content" android:layout_marginStart="@dimen/photo_text_margin"/> - <TextView + <com.android.dialer.widget.BidiTextView android:id="@+id/phone_number" style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" diff --git a/java/com/android/dialer/commandline/impl/BlockingCommand.java b/java/com/android/dialer/commandline/impl/BlockingCommand.java index f06e240ae..d06450513 100644 --- a/java/com/android/dialer/commandline/impl/BlockingCommand.java +++ b/java/com/android/dialer/commandline/impl/BlockingCommand.java @@ -28,6 +28,7 @@ import com.android.dialer.phonelookup.PhoneLookupComponent; import com.android.dialer.phonelookup.PhoneLookupInfo; import com.android.dialer.phonelookup.consolidator.PhoneLookupInfoConsolidator; import com.android.dialer.phonenumberproto.DialerPhoneNumberUtil; +import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; @@ -71,7 +72,7 @@ public class BlockingCommand implements Command { if ("block".equals(command)) { String number = args.getPositionals().get(1); return Futures.transform( - Blocking.block(appContext, executorService, number, null), + Blocking.block(appContext, ImmutableList.of(number), null), (unused) -> "blocked " + number, MoreExecutors.directExecutor()); } @@ -79,7 +80,7 @@ public class BlockingCommand implements Command { if ("unblock".equals(command)) { String number = args.getPositionals().get(1); return Futures.transform( - Blocking.unblock(appContext, executorService, number, null), + Blocking.unblock(appContext, ImmutableList.of(number), null), (unused) -> "unblocked " + number, MoreExecutors.directExecutor()); } diff --git a/java/com/android/dialer/configprovider/ConfigProviderBindings.java b/java/com/android/dialer/configprovider/ConfigProviderBindings.java deleted file mode 100644 index 0bf0e758d..000000000 --- a/java/com/android/dialer/configprovider/ConfigProviderBindings.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2016 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.configprovider; - -import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; -import android.support.v4.os.UserManagerCompat; -import com.android.dialer.common.Assert; - -/** Accessor for getting a {@link ConfigProvider}. */ -public class ConfigProviderBindings { - - private static ConfigProvider configProvider; - private static ConfigProvider configProviderStub; - - public static ConfigProvider get(@NonNull Context context) { - Assert.isNotNull(context); - if (configProvider != null) { - return configProvider; - } - if (!UserManagerCompat.isUserUnlocked(context)) { - if (configProviderStub == null) { - configProviderStub = new ConfigProviderStub(); - } - return configProviderStub; - } - configProvider = ConfigProviderComponent.get(context).getConfigProvider(); - return configProvider; - } - - @VisibleForTesting - public static void setForTesting(@Nullable ConfigProvider configProviderForTesting) { - configProvider = configProviderForTesting; - } - - private static class ConfigProviderStub implements ConfigProvider { - @Override - public String getString(String key, String defaultValue) { - return defaultValue; - } - - @Override - public long getLong(String key, long defaultValue) { - return defaultValue; - } - - @Override - public boolean getBoolean(String key, boolean defaultValue) { - return defaultValue; - } - } -} diff --git a/java/com/android/dialer/configprovider/ConfigProviderComponent.java b/java/com/android/dialer/configprovider/ConfigProviderComponent.java index e974e30bf..5b5afd705 100644 --- a/java/com/android/dialer/configprovider/ConfigProviderComponent.java +++ b/java/com/android/dialer/configprovider/ConfigProviderComponent.java @@ -27,7 +27,6 @@ import dagger.Subcomponent; public abstract class ConfigProviderComponent { @NonNull - @Deprecated // Use ConfigProviderBindings instead public abstract ConfigProvider getConfigProvider(); public static ConfigProviderComponent get(Context context) { diff --git a/java/com/android/dialer/database/DialerDatabaseHelper.java b/java/com/android/dialer/database/DialerDatabaseHelper.java index b61cc3958..b1cd0906f 100644 --- a/java/com/android/dialer/database/DialerDatabaseHelper.java +++ b/java/com/android/dialer/database/DialerDatabaseHelper.java @@ -42,7 +42,7 @@ import com.android.dialer.common.concurrent.DefaultFutureCallback; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.DialerFutureSerializer; import com.android.dialer.common.database.Selection; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; import com.android.dialer.smartdial.util.SmartDialNameMatcher; import com.android.dialer.smartdial.util.SmartDialPrefix; @@ -682,7 +682,9 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { context.getSharedPreferences(DATABASE_LAST_CREATED_SHARED_PREF, Context.MODE_PRIVATE); long defaultLastUpdateMillis = - ConfigProviderBindings.get(context).getLong(DEFAULT_LAST_UPDATED_CONFIG_KEY, 0); + ConfigProviderComponent.get(context) + .getConfigProvider() + .getLong(DEFAULT_LAST_UPDATED_CONFIG_KEY, 0); long sharedPrefLastUpdateMillis = databaseLastUpdateSharedPref.getLong(LAST_UPDATED_MILLIS, defaultLastUpdateMillis); diff --git a/java/com/android/dialer/dialpadview/theme/res/values/styles.xml b/java/com/android/dialer/dialpadview/theme/res/values/styles.xml index 04ebb1b13..8705a17a4 100644 --- a/java/com/android/dialer/dialpadview/theme/res/values/styles.xml +++ b/java/com/android/dialer/dialpadview/theme/res/values/styles.xml @@ -32,7 +32,7 @@ <item name="dialpad_elevation">0dp</item> </style> - <style name="Dialpad.Light"> + <style name="Dialpad.Themed"> <item name="dialpad_text_color">?android:attr/textColorSecondary</item> <item name="dialpad_text_color_primary">?android:attr/colorPrimary</item> <item name="dialpad_text_color_secondary">?android:attr/textColorSecondary</item> diff --git a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java index eeeae13ae..bd9cc31e4 100644 --- a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java +++ b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java @@ -143,7 +143,7 @@ public class GlidePhotoManagerImpl implements GlidePhotoManager { photoInfo.getIsSpam(), photoInfo.getIsBusiness(), TelecomManager.PRESENTATION_ALLOWED, // TODO(twyen):implement - false)); // TODO(twyen):implement + photoInfo.getIsConference())); return letterTileDrawable; } diff --git a/java/com/android/dialer/glidephotomanager/photo_info.proto b/java/com/android/dialer/glidephotomanager/photo_info.proto index 6fa21d886..07908d807 100644 --- a/java/com/android/dialer/glidephotomanager/photo_info.proto +++ b/java/com/android/dialer/glidephotomanager/photo_info.proto @@ -9,7 +9,7 @@ package com.android.dialer.glidephotomanager; // Contains information associated with a number, which is used to create the // photo. -// Next ID: 12 +// Next ID: 13 message PhotoInfo { // The display name of the number. optional string name = 1; @@ -44,4 +44,7 @@ message PhotoInfo { // Whether the photo should be badged as RTT call. optional bool is_rtt = 11; + + // Whether to show conference call icon instead of contact icon. + optional bool is_conference = 12; } diff --git a/java/com/android/dialer/i18n/DialerBidiFormatter.java b/java/com/android/dialer/i18n/DialerBidiFormatter.java index 4ebaa666c..e882e06c4 100644 --- a/java/com/android/dialer/i18n/DialerBidiFormatter.java +++ b/java/com/android/dialer/i18n/DialerBidiFormatter.java @@ -26,6 +26,7 @@ import com.google.auto.value.AutoValue; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * An enhanced version of {@link BidiFormatter} that can recognize a formatted phone number @@ -40,6 +41,9 @@ public final class DialerBidiFormatter { private DialerBidiFormatter() {} + // Regular expression that matches a single space in the beginning or end of a string. + private static final String REGEXP_SURROUNDING_SPACE = "^[ ]|[ ]$"; + /** * Divides the given text into segments, applies {@link BidiFormatter#unicodeWrap(CharSequence)} * to each segment, and then reassembles the text. @@ -65,19 +69,49 @@ public final class DialerBidiFormatter { } /** - * Segments the given text using {@link Patterns#PHONE}. + * Segments the given text into a sequence of substrings using the following procedure. + * + * <ol> + * <li>Separate text matching {@link Patterns#PHONE} from others. + * <p>For example: "Mobile, +1 650-253-0000, 20 seconds" will be segmented into<br> + * {"Mobile, ", "+1 650-253-0000", ", 20 seconds"} + * <li>For each substring produced by the previous step, separate a single whitespace at the + * start/end of it from the rest of the substring. + * <p>For example, the first substring "Mobile, " will be segmented into {"Mobile,", " "}. + * </ol> + * + * <p>The final result of segmenting "Mobile, +1 650-253-0000, 20 seconds" is<br> + * {"Mobile,", " ", "+1 650-253-0000", ", 20 seconds"}. * - * <p>For example, "Mobile, +1 650-253-0000, 20 seconds" will be segmented into {"Mobile, ", "+1 - * 650-253-0000", ", 20 seconds"}. + * <p>The reason for singling out the whitespace at the start/end of a substring is to prevent it + * from being misplaced in RTL context. */ @VisibleForTesting static List<CharSequence> segmentText(CharSequence text) { Assert.checkArgument(!TextUtils.isEmpty(text)); + // Separate text matching the phone number pattern from others. + List<CharSequence> segmentsSeparatingPhoneNumbers = segmentText(text, Patterns.PHONE); + + // For each substring, separate a single whitespace at the start/end of it from the rest of the + // substring. + List<CharSequence> finalSegments = new ArrayList<>(); + Pattern patternSurroundingSpace = Pattern.compile(REGEXP_SURROUNDING_SPACE); + for (CharSequence segment : segmentsSeparatingPhoneNumbers) { + finalSegments.addAll(segmentText(segment, patternSurroundingSpace)); + } + + return finalSegments; + } + + /** Segments the given text into a sequence of substrings using the provided pattern. */ + private static List<CharSequence> segmentText(CharSequence text, Pattern pattern) { + Assert.checkArgument(!TextUtils.isEmpty(text)); + List<CharSequence> segments = new ArrayList<>(); - // Find the start index and the end index of each segment matching the phone number pattern. - Matcher matcher = Patterns.PHONE.matcher(text.toString()); + // Find the start index and the end index of each segment matching the pattern. + Matcher matcher = pattern.matcher(text.toString()); List<Range> segmentRanges = new ArrayList<>(); while (matcher.find()) { segmentRanges.add(Range.newBuilder().setStart(matcher.start()).setEnd(matcher.end()).build()); diff --git a/java/com/android/dialer/inject/DialerRootComponent.java b/java/com/android/dialer/inject/DialerRootComponent.java index 11dbf962e..e508e17b6 100644 --- a/java/com/android/dialer/inject/DialerRootComponent.java +++ b/java/com/android/dialer/inject/DialerRootComponent.java @@ -41,4 +41,6 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.SOURCE) public @interface DialerRootComponent { DialerVariant variant(); + + Class<?> injectClass() default Object.class; } diff --git a/java/com/android/dialer/logging/reporting_location.proto b/java/com/android/dialer/logging/reporting_location.proto index b9912be75..1d6ba4752 100644 --- a/java/com/android/dialer/logging/reporting_location.proto +++ b/java/com/android/dialer/logging/reporting_location.proto @@ -15,5 +15,6 @@ message ReportingLocation { CALL_LOG_HISTORY = 1; FEEDBACK_PROMPT = 2; VOICEMAIL_HISTORY = 3; + CONTACT_DETAILS = 4; } } diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index e14c5b97f..9169dc323 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -81,7 +81,7 @@ import com.android.dialer.common.concurrent.DefaultFutureCallback; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.ThreadUtil; import com.android.dialer.common.concurrent.UiListener; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.contactsfragment.ContactsFragment; import com.android.dialer.contactsfragment.ContactsFragment.Header; @@ -1313,7 +1313,9 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen Logger.get(activity).logScreenView(ScreenEvent.Type.MAIN_SPEED_DIAL, activity); selectedTab = TabIndex.SPEED_DIAL; - if (ConfigProviderBindings.get(activity).getBoolean("enable_new_favorites_tab", false)) { + if (ConfigProviderComponent.get(activity) + .getConfigProvider() + .getBoolean("enable_new_favorites_tab", false)) { android.support.v4.app.Fragment supportFragment = supportFragmentManager.findFragmentByTag(SPEED_DIAL_TAG); showSupportFragment( @@ -1618,7 +1620,10 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen LastTabController(Context context, BottomNavBar bottomNavBar, boolean canShowVoicemailTab) { this.context = context; this.bottomNavBar = bottomNavBar; - isEnabled = ConfigProviderBindings.get(context).getBoolean("last_tab_enabled", false); + isEnabled = + ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean("last_tab_enabled", false); this.canShowVoicemailTab = canShowVoicemailTab; } diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java index 3a43f8460..4794b8823 100644 --- a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java +++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java @@ -29,7 +29,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.android.dialer.common.Assert; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.theme.base.ThemeComponent; /** Navigation item in a bottom nav. */ @@ -75,7 +75,9 @@ final class BottomNavItem extends LinearLayout { String countString = String.format(Integer.toString(count)); boolean use99PlusCount = - ConfigProviderBindings.get(getContext()).getBoolean("use_99_plus", false); + ConfigProviderComponent.get(getContext()) + .getConfigProvider() + .getBoolean("use_99_plus", false); boolean use9Plus = !use99PlusCount; if (use99PlusCount && count > 99) { diff --git a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml index 3fbd9ffc9..02874a9d8 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml @@ -59,5 +59,6 @@ android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:gravity="center_horizontal" + android:textSize="12sp" style="@style/Dialer.TextAppearance.Secondary"/> </com.android.dialer.main.impl.bottomnav.BottomNavItem>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/res/values/styles.xml b/java/com/android/dialer/main/impl/res/values/styles.xml index 7b36e78ef..dd24179bf 100644 --- a/java/com/android/dialer/main/impl/res/values/styles.xml +++ b/java/com/android/dialer/main/impl/res/values/styles.xml @@ -27,7 +27,7 @@ <!-- TODO(a bug): Check to see if we can remove this after NewVoicemailFragment launches --> <item name="actionModeStyle">@style/MainActionModeStyle</item> <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> - <item name="dialpad_style">@style/Dialpad.Light</item> + <item name="dialpad_style">@style/Dialpad.Themed</item> </style> <style name="MainActivityThemeBase.Dark" parent="Dialer.Dark.ThemeBase.NoActionBar"> @@ -35,7 +35,7 @@ <!-- TODO(a bug): Check to see if we can remove this after NewVoicemailFragment launches --> <item name="actionModeStyle">@style/MainActionModeStyle</item> <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> - <item name="dialpad_style">@style/Dialpad.Light</item> + <item name="dialpad_style">@style/Dialpad.Themed</item> </style> <!-- Colors our actionbar in action mode to dialer theme color. --> diff --git a/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml b/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml index 578684ef8..049cf2ef5 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml @@ -61,8 +61,8 @@ android:layout_toEndOf="@+id/search_magnifying_glass" android:layout_toStartOf="@+id/voice_search_button" android:text="@string/dialer_hint_find_contact" - android:textColor="?android:attr/textColorHint" - android:textSize="16dp"/> + android:textSize="16dp" + style="@style/Dialer.TextAppearance.Secondary"/> <ImageView android:id="@+id/voice_search_button" diff --git a/java/com/android/dialer/oem/CequintCallerIdManager.java b/java/com/android/dialer/oem/CequintCallerIdManager.java index 53f5352b2..ea6cbb8cb 100644 --- a/java/com/android/dialer/oem/CequintCallerIdManager.java +++ b/java/com/android/dialer/oem/CequintCallerIdManager.java @@ -30,7 +30,7 @@ import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.google.auto.value.AutoValue; import java.util.concurrent.ConcurrentHashMap; @@ -113,7 +113,9 @@ public class CequintCallerIdManager { /** Check whether Cequint Caller ID provider package is available and enabled. */ @AnyThread public static synchronized boolean isCequintCallerIdEnabled(@NonNull Context context) { - if (!ConfigProviderBindings.get(context).getBoolean(CONFIG_CALLER_ID_ENABLED, true)) { + if (!ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean(CONFIG_CALLER_ID_ENABLED, true)) { return false; } if (!hasAlreadyCheckedCequintCallerIdPackage) { diff --git a/java/com/android/dialer/oem/MotorolaUtils.java b/java/com/android/dialer/oem/MotorolaUtils.java index 3879f915f..026893780 100644 --- a/java/com/android/dialer/oem/MotorolaUtils.java +++ b/java/com/android/dialer/oem/MotorolaUtils.java @@ -22,7 +22,7 @@ import android.support.annotation.VisibleForTesting; import android.telephony.TelephonyManager; import com.android.dialer.common.LogUtil; import com.android.dialer.common.PackageUtils; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -79,19 +79,22 @@ public class MotorolaUtils { } public static boolean shouldBlinkHdIconWhenConnectingCall(Context context) { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(CONFIG_HD_CODEC_BLINKING_ICON_WHEN_CONNECTING_CALL_ENABLED, true) && isSupportingSprintHdCodec(context); } public static boolean shouldShowHdIconInNotification(Context context) { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(CONFIG_HD_CODEC_SHOW_ICON_IN_NOTIFICATION_ENABLED, true) && isSupportingSprintHdCodec(context); } public static boolean shouldShowWifiIconInCallLog(Context context, int features) { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(CONFIG_WIFI_CALL_SHOW_ICON_IN_CALL_LOG_ENABLED, true) && (features & Calls.FEATURES_WIFI) == Calls.FEATURES_WIFI && isSupportingSprintWifiCall(context); @@ -102,7 +105,8 @@ public class MotorolaUtils { return disablePhoneNumberFormattingForTest; } - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(CONFIG_DISABLE_PHONE_NUMBER_FORMATTING, true) && context.getResources().getBoolean(R.bool.motorola_disable_phone_number_formatting); } diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java index 341db3b09..542b8d09c 100644 --- a/java/com/android/dialer/postcall/PostCall.java +++ b/java/com/android/dialer/postcall/PostCall.java @@ -29,7 +29,7 @@ import android.view.View.OnClickListener; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProvider; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.enrichedcall.EnrichedCallCapabilities; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.enrichedcall.EnrichedCallManager; @@ -96,7 +96,10 @@ public class PostCall { }; int durationMs = - (int) ConfigProviderBindings.get(activity).getLong("post_call_prompt_duration_ms", 8_000); + (int) + ConfigProviderComponent.get(activity) + .getConfigProvider() + .getLong("post_call_prompt_duration_ms", 8_000); activeSnackbar = Snackbar.make(rootView, message, durationMs) .setAction(actionText, onClickListener) @@ -215,7 +218,7 @@ public class PostCall { boolean callDisconnectedByUser = manager.getBoolean(KEY_POST_CALL_DISCONNECT_PRESSED, false); - ConfigProvider binding = ConfigProviderBindings.get(context); + ConfigProvider binding = ConfigProviderComponent.get(context).getConfigProvider(); return disconnectTimeMillis != -1 && connectTimeMillis != -1 && isSimReady(context) @@ -240,7 +243,9 @@ public class PostCall { } private static boolean isEnabled(Context context) { - return ConfigProviderBindings.get(context).getBoolean("enable_post_call_prod", true); + return ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean("enable_post_call_prod", true); } private static boolean isSimReady(Context context) { diff --git a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java index bf7995a0c..60245ee66 100644 --- a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java +++ b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java @@ -28,7 +28,7 @@ import com.android.dialer.callintent.CallInitiationType.Type; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProvider; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.precall.PreCall; @@ -69,7 +69,8 @@ public class LaunchPreCallActivity extends Activity { super.onCreate(savedInstanceState); Logger.get(this).logImpression(DialerImpression.Type.PRECALL_INITIATED_EXTERNAL); - ConfigProvider configProvider = ConfigProviderBindings.get(getApplicationContext()); + ConfigProvider configProvider = + ConfigProviderComponent.get(getApplicationContext()).getConfigProvider(); Intent intent = getIntent(); CallIntentBuilder builder = new CallIntentBuilder(intent.getData(), Type.EXTERNAL_INITIATION); diff --git a/java/com/android/dialer/precall/impl/AssistedDialAction.java b/java/com/android/dialer/precall/impl/AssistedDialAction.java index e4e525559..40a810b5b 100644 --- a/java/com/android/dialer/precall/impl/AssistedDialAction.java +++ b/java/com/android/dialer/precall/impl/AssistedDialAction.java @@ -31,7 +31,7 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.configprovider.ConfigProvider; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.precall.PreCallAction; import com.android.dialer.precall.PreCallCoordinator; import com.android.dialer.telecom.TelecomUtil; @@ -90,7 +90,7 @@ public class AssistedDialAction implements PreCallAction { private TelephonyManager getAssistedDialingTelephonyManager( Context context, CallIntentBuilder builder) { - ConfigProvider configProvider = ConfigProviderBindings.get(context); + ConfigProvider configProvider = ConfigProviderComponent.get(context).getConfigProvider(); TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class); // None of this will be required in the framework because the PhoneAccountHandle // is already mapped to the request in the TelecomConnection. diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java index b2a659348..042f5858d 100644 --- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java +++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java @@ -32,7 +32,7 @@ import com.android.contacts.common.widget.SelectPhoneAccountDialogOptions; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression.Type; import com.android.dialer.logging.Logger; import com.android.dialer.precall.PreCallAction; @@ -64,7 +64,8 @@ public class CallingAccountSelector implements PreCallAction { @Override public boolean requiresUi(Context context, CallIntentBuilder builder) { - if (!ConfigProviderBindings.get(context) + if (!ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("precall_calling_account_selector_enabled", true)) { return false; } diff --git a/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java b/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java index b8f54d873..825375ded 100644 --- a/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java +++ b/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java @@ -19,7 +19,7 @@ package com.android.dialer.precall.impl; import android.content.Context; import android.telephony.PhoneNumberUtils; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.precall.impl.MalformedNumberRectifier.MalformedNumberHandler; import com.google.common.base.Optional; @@ -37,7 +37,8 @@ class UkRegionPrefixInInternationalFormatHandler implements MalformedNumberHandl @Override public Optional<String> handle(Context context, String number) { - if (!ConfigProviderBindings.get(context) + if (!ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("uk_region_prefix_in_international_format_fix_enabled", true)) { return Optional.absent(); } diff --git a/java/com/android/dialer/preferredsim/PreferredAccountUtil.java b/java/com/android/dialer/preferredsim/PreferredAccountUtil.java index b546dc0b8..1cfdbb161 100644 --- a/java/com/android/dialer/preferredsim/PreferredAccountUtil.java +++ b/java/com/android/dialer/preferredsim/PreferredAccountUtil.java @@ -30,7 +30,7 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; @@ -102,7 +102,8 @@ public class PreferredAccountUtil { */ public static ImmutableSet<String> getValidAccountTypes(Context context) { return ImmutableSet.copyOf( - ConfigProviderBindings.get(context) + ConfigProviderComponent.get(context) + .getConfigProvider() .getString( "preferred_sim_valid_account_types", "com.google;" diff --git a/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java b/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java index 086cd7a10..ffd98f431 100644 --- a/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java +++ b/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java @@ -44,7 +44,7 @@ import com.android.dialer.activecalls.ActiveCallsComponent; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.inject.ApplicationContext; import com.android.dialer.logging.DialerImpression.Type; import com.android.dialer.logging.Logger; @@ -357,7 +357,9 @@ public class PreferredAccountWorkerImpl implements PreferredAccountWorker { @WorkerThread private static boolean isPreferredSimEnabled(Context context) { Assert.isWorkerThread(); - if (!ConfigProviderBindings.get(context).getBoolean("preferred_sim_enabled", true)) { + if (!ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean("preferred_sim_enabled", true)) { return false; } diff --git a/java/com/android/dialer/rootcomponentgenerator/RootComponentGeneratingStep.java b/java/com/android/dialer/rootcomponentgenerator/RootComponentGeneratingStep.java index cb312083f..06b994ff7 100644 --- a/java/com/android/dialer/rootcomponentgenerator/RootComponentGeneratingStep.java +++ b/java/com/android/dialer/rootcomponentgenerator/RootComponentGeneratingStep.java @@ -35,6 +35,7 @@ import com.google.common.collect.ListMultimap; import com.google.common.collect.SetMultimap; import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.ClassName; +import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; import dagger.Component; import java.lang.annotation.Annotation; @@ -51,7 +52,30 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; -/** Generates root component for a java type annotated with {@link DialerRootComponent}. */ +/** + * Generates root component for a java type annotated with {@link DialerRootComponent}. + * + * <p>If users use {@link GenerateTestDaggerApp} along with RootComponentGenerator, there's an + * optional method that they can use to inject instance in the test. + * + * <p>Example: + * + * <p> + * + * <pre> + * <code> + * @Inject SomeThing someThing; + * @Before + * public void setUp() { + * ... + * TestApplication application = (TestApplication) RuntimeEnvironment.application; + * TestComponent component = (TestComponent) application.component(); + * component.inject(this); + * ... + * } + * </code> + * </pre> + */ final class RootComponentGeneratingStep implements ProcessingStep { private final ProcessingEnvironment processingEnv; @@ -110,6 +134,15 @@ final class RootComponentGeneratingStep implements ProcessingStep { componentAnnotation.addMember("modules", "$T.class", annotatedElement.asType()); } rootComponentClassBuilder.addAnnotation(componentAnnotation.build()); + + AnnotationMirror dialerRootComponentMirror = + getAnnotationMirror(rootElement, DialerRootComponent.class).get(); + + TypeMirror annotatedTestClass = + (TypeMirror) getAnnotationValue(dialerRootComponentMirror, "injectClass").getValue(); + + rootComponentClassBuilder.addMethod(generateInjectMethod(annotatedTestClass)); + TypeSpec rootComponentClass = rootComponentClassBuilder.build(); RootComponentUtils.writeJavaFile( processingEnv, ClassName.get(rootElement).packageName(), rootComponentClass); @@ -163,6 +196,14 @@ final class RootComponentGeneratingStep implements ProcessingStep { } } + private MethodSpec generateInjectMethod(TypeMirror testClassTypeMirror) { + return MethodSpec.methodBuilder("inject") + .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) + .returns(void.class) + .addParameter(ClassName.get(testClassTypeMirror), "clazz") + .build(); + } + private interface MetadataProcessor { void process(TypeElement typeElement); } diff --git a/java/com/android/dialer/rtt/RttTranscriptActivity.java b/java/com/android/dialer/rtt/RttTranscriptActivity.java index 18ae20c08..574cdb2e2 100644 --- a/java/com/android/dialer/rtt/RttTranscriptActivity.java +++ b/java/com/android/dialer/rtt/RttTranscriptActivity.java @@ -20,7 +20,6 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; @@ -30,6 +29,7 @@ import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.UiListener; import com.android.dialer.glidephotomanager.PhotoInfo; import com.android.dialer.protos.ProtoParsers; +import com.android.dialer.widget.DialerToolbar; /** Activity holds RTT transcript. */ public class RttTranscriptActivity extends AppCompatActivity { @@ -40,6 +40,7 @@ public class RttTranscriptActivity extends AppCompatActivity { private RttTranscriptAdapter adapter; private UiListener<RttTranscript> rttTranscriptUiListener; + private DialerToolbar toolbar; public static Intent getIntent( Context context, String transcriptId, String primaryText, PhotoInfo photoInfo) { @@ -54,9 +55,9 @@ public class RttTranscriptActivity extends AppCompatActivity { protected void onCreate(@Nullable Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.activity_rtt_transcript); - ActionBar actionBar = getSupportActionBar(); - actionBar.setDisplayShowHomeEnabled(true); - actionBar.setDisplayHomeAsUpEnabled(true); + toolbar = findViewById(R.id.toolbar); + toolbar.setBackgroundColor(getColor(R.color.rtt_transcript_primary_color)); + getWindow().setStatusBarColor(getColor(R.color.rtt_transcript_primary_color_dark)); RecyclerView recyclerView = findViewById(R.id.rtt_recycler_view); LinearLayoutManager layoutManager = new LinearLayoutManager(this); @@ -86,7 +87,7 @@ public class RttTranscriptActivity extends AppCompatActivity { }); String primaryText = intent.getStringExtra(EXTRA_PRIMARY_TEXT); - getSupportActionBar().setTitle(primaryText); + toolbar.setTitle(primaryText); PhotoInfo photoInfo = ProtoParsers.getTrusted(intent, EXTRA_PHOTO_INFO, PhotoInfo.getDefaultInstance()); diff --git a/java/com/android/dialer/rtt/res/layout/activity_rtt_transcript.xml b/java/com/android/dialer/rtt/res/layout/activity_rtt_transcript.xml index 628a7932e..772fde1cd 100644 --- a/java/com/android/dialer/rtt/res/layout/activity_rtt_transcript.xml +++ b/java/com/android/dialer/rtt/res/layout/activity_rtt_transcript.xml @@ -14,10 +14,16 @@ limitations under the License. --> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/rtt_transcript_background_color"> + android:background="@color/rtt_transcript_background_color" + android:orientation="vertical"> + + <com.android.dialer.widget.DialerToolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> <android.support.v7.widget.RecyclerView android:id="@+id/rtt_recycler_view" @@ -27,4 +33,4 @@ android:paddingBottom="16dp" android:clipToPadding="false"/> -</FrameLayout> +</LinearLayout> diff --git a/java/com/android/dialer/rtt/res/values/colors.xml b/java/com/android/dialer/rtt/res/values/colors.xml index 5de06f9f2..3b27a5707 100644 --- a/java/com/android/dialer/rtt/res/values/colors.xml +++ b/java/com/android/dialer/rtt/res/values/colors.xml @@ -16,5 +16,6 @@ --> <resources> <color name="rtt_transcript_primary_color">#37474F</color> + <color name="rtt_transcript_primary_color_dark">#263238</color> <color name="rtt_transcript_background_color">#ECEFF1</color> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/shortcuts/Shortcuts.java b/java/com/android/dialer/shortcuts/Shortcuts.java index c2bbb4dde..d08e344cc 100644 --- a/java/com/android/dialer/shortcuts/Shortcuts.java +++ b/java/com/android/dialer/shortcuts/Shortcuts.java @@ -18,7 +18,7 @@ package com.android.dialer.shortcuts; import android.content.Context; import android.support.annotation.NonNull; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; /** Checks if dynamic shortcuts should be enabled. */ public class Shortcuts { @@ -27,7 +27,9 @@ public class Shortcuts { private static final String DYNAMIC_SHORTCUTS_ENABLED = "dynamic_shortcuts_enabled"; static boolean areDynamicShortcutsEnabled(@NonNull Context context) { - return ConfigProviderBindings.get(context).getBoolean(DYNAMIC_SHORTCUTS_ENABLED, true); + return ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean(DYNAMIC_SHORTCUTS_ENABLED, true); } private Shortcuts() {} diff --git a/java/com/android/dialer/spam/Spam.java b/java/com/android/dialer/spam/Spam.java index 028bda40a..b797ce3c4 100644 --- a/java/com/android/dialer/spam/Spam.java +++ b/java/com/android/dialer/spam/Spam.java @@ -61,6 +61,19 @@ public interface Spam { ListenableFuture<SpamStatus> checkSpamStatus(String number, @Nullable String defaultCountryIso); /** + * Checks if the given number is suspected of being spam, checking additional information as + * needed for the in-call ui. + * + * <p>See {@link #checkSpamStatus(String, String)}. + * + * @param number the phone number. + * @param defaultCountryIso the default country to use if it's not part of the number. + * @return the {@link SpamStatus} for the given number. + */ + ListenableFuture<SpamStatus> checkSpamStatusForInCallUi( + String number, @Nullable String defaultCountryIso); + + /** * Called as an indication that the Spam implementation should check whether downloading a spam * list needs to occur or not. * diff --git a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java index 34209cc54..c270c5941 100644 --- a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java +++ b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java @@ -28,7 +28,7 @@ import android.support.v4.app.FragmentManager; import android.support.v4.os.BuildCompat; import android.view.View; import android.widget.Toast; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.notification.DialerNotificationManager; @@ -65,7 +65,9 @@ public class SpamBlockingPromoHelper { * @return true if we should show a spam blocking promo. */ public boolean shouldShowSpamBlockingPromo() { - if (!ConfigProviderBindings.get(context).getBoolean(ENABLE_SPAM_BLOCKING_PROMO, false) + if (!ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean(ENABLE_SPAM_BLOCKING_PROMO, false) || !spamSettings.isSpamEnabled() || !spamSettings.isSpamBlockingEnabledByFlag() || spamSettings.isSpamBlockingEnabledByUser()) { @@ -77,7 +79,8 @@ public class SpamBlockingPromoHelper { .unencryptedSharedPrefs() .getLong(SPAM_BLOCKING_PROMO_LAST_SHOW_MILLIS, 0); long showPeriodMillis = - ConfigProviderBindings.get(context) + ConfigProviderComponent.get(context) + .getConfigProvider() .getLong(SPAM_BLOCKING_PROMO_PERIOD_MILLIS, Long.MAX_VALUE); return lastShowMillis == 0 || System.currentTimeMillis() - lastShowMillis > showPeriodMillis; } @@ -85,7 +88,8 @@ public class SpamBlockingPromoHelper { /* Returns true if we should show a spam blocking promo in after call notification scenario. */ public boolean shouldShowAfterCallSpamBlockingPromo() { return shouldShowSpamBlockingPromo() - && ConfigProviderBindings.get(context) + && ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(ENABLE_AFTER_CALL_SPAM_BLOCKING_PROMO, false); } diff --git a/java/com/android/dialer/spam/stub/SpamStub.java b/java/com/android/dialer/spam/stub/SpamStub.java index 5eeed4571..7d48ca6ef 100644 --- a/java/com/android/dialer/spam/stub/SpamStub.java +++ b/java/com/android/dialer/spam/stub/SpamStub.java @@ -68,6 +68,12 @@ public class SpamStub implements Spam { } @Override + public ListenableFuture<SpamStatus> checkSpamStatusForInCallUi( + String number, @Nullable String defaultCountryIso) { + return checkSpamStatus(number, defaultCountryIso); + } + + @Override public ListenableFuture<Void> updateSpamListDownload(boolean isEnabledByUser) { // no-op return Futures.immediateFuture(null); diff --git a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java index b8c7e528f..c8f20c731 100644 --- a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java +++ b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java @@ -139,8 +139,8 @@ public class AospThemeImpl implements Theme { @Override public int getColorPrimaryDark() { - Assert.checkArgument(colorPrimary != -1); - return 0; + Assert.checkArgument(colorPrimaryDark != -1); + return colorPrimaryDark; } @Override diff --git a/java/com/android/dialer/theme/base/res/values/attr.xml b/java/com/android/dialer/theme/base/res/values/attr.xml index 41c6225ad..606d161ad 100644 --- a/java/com/android/dialer/theme/base/res/values/attr.xml +++ b/java/com/android/dialer/theme/base/res/values/attr.xml @@ -23,4 +23,14 @@ <attr name="colorTextOnUnthemedDarkBackground" format="color"/> <!-- Used to color icons on dark backgrounds. White in Light Theme. --> <attr name="colorIconOnUnthemedDarkBackground" format="color"/> -</resources>
\ No newline at end of file + <!-- Used to color the background of chat bubbles we send --> + <attr name="colorMobileOriginatingChatBackground" format="color"/> + <!-- Used to color the text in chat bubbles we send --> + <attr name="colorMobileOriginatingChatText" format="color"/> + <!-- Used to color the background of chat bubbles we receive --> + <attr name="colorMobileTerminatingChatBackground" format="color"/> + <!-- Used to color the text in chat bubbles we receive --> + <attr name="colorMobileTerminatingChatText" format="color"/> + <!-- Used to theme ripple effects with the app's primary color. --> + <attr name="colorPrimary20pct" format="color|reference"/> +</resources> diff --git a/java/com/android/dialer/theme/base/res/values/styles_dialer_light.xml b/java/com/android/dialer/theme/base/res/values/styles_dialer_light.xml index cfdee7801..5fecbaee5 100644 --- a/java/com/android/dialer/theme/base/res/values/styles_dialer_light.xml +++ b/java/com/android/dialer/theme/base/res/values/styles_dialer_light.xml @@ -34,7 +34,6 @@ <item name="android:textColorSecondary">@color/settings_text_color_secondary</item> <item name="android:windowBackground">?android:attr/colorBackground</item> <item name="android:colorAccent">?android:attr/colorPrimary</item> - <item name="android:textColorLink">?android:attr/colorPrimary</item> </style> <!-- TODO(a bug): This is only actively used in empty_content_view.xml. Move it there. --> diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml index e01a3a282..142bb897b 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml @@ -33,24 +33,24 @@ <!-- Activities and Applications should inherit from one of the themes above. --> <style name="Dialer.Dark.ThemeBase"> <!-- These values should be used to color all backgrounds. --> - <item name="android:colorBackground">@color/dialer_dark_background</item> - <item name="android:colorBackgroundFloating">@color/dialer_dark_background_floating</item> + <item name="android:colorBackground">@color/google_grey_900</item> + <item name="android:colorBackgroundFloating">@color/google_grey_800</item> <!-- These values should be used to set text color. --> <!-- swap text colors. --> - <item name="android:textColorPrimary">@color/dialer_primary_text_color_inverse</item> - <item name="android:textColorSecondary">@color/dialer_secondary_text_color_inverse</item> + <item name="android:textColorPrimary">@color/dialer_dark_primary_text_color</item> + <item name="android:textColorSecondary">@color/dialer_dark_secondary_text_color</item> <item name="android:textColorPrimaryInverse">@color/dialer_primary_text_color</item> <item name="android:textColorSecondaryInverse">@color/dialer_secondary_text_color</item> - <item name="android:textColorHint">@color/dialer_text_hint_color</item> + <item name="android:textColorHint">@color/google_grey_600</item> <!-- These will be automatically used to color most Appcompat/Material widgets. --> - <item name="android:colorPrimary">@color/dialer_theme_color</item> - <item name="colorPrimary">@color/dialer_theme_color</item> - <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> - <item name="colorPrimaryDark">@color/dialer_theme_color_dark</item> - <item name="android:colorAccent">@color/dialer_secondary_color</item> - <item name="colorAccent">@color/dialer_secondary_color</item> + <item name="android:colorPrimary">@color/dialer_dark_theme_color</item> + <item name="colorPrimary">@color/dialer_dark_theme_color</item> + <item name="android:colorPrimaryDark">@color/dialer_dark_theme_color_dark</item> + <item name="colorPrimaryDark">@color/dialer_dark_theme_color_dark</item> + <item name="android:colorAccent">@color/dialer_dark_secondary_color</item> + <item name="colorAccent">@color/dialer_dark_secondary_color</item> <!-- Used to automatically style check/selected checkbox, switches and radio buttons --> <item name="colorControlActivated">?android:attr/colorPrimary</item> @@ -58,7 +58,8 @@ <!-- Dialer specific attributes. --> <item name="colorIcon">?android:attr/textColorSecondary</item> <item name="colorIconSecondary">?android:attr/textColorSecondary</item> - <item name="colorTextOnUnthemedDarkBackground">@color/dialer_primary_text_color_inverse</item> - <item name="colorIconOnUnthemedDarkBackground">@color/dialer_icon_color_white</item> + <item name="colorTextOnUnthemedDarkBackground">@android:color/white</item> + <item name="colorIconOnUnthemedDarkBackground">@android:color/white</item> + <item name="colorPrimary20pct">@color/dialer_dark_theme_color_20pct</item> </style> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml index 667b9726d..db06df4bd 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml @@ -21,6 +21,12 @@ <!-- These are used to style all actionbars in Dialer. These aren't needed in Dialer.ThemeBase.NoActionBar --> <item name="actionBarStyle">@style/DialerActionBarBaseStyle</item> <item name="actionBarSize">@dimen/action_bar_height</item> + + <!-- Pulled from Theme.AppCompat.Light.DarkActionbar--> + <item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item> + <item name="actionBarWidgetTheme">@null</item> + <item name="actionBarTheme">@style/DialerActionBarBaseTheme</item> + <item name="listChoiceBackgroundIndicator">@drawable/abc_list_selector_holo_dark</item> </style> <style name="Dialer.ThemeBase.NoActionBar"> @@ -33,15 +39,15 @@ <!-- Activities and Applications should inherit from one of the themes above. --> <style name="Dialer.ThemeBase"> <!-- These values should be used to color all backgrounds. --> - <item name="android:colorBackground">@color/dialer_background_light</item> - <item name="android:colorBackgroundFloating">@color/dialer_background_floating_light</item> + <item name="android:colorBackground">@color/dialer_background_color</item> + <item name="android:colorBackgroundFloating">@android:color/white</item> <!-- These values should be used to set text color. --> <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> - <item name="android:textColorPrimaryInverse">@color/dialer_primary_text_color_inverse</item> - <item name="android:textColorSecondaryInverse">@color/dialer_secondary_text_color_inverse</item> - <item name="android:textColorHint">@color/dialer_text_hint_color</item> + <item name="android:textColorPrimaryInverse">@color/google_grey_300</item> + <item name="android:textColorSecondaryInverse">@color/google_grey_400</item> + <item name="android:textColorHint">@color/google_grey_600</item> <!-- These will be automatically used to color most Appcompat/Material widgets. --> <item name="android:colorPrimary">@color/dialer_theme_color</item> @@ -55,10 +61,15 @@ <item name="colorControlActivated">?android:attr/colorPrimary</item> <!-- Dialer specific attributes. --> - <item name="colorIcon">@color/dialer_secondary_text_color</item> - <item name="colorIconSecondary">@color/dialer_icon_color_secondary</item> - <item name="colorTextOnUnthemedDarkBackground">@color/dialer_primary_text_color_inverse</item> - <item name="colorIconOnUnthemedDarkBackground">@color/dialer_icon_color_white</item> + <item name="colorIcon">@color/google_grey_700</item> + <item name="colorIconSecondary">@color/google_grey_400</item> + <item name="colorTextOnUnthemedDarkBackground">@android:color/white</item> + <item name="colorIconOnUnthemedDarkBackground">@android:color/white</item> + <item name="colorMobileTerminatingChatText">@color/google_grey_900</item> + <item name="colorMobileTerminatingChatBackground">@color/google_grey_100</item> + <item name="colorMobileOriginatingChatText">@color/google_blue_900</item> + <item name="colorMobileOriginatingChatBackground">@color/google_blue_100</item> + <item name="colorPrimary20pct">@color/dialer_theme_color_20pct</item> </style> <!-- TODO(a bug): investigate making this style's parent Dialer.ThemeBase.NoActionBar --> @@ -78,4 +89,8 @@ <item name="android:background">?android:attr/colorPrimary</item> <item name="background">?android:attr/colorPrimary</item> </style> + <style name="DialerActionBarBaseTheme" + parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> + <item name="colorControlNormal">@android:color/white</item> + </style> </resources> diff --git a/java/com/android/dialer/theme/common/res/values/colors.xml b/java/com/android/dialer/theme/common/res/values/colors.xml index 8f5976703..1831862b1 100644 --- a/java/com/android/dialer/theme/common/res/values/colors.xml +++ b/java/com/android/dialer/theme/common/res/values/colors.xml @@ -20,6 +20,7 @@ <color name="dialer_end_call_button_color">#BD2A2A</color> <color name="dialer_divider_line_color">#D8D8D8</color> <color name="dialer_link_color">#2A56C6</color> + <color name="dialer_snackbar_action_text_color">#4285F4</color> <!-- Colors for the notification actions --> <color name="notification_action_accept">#097138</color> diff --git a/java/com/android/dialer/theme/common/res/values/strings.xml b/java/com/android/dialer/theme/common/res/values/strings.xml index 7d7209207..5952a01d7 100644 --- a/java/com/android/dialer/theme/common/res/values/strings.xml +++ b/java/com/android/dialer/theme/common/res/values/strings.xml @@ -39,6 +39,9 @@ <!-- Displayed when handover from WiFi to Lte occurs during a video call --> <string name="video_call_lte_to_wifi_handover_toast">Continuing call using Wi\u2011Fi\u2026</string> + <!-- Displayed when RTT upgrade request failed --> + <string name="rtt_call_not_available_toast">RTT not available for this call</string> + <!-- String used to build a phone number type and phone number string. Example: Mobile 650-555-1212 --> <string name="call_subject_type_and_number"> diff --git a/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml index 82e79c631..703e40bed 100644 --- a/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml @@ -16,6 +16,6 @@ --> <!-- Primary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" android:color="@color/dialer_dark_text_color_disabled"/> - <item android:color="@color/dialer_dark_primary_text_color_enabled"/> + <item android:state_enabled="false" android:color="@color/google_grey_700"/> + <item android:color="@color/google_grey_400"/> </selector> diff --git a/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml index d057f9e65..486669f91 100644 --- a/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml @@ -16,6 +16,6 @@ --> <!-- Secondary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" android:color="@color/dialer_dark_text_color_disabled"/> - <item android:color="@color/dialer_dark_secondary_text_color_enabled"/> + <item android:state_enabled="false" android:color="@color/google_grey_700"/> + <item android:color="@color/google_grey_300"/> </selector> diff --git a/java/com/android/dialer/theme/hidden/res/color/dialer_primary_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_primary_text_color.xml index 6612b17ab..58aa2b0e1 100644 --- a/java/com/android/dialer/theme/hidden/res/color/dialer_primary_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_primary_text_color.xml @@ -16,6 +16,6 @@ --> <!-- Primary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" android:color="@color/dialer_text_color_disabled"/> - <item android:color="@color/dialer_primary_text_color_enabled"/> + <item android:state_enabled="false" android:color="@color/google_grey_400"/> + <item android:color="@color/google_grey_900"/> </selector>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/hidden/res/color/dialer_secondary_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_secondary_text_color.xml index e1c000aef..20dfd3528 100644 --- a/java/com/android/dialer/theme/hidden/res/color/dialer_secondary_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_secondary_text_color.xml @@ -16,6 +16,6 @@ --> <!-- Secondary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" android:color="@color/dialer_text_color_disabled"/> - <item android:color="@color/dialer_secondary_text_color_enabled"/> + <item android:state_enabled="false" android:color="@color/google_grey_400"/> + <item android:color="@color/google_grey_700"/> </selector>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/hidden/res/color/settings_text_color_primary.xml b/java/com/android/dialer/theme/hidden/res/color/settings_text_color_primary.xml index 7a14d22fa..b26c2c2f0 100644 --- a/java/com/android/dialer/theme/hidden/res/color/settings_text_color_primary.xml +++ b/java/com/android/dialer/theme/hidden/res/color/settings_text_color_primary.xml @@ -18,6 +18,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/dialer_text_color_disabled" android:state_enabled="false"/> - <item android:color="@color/dialer_primary_text_color_enabled"/> + <item android:color="@color/google_grey_400" android:state_enabled="false"/> + <item android:color="@color/google_grey_900"/> </selector> diff --git a/java/com/android/dialer/theme/hidden/res/color/settings_text_color_secondary.xml b/java/com/android/dialer/theme/hidden/res/color/settings_text_color_secondary.xml index c4baefd33..21e125a69 100644 --- a/java/com/android/dialer/theme/hidden/res/color/settings_text_color_secondary.xml +++ b/java/com/android/dialer/theme/hidden/res/color/settings_text_color_secondary.xml @@ -18,6 +18,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/dialer_text_color_disabled" android:state_enabled="false"/> - <item android:color="@color/dialer_secondary_text_color_enabled"/> + <item android:color="@color/google_grey_400" android:state_enabled="false"/> + <item android:color="@color/google_grey_700"/> </selector> diff --git a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_dark.xml b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_dark.xml index 7dc894be9..e48474e9f 100644 --- a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_dark.xml +++ b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_dark.xml @@ -15,26 +15,8 @@ --> <resources> <!-- Essential theme colors --> - <color name="dialer_dark_theme_color">#2A56C6</color> - <color name="dialer_dark_theme_color_dark">#1C3AA9</color> - <color name="dialer_dark_secondary_color">#F50057</color> - <color name="dialer_dark_theme_color_20pct">#332A56C6</color> - - <!-- Text colors --> - <color name="dialer_dark_primary_text_color_enabled">#FFFFFF</color> - <color name="dialer_dark_secondary_text_color_enabled">#DDFFFFFF</color> - <color name="dialer_dark_text_color_disabled">#333333</color> - <color name="dialer_dark_text_hint_color">#DE78909C</color> - <color name="dialer_dark_primary_text_color_inverse">#212121</color> - <color name="dialer_dark_secondary_text_color_inverse">#636363</color> - <color name="dialer_dark_snackbar_action_text_color">#4285F4</color> - - <!-- Background colors --> - <color name="dialer_dark_background">#212121</color> - <color name="dialer_dark_background_floating">#000000</color> - - <!-- Other useful colors --> - <color name="dialer_dark_icon_color">#C4000000</color> - <color name="dialer_icon_color_secondary">#E1E1E1</color> - <color name="dialer_icon_color_white">#FFFFFF</color> + <color name="dialer_dark_theme_color">#5195EA</color> + <color name="dialer_dark_theme_color_20pct">#335195EA</color> + <color name="dialer_dark_theme_color_dark">#2374CE</color> + <color name="dialer_dark_secondary_color">#5195EA</color> </resources> diff --git a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml index 1d5a1e7ee..988aad78f 100644 --- a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml +++ b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml @@ -14,38 +14,10 @@ ~ limitations under the License --> <resources> - <!-- Note: The following colors are used in the Dialer settings screens. Since Dialer's settings - link into the Telephony settings as well, changes to these colors should be mirrored in - Telephony: - - Android source path: packages/apps/PhoneCommon/res/values/colors.xml - - Local: dialer_theme_color Android Source: dialer_theme_color - - Local: dialer_theme_color_dark Android Source: dialer_theme_color_dark - Android source path: packages/services/Telecomm/res/values/colors.xml - - Local: dialer_theme_color Android Source: theme_color - - Local: dialer_theme_color_dark Android Source: dialer_settings_color_dark - --> <!-- Essential theme colors --> <color name="dialer_theme_color">#2A56C6</color> + <color name="dialer_theme_color_20pct">#332A56C6</color> <color name="dialer_theme_color_dark">#1C3AA9</color> <color name="dialer_secondary_color">#F50057</color> - <color name="dialer_theme_color_20pct">#332A56C6</color> - - <!-- Text colors --> - <color name="dialer_primary_text_color_enabled">#212121</color> - <color name="dialer_secondary_text_color_enabled">#636363</color> - <color name="dialer_text_color_disabled">#9E9E9E</color> - <color name="dialer_text_hint_color">#DE78909C</color> - <color name="dialer_primary_text_color_inverse">#FFFFFF</color> - <color name="dialer_secondary_text_color_inverse">#DDFFFFFF</color> - <color name="dialer_snackbar_action_text_color">#4285F4</color> - - <!-- Background colors --> - <color name="dialer_background_light">#FAFAFA</color> - <color name="dialer_background_floating_light">#FFFFFF</color> - - <!-- Other useful colors --> - <color name="dialer_icon_color">#89000000</color> - <color name="dialer_icon_color_secondary">#E1E1E1</color> - <color name="dialer_icon_color_white">#FFFFFF</color> + <color name="dialer_background_color">#FAFAFA</color> </resources> diff --git a/java/com/android/dialer/theme/hidden/res/values/colors_pallet.xml b/java/com/android/dialer/theme/hidden/res/values/colors_pallet.xml new file mode 100644 index 000000000..7a092b28f --- /dev/null +++ b/java/com/android/dialer/theme/hidden/res/values/colors_pallet.xml @@ -0,0 +1,35 @@ +<!-- + ~ Copyright (C) 2018 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 + --> +<resources> + <color name="google_blue_900">#174EA6</color> + <color name="google_blue_800">#185ABC</color> + <color name="google_blue_700">#1967D2</color> + <color name="google_blue_600">#1A73E8</color> + <color name="google_blue_500">#4285F4</color> + <color name="google_blue_100">#D2E3FC</color> + <color name="google_blue_50">#E8F0FE</color> + + <color name="google_grey_900">#202124</color> + <color name="google_grey_800">#3C4043</color> + <color name="google_grey_700">#5F6368</color> + <color name="google_grey_600">#80868B</color> + <color name="google_grey_500">#9AA0A6</color> + <color name="google_grey_400">#BDC1C6</color> + <color name="google_grey_300">#DADCE0</color> + <color name="google_grey_200">#E8EAED</color> + <color name="google_grey_100">#F1F3F4</color> + <color name="google_grey_50">#F8F9FA</color> +</resources> diff --git a/java/com/android/dialer/theme/hidden/res/values/styles.xml b/java/com/android/dialer/theme/hidden/res/values/styles.xml index 90e452993..44a35f8a2 100644 --- a/java/com/android/dialer/theme/hidden/res/values/styles.xml +++ b/java/com/android/dialer/theme/hidden/res/values/styles.xml @@ -55,5 +55,7 @@ <!-- TODO(a bug): figure out why ?android:attr/colorPrimary doesn't work here --> <item name="android:colorAccent">@color/dialer_theme_color</item> <item name="colorAccent">@color/dialer_theme_color</item> + <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> + <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> </style> </resources> diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusCorruptionHandler.java b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusCorruptionHandler.java index 630a17d8f..75b21e7e9 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusCorruptionHandler.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusCorruptionHandler.java @@ -27,7 +27,7 @@ import android.telephony.TelephonyManager; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.telephony.TelephonyManagerCompat; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; @@ -47,7 +47,9 @@ public class VoicemailStatusCorruptionHandler { public static void maybeFixVoicemailStatus(Context context, Cursor statusCursor, Source source) { - if (ConfigProviderBindings.get(context).getBoolean(CONFIG_VVM_STATUS_FIX_DISABLED, false)) { + if (ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean(CONFIG_VVM_STATUS_FIX_DISABLED, false)) { return; } diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java index 62252121e..efc094c5c 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java @@ -37,7 +37,7 @@ import android.view.View; import android.view.View.OnClickListener; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.telephony.TelephonyManagerCompat; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.voicemail.listui.error.VoicemailErrorMessage.Action; @@ -552,7 +552,8 @@ public class VoicemailTosMessageCreator { } private String getLearnMoreUrl() { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getString( "voicemail_transcription_learn_more_url", context.getString(R.string.dialer_terms_and_conditions_learn_more_url)); diff --git a/java/com/android/dialer/widget/DialerToolbar.java b/java/com/android/dialer/widget/DialerToolbar.java index 02ec8c02c..40dabe8bc 100644 --- a/java/com/android/dialer/widget/DialerToolbar.java +++ b/java/com/android/dialer/widget/DialerToolbar.java @@ -29,13 +29,13 @@ import com.android.dialer.theme.base.ThemeComponent; public class DialerToolbar extends Toolbar { private final TextView title; - private final TextView subtitle; + private final BidiTextView subtitle; public DialerToolbar(Context context, @Nullable AttributeSet attributeSet) { super(context, attributeSet); inflate(context, R.layout.dialer_toolbar, this); title = (TextView) findViewById(R.id.title); - subtitle = (TextView) findViewById(R.id.subtitle); + subtitle = (BidiTextView) findViewById(R.id.subtitle); setElevation(getResources().getDimensionPixelSize(R.dimen.toolbar_elevation)); setBackgroundColor(ThemeComponent.get(context).theme().getColorPrimary()); diff --git a/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml b/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml index a75176a22..3b4d1367e 100644..100755 --- a/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml +++ b/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml @@ -31,7 +31,7 @@ android:textColor="?android:attr/textColorPrimaryInverse" style="@style/Dialer.TextAppearance.Header2"/> - <TextView + <com.android.dialer.widget.BidiTextView android:id="@+id/subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index 6614e7c74..91255cc7e 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -48,7 +48,7 @@ import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.multimedia.MultimediaData; @@ -768,7 +768,8 @@ public class CallCardPresenter } private boolean shouldShowLocation() { - if (!ConfigProviderBindings.get(context) + if (!ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(CONFIG_ENABLE_EMERGENCY_LOCATION, CONFIG_ENABLE_EMERGENCY_LOCATION_DEFAULT)) { LogUtil.i("CallCardPresenter.getLocationFragment", "disabled by config."); return false; @@ -840,7 +841,8 @@ public class CallCardPresenter int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1); float batteryPercent = (100f * level) / scale; long threshold = - ConfigProviderBindings.get(context) + ConfigProviderComponent.get(context) + .getConfigProvider() .getLong( CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION, CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT); diff --git a/java/com/android/incallui/DialpadFragment.java b/java/com/android/incallui/DialpadFragment.java index 343cb34fd..2ae2aca94 100644 --- a/java/com/android/incallui/DialpadFragment.java +++ b/java/com/android/incallui/DialpadFragment.java @@ -21,6 +21,7 @@ import android.os.Bundle; import android.telephony.PhoneNumberUtils; import android.util.ArrayMap; import android.util.AttributeSet; +import android.view.ContextThemeWrapper; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -136,7 +137,9 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi> @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View parent = inflater.inflate(R.layout.incall_dialpad_fragment, container, false); + Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.Dialer_ThemeBase); + LayoutInflater layoutInflater = inflater.cloneInContext(contextThemeWrapper); + final View parent = layoutInflater.inflate(R.layout.incall_dialpad_fragment, container, false); dialpadView = (DialpadView) parent.findViewById(R.id.dialpad_view); dialpadView.setCanDigitsBeEdited(false); dialpadView.setBackgroundResource(R.color.incall_dialpad_background); diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java index 2ec17308f..7d9608a56 100644 --- a/java/com/android/incallui/InCallActivity.java +++ b/java/com/android/incallui/InCallActivity.java @@ -62,7 +62,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.ThreadUtil; import com.android.dialer.common.concurrent.UiListener; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.Logger; import com.android.dialer.logging.ScreenEvent; import com.android.dialer.metrics.Metrics; @@ -1506,7 +1506,8 @@ public class InCallActivity extends TransactionSafeFragmentActivity LogUtil.i("InCallActivity.shouldAllowAnswerAndRelease", "video call"); return false; } - if (!ConfigProviderBindings.get(this) + if (!ConfigProviderComponent.get(this) + .getConfigProvider() .getBoolean(ConfigNames.ANSWER_AND_RELEASE_ENABLED, true)) { LogUtil.i("InCallActivity.shouldAllowAnswerAndRelease", "disabled by config"); return false; diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 5aabf0694..150499f73 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -423,6 +423,10 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud if (dialerCall == null) { dialerCall = callList.getOutgoingCall(); } + // Outgoing call can be disconnected and reason will be shown in toast + if (dialerCall == null) { + dialerCall = callList.getDisconnectedCall(); + } if (dialerCall == null) { return false; } diff --git a/java/com/android/incallui/ReturnToCallController.java b/java/com/android/incallui/ReturnToCallController.java index 09e1845aa..94ce8d7af 100644 --- a/java/com/android/incallui/ReturnToCallController.java +++ b/java/com/android/incallui/ReturnToCallController.java @@ -32,7 +32,7 @@ import com.android.bubble.BubbleInfo; import com.android.bubble.BubbleInfo.Action; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.theme.base.ThemeComponent; @@ -82,7 +82,9 @@ public class ReturnToCallController implements InCallUiListener, Listener, Audio private InCallState inCallState; public static boolean isEnabled(Context context) { - return ConfigProviderBindings.get(context).getBoolean("enable_return_to_call_bubble_v2", false); + return ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean("enable_return_to_call_bubble_v2", false); } public ReturnToCallController(Context context, ContactInfoCache contactInfoCache) { diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 27d23c4ae..6519e00ac 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -66,7 +66,7 @@ import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.contactphoto.BitmapUtil; import com.android.dialer.enrichedcall.EnrichedCallManager; import com.android.dialer.enrichedcall.Session; @@ -292,7 +292,8 @@ public class StatusBarNotifier if (callState == DialerCallState.INCOMING || callState == DialerCallState.CALL_WAITING || isVideoUpgradeRequest) { - if (ConfigProviderBindings.get(context) + if (ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("quiet_incoming_call_if_ui_showing", true)) { notificationType = InCallPresenter.getInstance().isShowingInCallUi() diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java index 41c33543b..88713f48d 100644 --- a/java/com/android/incallui/VideoCallPresenter.java +++ b/java/com/android/incallui/VideoCallPresenter.java @@ -29,7 +29,7 @@ import android.view.Surface; import android.view.SurfaceView; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.util.PermissionsUtil; import com.android.incallui.InCallPresenter.InCallDetailsListener; import com.android.incallui.InCallPresenter.InCallOrientationListener; @@ -1081,7 +1081,9 @@ public class VideoCallPresenter "VideoCallPresenter.shouldShowCameraPermissionToast", "already shown for this call"); return false; } - if (!ConfigProviderBindings.get(context).getBoolean("camera_permission_dialog_allowed", true)) { + if (!ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean("camera_permission_dialog_allowed", true)) { LogUtil.i("VideoCallPresenter.shouldShowCameraPermissionToast", "disabled by config"); return false; } diff --git a/java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java b/java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java index b661579a3..494a6224d 100644 --- a/java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java +++ b/java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java @@ -20,7 +20,7 @@ import android.content.Context; import android.hardware.SensorEvent; import android.util.DisplayMetrics; import android.view.MotionEvent; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; /** An classifier trying to determine whether it is a human interacting with the phone or not. */ class HumanInteractionClassifier extends Classifier { @@ -44,7 +44,8 @@ class HumanInteractionClassifier extends Classifier { classifierData = new ClassifierData(dpi, displayMetrics.heightPixels); historyEvaluator = new HistoryEvaluator(); enabled = - ConfigProviderBindings.get(context) + ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(CONFIG_ANSWER_FALSE_TOUCH_DETECTION_ENABLED, true); strokeClassifiers = diff --git a/java/com/android/incallui/answer/impl/hint/AnswerHintFactory.java b/java/com/android/incallui/answer/impl/hint/AnswerHintFactory.java index 2ed434660..734fa96ad 100644 --- a/java/com/android/incallui/answer/impl/hint/AnswerHintFactory.java +++ b/java/com/android/incallui/answer/impl/hint/AnswerHintFactory.java @@ -24,7 +24,7 @@ import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.storage.StorageComponent; import com.android.incallui.util.AccessibilityUtil; @@ -95,7 +95,9 @@ public class AnswerHintFactory { .unencryptedSharedPrefs() .getInt(ANSWERED_COUNT_PREFERENCE_KEY, 0); long threshold = - ConfigProviderBindings.get(context).getLong(CONFIG_ANSWER_HINT_ANSWERED_THRESHOLD_KEY, 3); + ConfigProviderComponent.get(context) + .getConfigProvider() + .getLong(CONFIG_ANSWER_HINT_ANSWERED_THRESHOLD_KEY, 3); LogUtil.i( "AnswerHintFactory.shouldShowAnswerHint", "answerCount: %d, threshold: %d", @@ -110,7 +112,8 @@ public class AnswerHintFactory { * string. */ private static boolean isDeviceWhitelisted(Context context, String device) { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getString(CONFIG_ANSWER_HINT_WHITELISTED_DEVICES_KEY, DEFAULT_WHITELISTED_DEVICES_CSV) .contains("/" + device + "/"); } diff --git a/java/com/android/incallui/answer/impl/hint/PawSecretCodeListener.java b/java/com/android/incallui/answer/impl/hint/PawSecretCodeListener.java index f6444e5b4..e9d2c6f0a 100644 --- a/java/com/android/incallui/answer/impl/hint/PawSecretCodeListener.java +++ b/java/com/android/incallui/answer/impl/hint/PawSecretCodeListener.java @@ -25,7 +25,7 @@ import android.support.annotation.VisibleForTesting; import android.text.TextUtils; import android.widget.Toast; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.logging.DialerImpression.Type; import com.android.dialer.logging.Logger; import com.android.dialer.storage.StorageComponent; @@ -62,7 +62,9 @@ public class PawSecretCodeListener extends BroadcastReceiver { return; } String secretCode = - ConfigProviderBindings.get(context).getString(CONFIG_PAW_SECRET_CODE, "729"); + ConfigProviderComponent.get(context) + .getConfigProvider() + .getString(CONFIG_PAW_SECRET_CODE, "729"); if (secretCode == null) { return; } diff --git a/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml b/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml index 3740f3d1b..adb153f6d 100644 --- a/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml +++ b/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml @@ -18,7 +18,7 @@ android:color="#DADCE0"> <item android:id="@android:id/mask"> <shape xmlns:android="http://schemas.android.com/apk/res/android"> - <solid android:color="@color/dialer_background_light"/> + <solid android:color="?android:attr/colorBackground"/> <padding android:bottom="9dp" android:left="8dp" @@ -29,7 +29,7 @@ </item> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android"> - <solid android:color="@color/dialer_background_floating_light"/> + <solid android:color="#FFFFFF"/> <stroke android:width="1dp" android:color="#DADCE0"/> @@ -41,4 +41,4 @@ <corners android:radius="40dp"/> </shape> </item> -</ripple>
\ No newline at end of file +</ripple> diff --git a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java index 939d12014..8aeb05fea 100644 --- a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java +++ b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java @@ -22,7 +22,7 @@ import android.os.PowerManager; import android.os.Trace; import android.view.Display; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.incallui.call.DialerCall; import com.android.incallui.call.DialerCallListener; import com.android.incallui.call.state.DialerCallState; @@ -53,7 +53,8 @@ public class AnswerProximitySensor return false; } - if (!ConfigProviderBindings.get(context) + if (!ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(CONFIG_ANSWER_PROXIMITY_SENSOR_ENABLED, true)) { LogUtil.i("AnswerProximitySensor.shouldUse", "disabled by config"); Trace.endSection(); @@ -84,7 +85,8 @@ public class AnswerProximitySensor this.call = call; LogUtil.i("AnswerProximitySensor.constructor", "acquiring lock"); - if (ConfigProviderBindings.get(context) + if (ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(CONFIG_ANSWER_PSEUDO_PROXIMITY_WAKE_LOCK_ENABLED, true)) { answerProximityWakeLock = new PseudoProximityWakeLock(context, pseudoScreenState); } else { diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java index 634a302a2..31afe71db 100644 --- a/java/com/android/incallui/call/CallList.java +++ b/java/com/android/incallui/call/CallList.java @@ -150,7 +150,9 @@ public class CallList implements DialerCallDelegate { if (SpamComponent.get(context).spamSettings().isSpamEnabled()) { String number = TelecomCallUtil.getNumber(telecomCall); ListenableFuture<SpamStatus> futureSpamStatus = - SpamComponent.get(context).spam().checkSpamStatus(number, call.getCountryIso()); + SpamComponent.get(context) + .spam() + .checkSpamStatusForInCallUi(number, call.getCountryIso()); Futures.addCallback( futureSpamStatus, diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index b2c8dcc67..904a5a833 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -60,7 +60,7 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DefaultFutureCallback; import com.android.dialer.compat.telephony.TelephonyManagerCompat; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.duo.DuoComponent; import com.android.dialer.enrichedcall.EnrichedCallCapabilities; import com.android.dialer.enrichedcall.EnrichedCallComponent; @@ -315,6 +315,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa @Override public void onRttInitiationFailure(Call call, int reason) { LogUtil.v("TelecomCallCallback.onRttInitiationFailure", "reason=%d", reason); + Toast.makeText(context, R.string.rtt_call_not_available_toast, Toast.LENGTH_LONG).show(); update(); } @@ -841,7 +842,8 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa boolean isInEmergencyCallbackWindow(long timestampMillis) { long emergencyCallbackWindowMillis = - ConfigProviderBindings.get(context) + ConfigProviderComponent.get(context) + .getConfigProvider() .getLong(CONFIG_EMERGENCY_CALLBACK_WINDOW_MILLIS, TimeUnit.MINUTES.toMillis(5)); return System.currentTimeMillis() - timestampMillis < emergencyCallbackWindowMillis; } diff --git a/java/com/android/incallui/contactgrid/BottomRow.java b/java/com/android/incallui/contactgrid/BottomRow.java index 7388c50a8..767d66668 100644 --- a/java/com/android/incallui/contactgrid/BottomRow.java +++ b/java/com/android/incallui/contactgrid/BottomRow.java @@ -18,9 +18,6 @@ package com.android.incallui.contactgrid; import android.content.Context; import android.support.annotation.Nullable; -import android.telephony.PhoneNumberUtils; -import android.text.BidiFormatter; -import android.text.TextDirectionHeuristics; import android.text.TextUtils; import com.android.incallui.call.state.DialerCallState; import com.android.incallui.incall.protocol.PrimaryCallState; @@ -118,21 +115,15 @@ public class BottomRow { return primaryInfo.location(); } if (!primaryInfo.nameIsNumber() && !TextUtils.isEmpty(primaryInfo.number())) { - CharSequence spannedNumber = spanDisplayNumber(primaryInfo.number()); if (primaryInfo.label() == null) { - return spannedNumber; + return primaryInfo.number(); } else { - return TextUtils.concat(primaryInfo.label(), " ", spannedNumber); + return TextUtils.concat(primaryInfo.label(), " ", primaryInfo.number()); } } return null; } - private static CharSequence spanDisplayNumber(String displayNumber) { - return PhoneNumberUtils.createTtsSpannable( - BidiFormatter.getInstance().unicodeWrap(displayNumber, TextDirectionHeuristics.LTR)); - } - private static boolean isIncoming(PrimaryCallState state) { return state.state() == DialerCallState.INCOMING || state.state() == DialerCallState.CALL_WAITING; diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java index 6d04a2735..189f6fef1 100644 --- a/java/com/android/incallui/contactgrid/ContactGridManager.java +++ b/java/com/android/incallui/contactgrid/ContactGridManager.java @@ -35,11 +35,12 @@ import android.widget.TextView; import android.widget.ViewAnimator; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.glidephotomanager.GlidePhotoManagerComponent; import com.android.dialer.glidephotomanager.PhotoInfo; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.util.DrawableConverter; +import com.android.dialer.widget.BidiTextView; import com.android.incallui.incall.protocol.ContactPhotoType; import com.android.incallui.incall.protocol.PrimaryCallState; import com.android.incallui.incall.protocol.PrimaryInfo; @@ -77,7 +78,7 @@ public class ContactGridManager { private final TextView forwardedNumberView; private final ImageView spamIconImageView; private final ViewAnimator bottomTextSwitcher; - private final TextView bottomTextView; + private final BidiTextView bottomTextView; private final Chronometer bottomTimerView; private final Space topRowSpace; private int avatarSize; @@ -301,7 +302,9 @@ public class ContactGridManager { if (hideAvatar) { avatarImageView.setVisibility(View.GONE); } else if (avatarSize > 0 && updateAvatarVisibility()) { - if (ConfigProviderBindings.get(context).getBoolean("enable_glide_photo", false)) { + if (ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean("enable_glide_photo", false)) { loadPhotoWithGlide(); } else { loadPhotoWithLegacy(); @@ -315,7 +318,8 @@ public class ContactGridManager { PhotoInfo.newBuilder() .setIsBusiness(primaryInfo.photoType() == ContactPhotoType.BUSINESS) .setIsVoicemail(primaryCallState.isVoiceMailNumber()) - .setIsSpam(primaryInfo.isSpam()); + .setIsSpam(primaryInfo.isSpam()) + .setIsConference(primaryCallState.isConference()); // Contact has a name, that is a number. if (primaryInfo.nameIsNumber() && primaryInfo.number() != null) { diff --git a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml index ce355ea2d..73db41314 100644 --- a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml +++ b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml @@ -53,7 +53,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="2dp" android:measureAllChildren="false"> - <TextView + <com.android.dialer.widget.BidiTextView android:id="@+id/contactgrid_bottom_text" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/java/com/android/incallui/rtt/impl/res/color/submit_button_background_color.xml b/java/com/android/incallui/rtt/impl/res/color/submit_button_background_color.xml new file mode 100644 index 000000000..0da2c374a --- /dev/null +++ b/java/com/android/incallui/rtt/impl/res/color/submit_button_background_color.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_enabled="false" + android:color="#BDBDBD" /> + <item android:color="#FFFFFF" /> +</selector>
\ No newline at end of file diff --git a/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml b/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml index 21d00a3e3..cff2b3f38 100644 --- a/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml +++ b/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml @@ -62,11 +62,11 @@ android:layout_height="53dp" android:layout_gravity="bottom" android:background="@drawable/input_bubble_background" - android:backgroundTint="?colorIcon" + android:backgroundTint="@color/submit_button_background_color" android:backgroundTintMode="multiply" android:contentDescription="@string/content_description_rtt_check_button" android:src="@drawable/quantum_ic_done_vd_theme_24" - android:tint="?android:attr/colorPrimary" + android:tint="@color/submit_button_color" android:visibility="gone"/> </LinearLayout> diff --git a/java/com/android/incallui/spam/SpamAlternativeExperimentUtil.java b/java/com/android/incallui/spam/SpamAlternativeExperimentUtil.java index 52eadcff3..27942d8d2 100644 --- a/java/com/android/incallui/spam/SpamAlternativeExperimentUtil.java +++ b/java/com/android/incallui/spam/SpamAlternativeExperimentUtil.java @@ -18,7 +18,7 @@ package com.android.incallui.spam; import android.content.Context; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; /** Returns resource id based on experiment number. */ public final class SpamAlternativeExperimentUtil { @@ -29,7 +29,9 @@ public final class SpamAlternativeExperimentUtil { */ public static int getResourceIdByName(String resourceName, Context context) { long experiment = - ConfigProviderBindings.get(context).getLong("experiment_for_alternative_spam_word", 230150); + ConfigProviderComponent.get(context) + .getConfigProvider() + .getLong("experiment_for_alternative_spam_word", 230150); LogUtil.i( "SpamAlternativeExperimentUtil.getResourceIdByName", "using experiment %d", experiment); String modifiedResourceName = resourceName; diff --git a/java/com/android/incallui/speakeasy/SpeakEasyCallManager.java b/java/com/android/incallui/speakeasy/SpeakEasyCallManager.java index b060f64cb..f2916f46f 100644 --- a/java/com/android/incallui/speakeasy/SpeakEasyCallManager.java +++ b/java/com/android/incallui/speakeasy/SpeakEasyCallManager.java @@ -54,6 +54,16 @@ public interface SpeakEasyCallManager { */ boolean isAvailable(@NonNull Context context); + /** + * Optional: Performs work necessary to happen-before callers use other methods on this interface. + * + * @apiNote Use of this API is completely optional, and callers are NOT required to invoke this + * method prior to using other methods on the interface. + * @implSpec Other members of this interface always promise to do any required initialization work + * at the time they are invoked. This method will always be idempotent. + */ + default void performManualInitialization() {} + /** Returns the config provider flag associated with the feature. */ @NonNull String getConfigProviderFlag(); diff --git a/java/com/android/incallui/theme/res/values/colors.xml b/java/com/android/incallui/theme/res/values/colors.xml index cb894bbb7..059fe59a9 100644 --- a/java/com/android/incallui/theme/res/values/colors.xml +++ b/java/com/android/incallui/theme/res/values/colors.xml @@ -25,9 +25,6 @@ <!-- Background color for status bar. For portrait this will be ignored. --> <color name="statusbar_background_color">?android:attr/colorPrimary</color> - <!-- 20% opacity, theme color. --> - <color name="incall_dialpad_touch_tint">@color/dialer_theme_color_20pct</color> - <!-- Background colors for InCallUI. This is a set of colors which pass WCAG AA and all have a contrast ratio over 5:1. diff --git a/java/com/android/incallui/theme/res/values/styles.xml b/java/com/android/incallui/theme/res/values/styles.xml index 3475e3548..e6d6b07b7 100644 --- a/java/com/android/incallui/theme/res/values/styles.xml +++ b/java/com/android/incallui/theme/res/values/styles.xml @@ -25,7 +25,7 @@ <item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> - <item name="dialpad_key_button_touch_tint">@color/incall_dialpad_touch_tint</item> + <item name="dialpad_key_button_touch_tint">?attr/colorPrimary20pct</item> <item name="dialpad_style">@style/InCallDialpad</item> <item name="android:windowAnimationStyle">@null</item> @@ -34,11 +34,14 @@ </style> <style name="Theme.InCallScreen" parent="@style/Dialer.Dark.ThemeBase.NoActionBar"> + <item name="android:textColorPrimary">@android:color/white</item> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> + <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> + <item name="colorPrimaryDark">@color/dialer_theme_color_dark</item> - <item name="dialpad_key_button_touch_tint">@color/incall_dialpad_touch_tint</item> + <item name="dialpad_key_button_touch_tint">?attr/colorPrimary20pct</item> <item name="dialpad_style">@style/InCallDialpad</item> <item name="android:windowAnimationStyle">@null</item> @@ -49,7 +52,7 @@ <style name="Theme.InCallScreen.ManageConference" parent="Dialer.ThemeBase.ActionBar"> </style> - <style name="InCallDialpad" parent="Dialpad.Light"> + <style name="InCallDialpad" parent="Dialpad.Themed"> <item name="dialpad_key_number_margin_bottom"> @dimen/incall_dialpad_key_number_margin_bottom </item> @@ -72,8 +75,6 @@ @dimen/incall_end_call_spacing </item> <item name="dialpad_elevation">10dp</item> - <item name="dialpad_text_color">?android:attr/textColorPrimaryInverse</item> - <item name="dialpad_text_color_secondary">?android:attr/textColorSecondaryInverse</item> </style> <style name="AfterCallNotificationTheme" parent="Dialer.ThemeBase.NoActionBar"> diff --git a/java/com/android/incallui/videotech/duo/DuoVideoTech.java b/java/com/android/incallui/videotech/duo/DuoVideoTech.java index ac74e54df..47f075700 100644 --- a/java/com/android/incallui/videotech/duo/DuoVideoTech.java +++ b/java/com/android/incallui/videotech/duo/DuoVideoTech.java @@ -24,7 +24,7 @@ import android.telecom.PhoneAccountHandle; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DefaultFutureCallback; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.duo.Duo; import com.android.dialer.duo.DuoListener; import com.android.dialer.logging.DialerImpression; @@ -60,7 +60,8 @@ public class DuoVideoTech implements VideoTech, DuoListener { @Override public boolean isAvailable(Context context, PhoneAccountHandle phoneAccountHandle) { - if (!ConfigProviderBindings.get(context) + if (!ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("enable_lightbringer_video_upgrade", true)) { LogUtil.v("DuoVideoTech.isAvailable", "upgrade disabled by flag"); return false; diff --git a/java/com/android/voicemail/impl/DialerVvmConfigManager.java b/java/com/android/voicemail/impl/DialerVvmConfigManager.java index 7fa960e34..99c95ddce 100644 --- a/java/com/android/voicemail/impl/DialerVvmConfigManager.java +++ b/java/com/android/voicemail/impl/DialerVvmConfigManager.java @@ -23,7 +23,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.util.ArrayMap; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.voicemail.impl.utils.XmlUtils; import com.google.common.collect.ComparisonChain; import java.io.IOException; @@ -133,7 +133,8 @@ public class DialerVvmConfigManager { PersistableBundle bundle = (PersistableBundle) object; if (bundle.containsKey(KEY_FEATURE_FLAG_NAME) - && !ConfigProviderBindings.get(context) + && !ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean(bundle.getString(KEY_FEATURE_FLAG_NAME), false)) { continue; } diff --git a/java/com/android/voicemail/impl/VoicemailClientImpl.java b/java/com/android/voicemail/impl/VoicemailClientImpl.java index 187ded932..36e5a6c58 100644 --- a/java/com/android/voicemail/impl/VoicemailClientImpl.java +++ b/java/com/android/voicemail/impl/VoicemailClientImpl.java @@ -30,7 +30,7 @@ import android.telecom.PhoneAccountHandle; import android.telephony.TelephonyManager; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.voicemail.PinChanger; import com.android.voicemail.VisualVoicemailTypeExtensions; import com.android.voicemail.VoicemailClient; @@ -105,7 +105,9 @@ public class VoicemailClientImpl implements VoicemailClient { return false; } - if (!ConfigProviderBindings.get(context).getBoolean(ALLOW_VOICEMAIL_ARCHIVE, false)) { + if (!ConfigProviderComponent.get(context) + .getConfigProvider() + .getBoolean(ALLOW_VOICEMAIL_ARCHIVE, false)) { LogUtil.i( "VoicemailClientImpl.isVoicemailArchiveAllowed", "feature disabled by config: %s", diff --git a/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java b/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java index ce5094f1a..6ac233729 100644 --- a/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java +++ b/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java @@ -31,7 +31,7 @@ import android.text.Html; import android.text.Spanned; import android.text.style.URLSpan; import android.util.ArrayMap; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.voicemail.impl.ActivationTask; import com.android.voicemail.impl.Assert; import com.android.voicemail.impl.OmtpEvents; @@ -312,7 +312,8 @@ public class Vvm3Subscriber { @VisibleForTesting static List<Pattern> getSubscribeLinkPatterns(Context context) { String patternsJsonString = - ConfigProviderBindings.get(context) + ConfigProviderComponent.get(context) + .getConfigProvider() .getString( VVM3_SUBSCRIBE_LINK_PATTERNS_JSON_ARRAY, VVM3_SUBSCRIBE_LINK_DEFAULT_PATTERNS); List<Pattern> patterns = new ArrayList<>(); diff --git a/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java b/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java index 54a1ae4d4..66bf16c24 100644 --- a/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java +++ b/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java @@ -17,7 +17,7 @@ package com.android.voicemail.impl.transcribe; import android.content.Context; import android.os.Build; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderComponent; import java.util.concurrent.TimeUnit; /** Provides configuration values needed to connect to the transcription server. */ @@ -30,20 +30,23 @@ public class TranscriptionConfigProvider { public boolean isVoicemailTranscriptionAvailable() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O - && ConfigProviderBindings.get(context) + && ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("voicemail_transcription_available", false); } public String getServerAddress() { // Private voicemail transcription service - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getString( "voicemail_transcription_server_address", "voicemailtranscription-pa.googleapis.com"); } public String getApiKey() { // Android API key restricted to com.google.android.dialer - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getString( "voicemail_transcription_client_api_key", "AIzaSyAXdDnif6B7sBYxU8hzw9qAp3pRPVHs060"); } @@ -53,47 +56,55 @@ public class TranscriptionConfigProvider { } public boolean shouldUsePlaintext() { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("voicemail_transcription_server_use_plaintext", false); } public boolean shouldUseSyncApi() { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("voicemail_transcription_server_use_sync_api", false); } public long getMaxTranscriptionRetries() { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getLong("voicemail_transcription_max_transcription_retries", 2L); } public int getMaxGetTranscriptPolls() { return (int) - ConfigProviderBindings.get(context) + ConfigProviderComponent.get(context) + .getConfigProvider() .getLong("voicemail_transcription_max_get_transcript_polls", 20L); } public long getInitialGetTranscriptPollDelayMillis() { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getLong( "voicemail_transcription_get_initial_transcript_poll_delay_millis", TimeUnit.SECONDS.toMillis(1)); } public long getMaxGetTranscriptPollTimeMillis() { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getLong( "voicemail_transcription_get_max_transcript_poll_time_millis", TimeUnit.MINUTES.toMillis(20)); } public boolean isVoicemailDonationAvailable() { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("voicemail_transcription_donation_available", false); } public boolean useClientGeneratedVoicemailIds() { - return ConfigProviderBindings.get(context) + return ConfigProviderComponent.get(context) + .getConfigProvider() .getBoolean("voicemail_transcription_client_generated_voicemail_ids", false); } |