From 122fb0b6c58774c75e06cbf786d0f366b674c163 Mon Sep 17 00:00:00 2001 From: linyuh Date: Mon, 26 Mar 2018 13:35:32 -0700 Subject: Remove obsolete methods in CompatUtils and rename it as "LocaleUtils". Test: Existing tests PiperOrigin-RevId: 190516504 Change-Id: I5fa9e123b45beb9728257ecd160a348fb3f4732c --- java/com/android/dialer/app/DialtactsActivity.java | 6 +- .../app/calllog/CallLogListItemViewHolder.java | 5 +- .../dialer/app/filterednumber/NumbersAdapter.java | 5 +- .../app/list/PhoneFavoriteSquareTileView.java | 22 ++---- java/com/android/dialer/compat/CompatUtils.java | 83 ---------------------- .../dialer/dialpadview/DialpadCharMappings.java | 6 +- .../android/dialer/dialpadview/DialpadView.java | 4 +- java/com/android/dialer/i18n/LocaleUtils.java | 33 +++++++++ .../dialer/main/impl/OldMainActivityPeer.java | 6 +- .../impl/PhoneNumberGeoUtilImpl.java | 4 +- .../dialer/phonenumberutil/PhoneNumberHelper.java | 4 +- .../smartdial/map/CompositeSmartDialMap.java | 4 +- java/com/android/dialer/util/CallUtil.java | 15 ++-- java/com/android/incallui/InCallActivity.java | 5 +- java/com/android/incallui/VideoCallPresenter.java | 33 ++------- 15 files changed, 69 insertions(+), 166 deletions(-) delete mode 100644 java/com/android/dialer/compat/CompatUtils.java create mode 100644 java/com/android/dialer/i18n/LocaleUtils.java (limited to 'java') 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 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/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/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 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); } } -- cgit v1.2.3