diff options
19 files changed, 104 insertions, 200 deletions
diff --git a/java/com/android/dialer/app/DialtactsActivity.java b/java/com/android/dialer/app/DialtactsActivity.java index 3d61f7371..9057cd9f9 100644 --- a/java/com/android/dialer/app/DialtactsActivity.java +++ b/java/com/android/dialer/app/DialtactsActivity.java @@ -92,7 +92,6 @@ 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.compat.CompatUtils; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.contactsfragment.ContactsFragment; @@ -103,6 +102,7 @@ import com.android.dialer.dialpadview.DialpadFragment; import com.android.dialer.dialpadview.DialpadFragment.DialpadListener; import com.android.dialer.dialpadview.DialpadFragment.LastOutgoingCallCallback; import com.android.dialer.duo.DuoComponent; +import com.android.dialer.i18n.LocaleUtils; import com.android.dialer.interactions.PhoneNumberInteraction; import com.android.dialer.interactions.PhoneNumberInteraction.InteractionErrorCode; import com.android.dialer.logging.DialerImpression; @@ -538,7 +538,7 @@ public class DialtactsActivity extends TransactionSafeActivity // (1) the activity is not recreated with a new configuration, or // (2) the activity is recreated with a new configuration but the change is a language change. boolean isLanguageChanged = - !CompatUtils.getLocale(this).getISO3Language().equals(savedLanguageCode); + !LocaleUtils.getLocale(this).getISO3Language().equals(savedLanguageCode); if (!wasConfigurationChange || isLanguageChanged) { dialerDatabaseHelper.startSmartDialUpdateThread(/* forceUpdate = */ isLanguageChanged); } @@ -638,7 +638,7 @@ public class DialtactsActivity extends TransactionSafeActivity super.onSaveInstanceState(outState); outState.putString(KEY_SEARCH_QUERY, searchQuery); outState.putString(KEY_DIALPAD_QUERY, dialpadQuery); - outState.putString(KEY_SAVED_LANGUAGE_CODE, CompatUtils.getLocale(this).getISO3Language()); + outState.putString(KEY_SAVED_LANGUAGE_CODE, LocaleUtils.getLocale(this).getISO3Language()); outState.putBoolean(KEY_IN_REGULAR_SEARCH_UI, inRegularSearch); outState.putBoolean(KEY_IN_DIALPAD_SEARCH_UI, inDialpadSearch); outState.putBoolean(KEY_IN_NEW_SEARCH_UI, inNewSearch); diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 8fbc459ca..3f7def953 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -71,7 +71,6 @@ 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.compat.CompatUtils; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.contactphoto.ContactPhotoManager; @@ -309,9 +308,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } quickContactView.setOverlay(null); - if (CompatUtils.hasPrioritizedMimeType()) { - quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); - } + quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); primaryActionButtonView.setOnClickListener(this); primaryActionView.setOnClickListener(this.expandCollapseListener); if (this.voicemailPlaybackPresenter != null diff --git a/java/com/android/dialer/app/filterednumber/NumbersAdapter.java b/java/com/android/dialer/app/filterednumber/NumbersAdapter.java index 3acb204e0..2c08558ec 100644 --- a/java/com/android/dialer/app/filterednumber/NumbersAdapter.java +++ b/java/com/android/dialer/app/filterednumber/NumbersAdapter.java @@ -27,7 +27,6 @@ import android.widget.QuickContactBadge; import android.widget.SimpleCursorAdapter; import android.widget.TextView; import com.android.dialer.app.R; -import com.android.dialer.compat.CompatUtils; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.contactphoto.ContactPhotoManager.DefaultImageRequest; import com.android.dialer.lettertile.LetterTileDrawable; @@ -63,9 +62,7 @@ public class NumbersAdapter extends SimpleCursorAdapter { final QuickContactBadge quickContactBadge = (QuickContactBadge) view.findViewById(R.id.quick_contact_photo); quickContactBadge.setOverlay(null); - if (CompatUtils.hasPrioritizedMimeType()) { - quickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); - } + quickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); ContactInfo info = contactInfoHelper.lookupNumber(number, countryIso); if (info == null) { diff --git a/java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java index 6096ca872..6b41547c2 100644 --- a/java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java +++ b/java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java @@ -25,7 +25,6 @@ import android.widget.ImageButton; import android.widget.TextView; import com.android.contacts.common.list.ContactEntry; import com.android.dialer.app.R; -import com.android.dialer.compat.CompatUtils; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; import com.android.dialer.widget.BidiTextView; @@ -64,21 +63,12 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView { } private void launchQuickContact() { - if (CompatUtils.hasPrioritizedMimeType()) { - QuickContact.showQuickContact( - getContext(), - PhoneFavoriteSquareTileView.this, - getLookupUri(), - null, - Phone.CONTENT_ITEM_TYPE); - } else { - QuickContact.showQuickContact( - getContext(), - PhoneFavoriteSquareTileView.this, - getLookupUri(), - QuickContact.MODE_LARGE, - null); - } + QuickContact.showQuickContact( + getContext(), + PhoneFavoriteSquareTileView.this, + getLookupUri(), + null, + Phone.CONTENT_ITEM_TYPE); } @Override diff --git a/java/com/android/dialer/compat/CompatUtils.java b/java/com/android/dialer/compat/CompatUtils.java deleted file mode 100644 index f0039e930..000000000 --- a/java/com/android/dialer/compat/CompatUtils.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2015 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.compat; - -import android.content.Context; -import android.os.LocaleList; -import java.util.Locale; - -/** TODO(linyuh): Remove deprecated methods and rename this class. */ -public final class CompatUtils { - - /** PrioritizedMimeType is added in API level 23. */ - @Deprecated - public static boolean hasPrioritizedMimeType() { - return true; - } - - /** - * Determines if this version is compatible with multi-SIM and the phone account APIs. Can also - * force the version to be lower through SdkVersionOverride. - * - * @return {@code true} if multi-SIM capability is available, {@code false} otherwise. - */ - @Deprecated - public static boolean isMSIMCompatible() { - return true; - } - - /** - * Determines if this version is compatible with video calling. Can also force the version to be - * lower through SdkVersionOverride. - * - * @return {@code true} if video calling is allowed, {@code false} otherwise. - */ - @Deprecated - public static boolean isVideoCompatible() { - return true; - } - - /** - * Determines if this version is capable of using presence checking for video calling. Support for - * video call presence indication is added in SDK 24. - * - * @return {@code true} if video presence checking is allowed, {@code false} otherwise. - */ - @Deprecated - public static boolean isVideoPresenceCompatible() { - return true; - } - - /** - * Determines if this version is compatible with call subject. Can also force the version to be - * lower through SdkVersionOverride. - * - * @return {@code true} if call subject is a feature on this device, {@code false} otherwise. - */ - @Deprecated - public static boolean isCallSubjectCompatible() { - return true; - } - - /** Returns locale of the device. */ - public static Locale getLocale(Context context) { - LocaleList localList = context.getResources().getConfiguration().getLocales(); - if (!localList.isEmpty()) { - return localList.get(0); - } - return Locale.getDefault(); - } -} diff --git a/java/com/android/dialer/dialpadview/DialpadCharMappings.java b/java/com/android/dialer/dialpadview/DialpadCharMappings.java index 15793a53f..11975e6ac 100644 --- a/java/com/android/dialer/dialpadview/DialpadCharMappings.java +++ b/java/com/android/dialer/dialpadview/DialpadCharMappings.java @@ -20,7 +20,7 @@ import android.content.Context; import android.support.annotation.NonNull; import android.support.v4.util.SimpleArrayMap; import com.android.dialer.common.Assert; -import com.android.dialer.compat.CompatUtils; +import com.android.dialer.i18n.LocaleUtils; /** A class containing character mappings for the dialpad. */ public class DialpadCharMappings { @@ -133,7 +133,7 @@ public class DialpadCharMappings { * null if no character-key map for the language code is defined. */ public static SimpleArrayMap<Character, Character> getCharToKeyMap(@NonNull Context context) { - return CHAR_TO_KEY_MAPS.get(CompatUtils.getLocale(context).getISO3Language()); + return CHAR_TO_KEY_MAPS.get(LocaleUtils.getLocale(context).getISO3Language()); } /** @@ -163,7 +163,7 @@ public class DialpadCharMappings { * preference or null if no key-characters map for the language code is defined. */ static String[] getKeyToCharsMap(@NonNull Context context) { - return KEY_TO_CHAR_MAPS.get(CompatUtils.getLocale(context).getISO3Language()); + return KEY_TO_CHAR_MAPS.get(LocaleUtils.getLocale(context).getISO3Language()); } /** Returns the default key-characters map (the one that uses the Latin alphabet). */ diff --git a/java/com/android/dialer/dialpadview/DialpadView.java b/java/com/android/dialer/dialpadview/DialpadView.java index 1bd8bad4f..0369b40ca 100644 --- a/java/com/android/dialer/dialpadview/DialpadView.java +++ b/java/com/android/dialer/dialpadview/DialpadView.java @@ -41,7 +41,7 @@ import android.widget.TextView; import com.android.dialer.animation.AnimUtils; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.compat.CompatUtils; +import com.android.dialer.i18n.LocaleUtils; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Locale; @@ -234,7 +234,7 @@ public class DialpadView extends LinearLayout { } private NumberFormat getNumberFormat() { - Locale locale = CompatUtils.getLocale(getContext()); + Locale locale = LocaleUtils.getLocale(getContext()); // Return the Persian number format if the current language is Persian. return "fas".equals(locale.getISO3Language()) diff --git a/java/com/android/dialer/i18n/LocaleUtils.java b/java/com/android/dialer/i18n/LocaleUtils.java new file mode 100644 index 000000000..0532cc36e --- /dev/null +++ b/java/com/android/dialer/i18n/LocaleUtils.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2015 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.i18n; + +import android.content.Context; +import android.os.LocaleList; +import java.util.Locale; + +/** Utilities for locale. */ +public final class LocaleUtils { + + /** Returns the default locale of the device. */ + public static Locale getLocale(Context context) { + LocaleList localList = context.getResources().getConfiguration().getLocales(); + if (!localList.isEmpty()) { + return localList.get(0); + } + return Locale.getDefault(); + } +} diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index 2db331a81..70444bd8c 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -69,7 +69,6 @@ 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.compat.CompatUtils; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.contactsfragment.ContactsFragment; @@ -82,6 +81,7 @@ import com.android.dialer.dialpadview.DialpadFragment.DialpadListener; import com.android.dialer.dialpadview.DialpadFragment.LastOutgoingCallCallback; import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListener; import com.android.dialer.duo.DuoComponent; +import com.android.dialer.i18n.LocaleUtils; import com.android.dialer.interactions.PhoneNumberInteraction; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; @@ -419,7 +419,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen // Start the thread that updates the smart dial database if the activity is recreated with a // language change. boolean forceUpdate = - !CompatUtils.getLocale(activity).getISO3Language().equals(savedLanguageCode); + !LocaleUtils.getLocale(activity).getISO3Language().equals(savedLanguageCode); Database.get(activity).getDatabaseHelper(activity).startSmartDialUpdateThread(forceUpdate); showPostCallPrompt(); @@ -476,7 +476,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void onSaveInstanceState(Bundle bundle) { - bundle.putString(KEY_SAVED_LANGUAGE_CODE, CompatUtils.getLocale(activity).getISO3Language()); + bundle.putString(KEY_SAVED_LANGUAGE_CODE, LocaleUtils.getLocale(activity).getISO3Language()); bundle.putInt(KEY_CURRENT_TAB, bottomNav.getSelectedTab()); searchController.onSaveInstanceState(bundle); } diff --git a/java/com/android/dialer/oem/res/values-mcc311-mnc910/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc311-mnc910/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc311-mnc910/motorola_config.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 + --> + +<resources> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java b/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java index fb28ed588..89fe04ab2 100644 --- a/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java +++ b/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java @@ -19,7 +19,7 @@ package com.android.dialer.phonenumbergeoutil.impl; import android.content.Context; import android.text.TextUtils; import com.android.dialer.common.LogUtil; -import com.android.dialer.compat.CompatUtils; +import com.android.dialer.i18n.LocaleUtils; import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtil; import com.google.i18n.phonenumbers.NumberParseException; import com.google.i18n.phonenumbers.PhoneNumberUtil; @@ -45,7 +45,7 @@ public class PhoneNumberGeoUtilImpl implements PhoneNumberGeoUtil { PhoneNumberUtil util = PhoneNumberUtil.getInstance(); PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance(); - Locale locale = CompatUtils.getLocale(context); + Locale locale = LocaleUtils.getLocale(context); Phonenumber.PhoneNumber pn = null; try { LogUtil.v( diff --git a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java index 33a94ea74..df7716cfd 100644 --- a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java +++ b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java @@ -32,8 +32,8 @@ import android.text.TextDirectionHeuristics; import android.text.TextUtils; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.compat.CompatUtils; import com.android.dialer.compat.telephony.TelephonyManagerCompat; +import com.android.dialer.i18n.LocaleUtils; import com.android.dialer.oem.MotorolaUtils; import com.android.dialer.oem.PhoneNumberUtilsAccessor; import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtilComponent; @@ -249,7 +249,7 @@ public class PhoneNumberHelper { TelephonyManagerCompat.getNetworkCountryIsoForPhoneAccountHandle( context, phoneAccountHandle); if (TextUtils.isEmpty(countryIso)) { - countryIso = CompatUtils.getLocale(context).getCountry(); + countryIso = LocaleUtils.getLocale(context).getCountry(); LogUtil.i( "PhoneNumberHelper.getCurrentCountryIso", "No CountryDetector; falling back to countryIso based on locale: " + countryIso); diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java index 64c8b1091..505f1c6b1 100644 --- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java +++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java @@ -148,7 +148,7 @@ public final class NewSearchFragment extends Fragment LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_search, parent, false); adapter = new SearchAdapter(getContext(), new SearchCursorManager(), this); - adapter.setQuery(query, rawNumber, callInitiationType); + adapter.setQuery(query, rawNumber); adapter.setSearchActions(getActions()); adapter.setZeroSuggestVisible(getArguments().getBoolean(KEY_SHOW_ZERO_SUGGEST)); emptyContentView = view.findViewById(R.id.empty_view); @@ -263,7 +263,7 @@ public final class NewSearchFragment extends Fragment this.query = query; this.callInitiationType = callInitiationType; if (adapter != null) { - adapter.setQuery(query, rawNumber, callInitiationType); + adapter.setQuery(query, rawNumber); adapter.setSearchActions(getActions()); adapter.setZeroSuggestVisible(isRegularSearch()); loadCp2ContactsCursor(); diff --git a/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java b/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java index 76c71d6ac..7315e8999 100644 --- a/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java +++ b/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java @@ -26,13 +26,10 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.TextView; -import com.android.dialer.callintent.CallInitiationType; -import com.android.dialer.callintent.CallIntentBuilder; -import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.common.Assert; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; -import com.android.dialer.precall.PreCall; +import com.android.dialer.searchfragment.common.RowClickListener; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; import java.lang.annotation.Retention; @@ -70,25 +67,25 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On private final Context context; private final ImageView actionImage; private final TextView actionText; + private final RowClickListener listener; private @Action int action; private int position; private String query; - private CallInitiationType.Type callInitiationType; - SearchActionViewHolder(View view) { + SearchActionViewHolder(View view, RowClickListener listener) { super(view); context = view.getContext(); actionImage = view.findViewById(R.id.search_action_image); actionText = view.findViewById(R.id.search_action_text); + this.listener = listener; view.setOnClickListener(this); } - void setAction(@Action int action, int position, String query, CallInitiationType.Type type) { + void setAction(@Action int action, int position, String query) { this.action = action; this.position = position; this.query = query; - this.callInitiationType = type; switch (action) { case Action.ADD_TO_CONTACT: actionText.setText(R.string.search_shortcut_add_to_contact); @@ -113,7 +110,6 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On case Action.INVALID: default: throw Assert.createIllegalStateFailException("Invalid action: " + action); - } } @@ -140,14 +136,7 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On break; case Action.MAKE_VILTE_CALL: - CallSpecificAppData videoCallSpecificAppData = - CallSpecificAppData.newBuilder() - .setCallInitiationType(callInitiationType) - .setPositionOfSelectedSearchResult(position) - .setCharactersInSearchString(query.length()) - .build(); - PreCall.start( - context, new CallIntentBuilder(query, videoCallSpecificAppData).setIsVideoCall(true)); + listener.placeVideoCall(query, position); break; case Action.SEND_SMS: @@ -156,13 +145,7 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On break; case Action.MAKE_VOICE_CALL: - CallSpecificAppData voiceCallSpecificAppData = - CallSpecificAppData.newBuilder() - .setCallInitiationType(callInitiationType) - .setPositionOfSelectedSearchResult(position) - .setCharactersInSearchString(query.length()) - .build(); - PreCall.start(context, new CallIntentBuilder(query, voiceCallSpecificAppData)); + listener.placeVoiceCall(query, position); break; case Action.INVALID: diff --git a/java/com/android/dialer/searchfragment/list/SearchAdapter.java b/java/com/android/dialer/searchfragment/list/SearchAdapter.java index c5f36e902..805eaf524 100644 --- a/java/com/android/dialer/searchfragment/list/SearchAdapter.java +++ b/java/com/android/dialer/searchfragment/list/SearchAdapter.java @@ -26,7 +26,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.common.Assert; import com.android.dialer.searchfragment.common.RowClickListener; import com.android.dialer.searchfragment.common.SearchCursor; @@ -48,7 +47,6 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> { // Raw query number from dialpad, which may contain special character such as "+". This is used // for actions to add contact or send sms. private String rawNumber; - private CallInitiationType.Type callInitiationType; private OnClickListener allowClickListener; private OnClickListener dismissClickListener; private RowClickListener rowClickListener; @@ -83,7 +81,8 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> { rowClickListener); case RowType.SEARCH_ACTION: return new SearchActionViewHolder( - LayoutInflater.from(context).inflate(R.layout.search_action_layout, root, false)); + LayoutInflater.from(context).inflate(R.layout.search_action_layout, root, false), + rowClickListener); case RowType.LOCATION_REQUEST: return new LocationPermissionViewHolder( LayoutInflater.from(context).inflate(R.layout.location_permission_row, root, false), @@ -117,8 +116,7 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> { .setAction( searchCursorManager.getSearchAction(position), position, - TextUtils.isEmpty(rawNumber) ? query : rawNumber, - callInitiationType); + TextUtils.isEmpty(rawNumber) ? query : rawNumber); } else if (holder instanceof LocationPermissionViewHolder) { // No-op } else { @@ -148,17 +146,16 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> { /** * @param visible If true and query is empty, the adapter won't show any list elements. - * @see #setQuery(String, String, CallInitiationType.Type) + * @see #setQuery(String, String) * @see #getItemCount() */ public void setZeroSuggestVisible(boolean visible) { showZeroSuggest = visible; } - public void setQuery(String query, @Nullable String rawNumber, CallInitiationType.Type type) { + public void setQuery(String query, @Nullable String rawNumber) { this.query = query; this.rawNumber = rawNumber; - this.callInitiationType = type; if (searchCursorManager.setQuery(query)) { notifyDataSetChanged(); } diff --git a/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java b/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java index 112cb19b6..76c05c5a2 100644 --- a/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java +++ b/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java @@ -19,7 +19,7 @@ package com.android.dialer.smartdial.map; import android.content.Context; import android.support.annotation.VisibleForTesting; import android.support.v4.util.SimpleArrayMap; -import com.android.dialer.compat.CompatUtils; +import com.android.dialer.i18n.LocaleUtils; import com.google.common.base.Optional; /** @@ -157,7 +157,7 @@ public class CompositeSmartDialMap { @VisibleForTesting static Optional<SmartDialMap> getExtraMap(Context context) { - String languageCode = CompatUtils.getLocale(context).getISO3Language(); + String languageCode = LocaleUtils.getLocale(context).getISO3Language(); return EXTRA_MAPS.containsKey(languageCode) ? Optional.of(EXTRA_MAPS.get(languageCode)) : Optional.absent(); diff --git a/java/com/android/dialer/util/CallUtil.java b/java/com/android/dialer/util/CallUtil.java index 22cab87cc..89af0b9bb 100644 --- a/java/com/android/dialer/util/CallUtil.java +++ b/java/com/android/dialer/util/CallUtil.java @@ -16,13 +16,13 @@ package com.android.dialer.util; +import android.annotation.SuppressLint; import android.content.Context; import android.net.Uri; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import com.android.dialer.common.LogUtil; -import com.android.dialer.compat.CompatUtils; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import java.util.List; @@ -62,9 +62,9 @@ public class CallUtil { * @param context The context * @return A bit-mask describing the current video capabilities. */ + @SuppressLint("MissingPermission") public static int getVideoCallingAvailability(Context context) { - if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE) - || !CompatUtils.isVideoCompatible()) { + if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE)) { return VIDEO_CALLING_DISABLED; } TelecomManager telecommMgr = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); @@ -77,11 +77,6 @@ public class CallUtil { PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle); if (account != null) { if (account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING)) { - // Builds prior to N do not have presence support. - if (!CompatUtils.isVideoPresenceCompatible()) { - return VIDEO_CALLING_ENABLED; - } - int videoCapabilities = VIDEO_CALLING_ENABLED; if (account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)) { videoCapabilities |= VIDEO_CALLING_PRESENCE; @@ -128,9 +123,9 @@ public class CallUtil { * @return {@code true} if one of the call capable phone accounts supports calling with a subject * specified, {@code false} otherwise. */ + @SuppressLint("MissingPermission") public static boolean isCallWithSubjectSupported(Context context) { - if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE) - || !CompatUtils.isCallSubjectCompatible()) { + if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE)) { return false; } TelecomManager telecommMgr = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java index 3236e160a..8144ddb10 100644 --- a/java/com/android/incallui/InCallActivity.java +++ b/java/com/android/incallui/InCallActivity.java @@ -60,7 +60,6 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.ThreadUtil; -import com.android.dialer.compat.CompatUtils; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.logging.DialerImpression.Type; import com.android.dialer.logging.Logger; @@ -321,9 +320,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity // InCallActivity is responsible for disconnecting a new outgoing call if there is no way of // making it (i.e. no valid call capable accounts). - // If the version is not MSIM compatible, ignore this code. - if (CompatUtils.isMSIMCompatible() - && InCallPresenter.isCallWithNoValidAccounts(outgoingCall)) { + if (InCallPresenter.isCallWithNoValidAccounts(outgoingCall)) { LogUtil.i( "InCallActivity.internalResolveIntent", "Call with no valid accounts, disconnecting"); outgoingCall.disconnect(); diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java index f5d681c74..050ce9859 100644 --- a/java/com/android/incallui/VideoCallPresenter.java +++ b/java/com/android/incallui/VideoCallPresenter.java @@ -29,7 +29,6 @@ import android.view.Surface; import android.view.SurfaceView; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.compat.CompatUtils; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.util.PermissionsUtil; import com.android.incallui.InCallPresenter.InCallDetailsListener; @@ -164,10 +163,7 @@ public class VideoCallPresenter * @param callState The current call state. * @return {@code true} if the incoming video surface should be shown, {@code false} otherwise. */ - public static boolean showIncomingVideo(int videoState, int callState) { - if (!CompatUtils.isVideoCompatible()) { - return false; - } + static boolean showIncomingVideo(int videoState, int callState) { boolean isPaused = VideoProfile.isPaused(videoState); boolean isCallActive = callState == DialerCall.State.ACTIVE; @@ -187,17 +183,13 @@ public class VideoCallPresenter * @return {@code true} if the the outgoing video surface should be shown, {@code false} * otherwise. */ - public static boolean showOutgoingVideo( + private static boolean showOutgoingVideo( Context context, int videoState, int sessionModificationState) { if (!VideoUtils.hasCameraPermissionAndShownPrivacyToast(context)) { LogUtil.i("VideoCallPresenter.showOutgoingVideo", "Camera permission is disabled by user."); return false; } - if (!CompatUtils.isVideoCompatible()) { - return false; - } - return VideoProfile.isTransmissionEnabled(videoState) || isVideoUpgrade(sessionModificationState); } @@ -309,12 +301,6 @@ public class VideoCallPresenter LogUtil.v("VideoCallPresenter.onVideoCallScreenUiReady", ""); Assert.checkState(!isVideoCallScreenUiReady); - // Do not register any listeners if video calling is not compatible to safeguard against - // any accidental calls of video calling code. - if (!CompatUtils.isVideoCompatible()) { - return; - } - deviceOrientation = InCallOrientationEventListener.getCurrentOrientation(); // Register for call state changes last @@ -345,10 +331,6 @@ public class VideoCallPresenter LogUtil.v("VideoCallPresenter.onVideoCallScreenUiUnready", ""); Assert.checkState(isVideoCallScreenUiReady); - if (!CompatUtils.isVideoCompatible()) { - return; - } - cancelAutoFullScreen(); InCallPresenter.getInstance().removeListener(this); @@ -1273,7 +1255,7 @@ public class VideoCallPresenter } private static boolean isBidirectionalVideoCall(DialerCall call) { - return CompatUtils.isVideoCompatible() && VideoProfile.isBidirectional(call.getVideoState()); + return VideoProfile.isBidirectional(call.getVideoState()); } private static boolean isIncomingVideoCall(DialerCall call) { @@ -1299,10 +1281,6 @@ public class VideoCallPresenter } private static boolean isAudioCall(DialerCall call) { - if (!CompatUtils.isVideoCompatible()) { - return true; - } - return call != null && VideoProfile.isAudioOnly(call.getVideoState()); } @@ -1311,8 +1289,7 @@ public class VideoCallPresenter } private static boolean isVideoCall(int videoState) { - return CompatUtils.isVideoCompatible() - && (VideoProfile.isTransmissionEnabled(videoState) - || VideoProfile.isReceptionEnabled(videoState)); + return VideoProfile.isTransmissionEnabled(videoState) + || VideoProfile.isReceptionEnabled(videoState); } } |