From b00193c374c43e1e59f32b3f1087119e252dd746 Mon Sep 17 00:00:00 2001 From: Michael W Date: Sat, 29 Jul 2023 18:53:50 +0200 Subject: [PATCH 01/36] Dialer: Migrate to AndroidX Change-Id: I3776eac06f301ea61ce6adb5f0678937a4cc040d --- Android.mk | 20 ++- .../common/ContactTileLoaderFactory.java | 5 +- .../common/dialog/CallSubjectDialog.java | 9 +- .../common/dialog/ClearFrequentsDialog.java | 9 +- .../list/ContactListFilterController.java | 6 +- .../contacts/common/list/ViewPagerTabs.java | 7 +- .../common/model/account/AccountType.java | 6 +- .../SelectPhoneAccountDialogFragment.java | 5 +- .../dialer/app/AccountSelectionActivity.java | 10 +- .../android/dialer/app/AndroidManifest.xml | 7 +- .../app/calllog/BlockReportSpamListener.java | 5 +- .../dialer/app/calllog/CallLogActivity.java | 22 +-- .../dialer/app/calllog/CallLogAdapter.java | 14 +- .../app/calllog/CallLogAlertManager.java | 7 +- .../dialer/app/calllog/CallLogFragment.java | 66 ++++----- .../calllog/CallLogListItemViewHolder.java | 14 +- .../app/calllog/CallLogModalAlertManager.java | 4 +- .../calllog/CallLogNotificationsActivity.java | 5 +- .../CallLogNotificationsQueryHelper.java | 6 +- .../app/calllog/ClearCallLogDialog.java | 12 +- .../app/calllog/GroupingListAdapter.java | 4 +- .../MissedCallNotificationReceiver.java | 5 +- .../app/calllog/MissedCallNotifier.java | 6 +- .../app/calllog/PhoneCallDetailsHelper.java | 3 +- .../VisualVoicemailCallLogFragment.java | 14 +- .../app/calllog/VisualVoicemailNotifier.java | 4 +- .../app/contactinfo/ContactPhotoLoader.java | 6 +- .../ExpirableCacheHeadlessFragment.java | 9 +- .../android/dialer/app/list/RemoveView.java | 5 +- .../app/res/layout/call_log_activity.xml | 3 +- .../app/res/layout/call_log_fragment.xml | 3 +- .../app/res/layout/call_log_list_item.xml | 10 +- .../res/layout/voicemail_playback_layout.xml | 6 +- .../dialer/app/res/xml/sound_settings.xml | 15 +- .../settings/AppCompatPreferenceActivity.java | 6 +- .../settings/DefaultRingtonePreference.java | 4 +- .../settings/DialerPreferenceFragment.java | 10 +- .../app/settings/DialerSettingsActivity.java | 4 +- .../DisplayOptionsSettingsFragment.java | 6 +- .../PhoneAccountSelectionFragment.java | 22 ++- .../app/settings/SoundSettingsFragment.java | 59 ++++---- .../LegacyVoicemailNotificationReceiver.java | 5 +- .../voicemail/VoicemailPlaybackLayout.java | 5 +- .../voicemail/VoicemailPlaybackPresenter.java | 21 +-- .../ui/AssistedDialingSettingActivity.java | 6 +- .../ui/AssistedDialingSettingFragment.java | 21 +-- .../ui/res/xml/assisted_dialing_setting.xml | 3 +- .../FilteredNumberAsyncQueryHandler.java | 2 +- .../BlockReportSpamDialogs.java | 5 +- .../ShowBlockReportSpamDialogNotifier.java | 5 +- .../ShowBlockReportSpamDialogReceiver.java | 4 +- .../calldetails/CallDetailsActivity.java | 17 ++- .../CallDetailsActivityCommon.java | 28 ++-- .../calldetails/CallDetailsAdapter.java | 6 +- .../calldetails/CallDetailsAdapterCommon.java | 5 +- .../calldetails/CallDetailsCursorLoader.java | 5 +- .../CallDetailsEntryViewHolder.java | 8 +- .../CallDetailsFooterViewHolder.java | 4 +- .../CallDetailsHeaderViewHolder.java | 4 +- .../calldetails/OldCallDetailsAdapter.java | 6 +- .../calldetails/ReportDialogFragment.java | 11 +- .../res/layout/call_details_activity.xml | 5 +- .../res/layout/call_details_footer.xml | 22 +-- .../res/layout/contact_container.xml | 6 +- .../dialer/calllog/CallLogFramework.java | 6 +- .../dialer/calllog/ClearMissedCalls.java | 7 +- .../RefreshAnnotatedCallLogNotifier.java | 6 +- .../ui/AnnotatedCallLogCursorLoader.java | 5 +- .../dialer/callstats/CallStatsAdapter.java | 4 +- .../callstats/CallStatsDetailActivity.java | 8 +- .../dialer/callstats/CallStatsFragment.java | 17 +-- .../CallStatsListItemViewHolder.java | 6 +- .../callstats/DoubleDatePickerDialog.java | 12 +- .../res/layout/call_stats_detail.xml | 6 +- .../res/layout/call_stats_detail_info.xml | 13 +- .../res/layout/call_stats_fragment.xml | 11 +- .../android/dialer/common/FragmentUtils.java | 4 +- .../DefaultDialerExecutorFactory.java | 6 +- .../common/concurrent/DialerExecutor.java | 3 +- .../concurrent/DialerExecutorComponent.java | 16 +-- .../concurrent/DialerExecutorFactory.java | 4 +- .../concurrent/DialerUiTaskFragment.java | 6 +- .../common/concurrent/SupportUiListener.java | 7 +- .../dialer/common/concurrent/UiListener.java | 7 +- .../bottomsheet/BottomSheetStateCompat.java | 3 +- .../contactphoto/ContactPhotoManagerImpl.java | 7 +- .../ContactDisplayPreferencesImpl.java | 7 +- .../res/layout/dialog_call_subject.xml | 4 +- .../AddContactViewHolder.java | 8 +- .../contactsfragment/ContactViewHolder.java | 4 +- .../contactsfragment/ContactsAdapter.java | 6 +- .../ContactsCursorLoader.java | 5 +- .../contactsfragment/ContactsFragment.java | 26 ++-- .../dialer/contactsfragment/FastScroller.java | 5 +- .../res/layout/add_contact_row.xml | 2 + .../res/layout/fragment_contacts.xml | 3 +- .../dialpadview/DialpadCharMappings.java | 3 +- .../dialer/dialpadview/DialpadFragment.java | 16 ++- .../dialer/dialpadview/DialpadTextView.java | 6 +- .../dialpadview/SpecialCharSequenceMgr.java | 14 +- .../res/layout-land/dialpad_fragment.xml | 3 +- .../dialer/dialpadview/res/layout/dialpad.xml | 19 +-- .../res/layout/dialpad_fragment.xml | 3 +- .../res/layout/dialpad_key_one.xml | 4 +- .../res/layout/dialpad_view_unthemed.xml | 12 +- .../dialer/helplines/HelplineActivity.java | 9 +- .../dialer/helplines/HelplineAdapter.java | 5 +- .../dialer/helplines/LoadHelplinesTask.java | 2 +- .../res/layout/activity_helplines.xml | 4 +- .../HistoryItemActionBottomSheet.java | 22 +-- .../res/layout/sheet_layout.xml | 5 +- .../interactions/PhoneNumberInteraction.java | 21 +-- .../dialer/location/CountryDetector.java | 6 +- .../dialer/lookup/LookupSettingsFragment.java | 22 +-- .../dialer/lookup/res/xml/lookup_settings.xml | 5 +- .../main/impl/DefaultDialerActivity.java | 3 +- .../dialer/main/impl/MainActivity.java | 12 +- .../main/impl/MainSearchController.java | 31 +++-- .../dialer/main/impl/OldMainActivityPeer.java | 130 +++++------------- .../main/impl/bottomnav/BottomNavBar.java | 3 + .../main/impl/bottomnav/BottomNavItem.java | 2 + .../bottomnav/MissedCallCountObserver.java | 7 +- .../main/impl/res/layout/main_activity.xml | 5 +- .../res/layout/promotion_bottom_sheet.xml | 7 +- .../dialer/main/impl/toolbar/MainToolbar.java | 5 +- .../main/impl/toolbar/MainToolbarMenu.java | 6 +- .../main/impl/toolbar/SearchBarListener.java | 4 +- .../PersistentLogFileHandler.java | 6 +- .../persistentlog/PersistentLogger.java | 4 +- .../cp2/Cp2DefaultDirectoryPhoneLookup.java | 7 +- .../phonenumberproto/PartitionedNumbers.java | 7 +- .../com/android/dialer/postcall/PostCall.java | 8 +- .../dialer/postcall/PostCallActivity.java | 3 +- .../LaunchPreCallActivity.java | 4 +- .../precall/impl/CallingAccountSelector.java | 6 +- .../dialer/precall/impl/PreCallActivity.java | 4 +- .../precall/impl/PreCallCoordinatorImpl.java | 9 +- .../android/dialer/proguard/proguard.flags | 2 +- .../dialer/proguard/proguard_base.flags | 5 +- .../android/dialer/promotion/Promotion.java | 5 +- .../dialer/rtt/RttTranscriptActivity.java | 14 +- .../dialer/rtt/RttTranscriptAdapter.java | 6 +- .../rtt/RttTranscriptMessageViewHolder.java | 8 +- .../res/layout/activity_rtt_transcript.xml | 3 +- .../common/QueryFilteringUtil.java | 4 +- .../common/res/layout/search_contact_row.xml | 12 +- .../cp2/ContactFilterCursor.java | 4 +- .../cp2/ContactTernarySearchTree.java | 5 +- .../cp2/SearchContactViewHolder.java | 8 +- .../cp2/SearchContactsCursorLoader.java | 3 +- .../directories/DirectoriesCursorLoader.java | 33 ++--- .../DirectoryContactViewHolder.java | 5 +- .../DirectoryContactsCursorLoader.java | 4 +- .../searchfragment/list/HeaderViewHolder.java | 6 +- .../list/NewSearchFragment.java | 32 ++--- .../list/SearchActionViewHolder.java | 4 +- .../searchfragment/list/SearchAdapter.java | 6 +- .../list/res/layout/fragment_search.xml | 3 +- .../list/res/layout/search_action_layout.xml | 2 + .../nearbyplaces/NearbyPlaceViewHolder.java | 5 +- .../NearbyPlacesCursorLoader.java | 3 +- .../res/layout/location_permission_row.xml | 5 +- .../dialer/shortcuts/CallContactActivity.java | 8 +- .../dialer/shortcuts/DynamicShortcuts.java | 4 +- .../dialer/shortcuts/PeriodicJobService.java | 4 +- .../dialer/shortcuts/PinnedShortcuts.java | 4 +- .../shortcuts/ShortcutUsageReporter.java | 3 +- .../android/dialer/simulator/Simulator.java | 3 +- .../impl/SimulatorDialogFragment.java | 6 +- .../dialer/simulator/impl/SimulatorImpl.java | 6 +- .../simulator/impl/SimulatorMainPortal.java | 5 +- .../simulator/impl/SimulatorVoiceCall.java | 3 +- .../smartdial/map/BulgarianSmartDialMap.java | 4 +- .../smartdial/map/CompositeSmartDialMap.java | 5 +- .../smartdial/map/LatinSmartDialMap.java | 4 +- .../smartdial/map/RussianSmartDialMap.java | 4 +- .../dialer/smartdial/map/SmartDialMap.java | 4 +- .../smartdial/map/UkrainianSmartDialMap.java | 4 +- .../smartdial/util/SmartDialPrefix.java | 6 +- .../android/dialer/speeddial/ContextMenu.java | 6 +- .../dialer/speeddial/DisambigDialog.java | 8 +- .../dialer/speeddial/FavoritesViewHolder.java | 8 +- .../dialer/speeddial/HeaderViewHolder.java | 3 +- .../dialer/speeddial/RemoveViewHolder.java | 4 +- .../dialer/speeddial/SpeedDialAdapter.java | 14 +- .../dialer/speeddial/SpeedDialFragment.java | 14 +- .../speeddial/SuggestionViewHolder.java | 6 +- ...ialFavoritesViewHolderOnTouchListener.java | 11 +- .../SpeedDialItemTouchHelperCallback.java | 7 +- .../draghelper/SpeedDialLayoutManager.java | 4 +- .../res/layout/disambig_option_layout.xml | 6 +- .../layout/favorite_remove_view_layout.xml | 3 +- .../res/layout/fragment_speed_dial.xml | 3 +- .../res/layout/suggestion_row_layout.xml | 6 +- .../android/dialer/storage/StorageModule.java | 11 +- .../android/dialer/telecom/TelecomUtil.java | 4 +- .../dialer/util/DrawableConverter.java | 5 +- .../android/dialer/util/PermissionsUtil.java | 6 +- .../com/android/dialer/util/SettingsUtil.java | 8 +- .../dialer/util/TransactionSafeActivity.java | 7 +- .../error/OmtpVoicemailMessageCreator.java | 4 +- .../error/VoicemailTosMessageCreator.java | 4 +- .../voicemail_error_message_fragment.xml | 5 +- .../res/layout/voicemail_tos_fragment.xml | 3 +- .../CurrentVoicemailGreetingActivity.java | 7 +- .../voicemail/settings/RecordButton.java | 6 +- .../RecordVoicemailGreetingActivity.java | 4 +- .../settings/VoicemailChangePinActivity.java | 8 +- .../settings/VoicemailSettingsFragment.java | 35 +++-- .../settings/res/xml/voicemail_settings.xml | 5 +- .../VisualVoicemailEnabledChecker.java | 3 +- .../widget/DialerFloatingActionButton.java | 3 +- .../android/dialer/widget/DialerToolbar.java | 3 +- .../FloatingActionButtonController.java | 6 +- .../dialer/widget/LockableViewPager.java | 4 +- .../dialer/widget/MessageFragment.java | 3 +- .../widget/res/layout/contact_photo_view.xml | 8 +- .../widget/res/layout/fragment_message.xml | 4 +- .../incallui/AnswerScreenPresenter.java | 3 +- .../incallui/AudioRouteSelectorActivity.java | 3 +- .../android/incallui/CallButtonPresenter.java | 9 +- .../android/incallui/CallCardPresenter.java | 6 +- .../ConferenceParticipantListAdapter.java | 7 +- .../android/incallui/ContactInfoCache.java | 11 +- java/com/android/incallui/InCallActivity.java | 24 ++-- .../android/incallui/InCallDndHandler.java | 5 +- .../incallui/InCallVibrationHandler.java | 8 +- .../incallui/ManageConferenceActivity.java | 8 +- .../incallui/PostCharDialogActivity.java | 3 +- .../incallui/PostCharDialogFragment.java | 6 +- .../incallui/RttRequestDialogFragment.java | 4 +- .../TransactionSafeFragmentActivity.java | 5 +- .../incallui/answer/impl/AnswerFragment.java | 5 +- .../answer/impl/AnswerVideoCallScreen.java | 3 +- .../impl/CreateCustomSmsDialogFragment.java | 3 +- .../SelfManagedAnswerVideoCallScreen.java | 4 +- .../answer/impl/SmsBottomSheetFragment.java | 4 +- .../impl/answermethod/AnswerMethod.java | 3 +- .../answermethod/AnswerMethodFactory.java | 3 +- .../impl/answermethod/FlingUpDownMethod.java | 11 +- .../res/layout/swipe_up_down_method.xml | 6 +- .../incallui/answer/impl/proguard.flags | 2 +- .../answer/protocol/AnswerScreen.java | 4 +- .../AudioRouteSelectorDialogFragment.java | 4 +- .../android/incallui/baseui/BaseFragment.java | 6 +- .../callpending/CallPendingActivity.java | 5 +- .../contactgrid/ContactGridManager.java | 4 +- .../android/incallui/hold/OnHoldFragment.java | 3 +- .../incall/impl/ButtonChooserFactory.java | 6 +- .../incall/impl/InCallButtonGridFragment.java | 4 +- .../incallui/incall/impl/InCallFragment.java | 8 +- .../incall/impl/InCallPagerAdapter.java | 10 +- .../incallui/incall/impl/InCallPaginator.java | 9 +- .../incall/impl/MappedButtonConfig.java | 5 +- .../incall/protocol/InCallButtonUi.java | 3 +- .../incall/protocol/InCallScreen.java | 3 +- .../res/layout/caller_in_conference.xml | 3 +- .../incallui/rtt/impl/AdvisoryViewHolder.java | 5 +- .../incallui/rtt/impl/RttChatAdapter.java | 11 +- .../incallui/rtt/impl/RttChatFragment.java | 13 +- .../rtt/impl/RttChatMessageViewHolder.java | 8 +- .../rtt/impl/res/layout/frag_rtt_chat.xml | 8 +- .../rtt/impl/res/layout/rtt_banner.xml | 8 +- .../res/layout/rtt_transcript_advisory.xml | 8 +- .../incallui/rtt/protocol/RttCallScreen.java | 5 +- .../sessiondata/MultimediaFragment.java | 3 +- .../res/layout/fragment_composer_text.xml | 3 +- .../sessiondata/res/layout/fragment_spam.xml | 4 +- .../spam/SpamNotificationActivity.java | 11 +- ...InternationalCallOnWifiDialogActivity.java | 3 +- ...InternationalCallOnWifiDialogFragment.java | 5 +- .../impl/SurfaceViewVideoCallFragment.java | 9 +- .../video/impl/VideoCallFragment.java | 9 +- .../impl/VideoChargesAlertDialogFragment.java | 7 +- .../video/protocol/VideoCallScreen.java | 3 +- .../incallui/videotech/utils/VideoUtils.java | 3 +- .../android/voicemail/impl/OmtpService.java | 3 +- .../impl/PackageReplacedReceiver.java | 5 +- .../impl/VisualVoicemailPreferences.java | 5 +- .../voicemail/impl/VoicemailClientImpl.java | 21 +-- .../impl/configui/ConfigOverrideFragment.java | 42 ++++-- .../configui/res/xml/vvm_config_override.xml | 11 +- .../scheduling/TaskSchedulerJobService.java | 4 +- 283 files changed, 1390 insertions(+), 908 deletions(-) diff --git a/Android.mk b/Android.mk index 786d5a69b7..7a3e5cc5b8 100644 --- a/Android.mk +++ b/Android.mk @@ -53,7 +53,6 @@ LOCAL_AAPT_FLAGS += \ LOCAL_STATIC_JAVA_LIBRARIES := \ android-common \ - android-support-dynamic-animation \ dialer-commons-io-target \ dialer-dagger2-target \ dialer-disklrucache-target \ @@ -73,16 +72,15 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ volley \ org.lineageos.lib.phone \ androidx.annotation_annotation \ - -LOCAL_STATIC_ANDROID_LIBRARIES := \ - android-support-core-ui \ - $(ANDROID_SUPPORT_DESIGN_TARGETS) \ - android-support-transition \ - android-support-v13 \ - android-support-v4 \ - android-support-v7-appcompat \ - android-support-v7-cardview \ - android-support-v7-recyclerview \ + androidx.cardview_cardview \ + androidx.collection_collection \ + androidx.coordinatorlayout_coordinatorlayout \ + androidx.core_core \ + androidx.dynamicanimation_dynamicanimation \ + androidx.localbroadcastmanager_localbroadcastmanager \ + androidx.preference_preference \ + androidx.recyclerview_recyclerview \ + com.google.android.material_material LOCAL_JAVA_LIBRARIES := \ auto_value_annotations \ diff --git a/java/com/android/contacts/common/ContactTileLoaderFactory.java b/java/com/android/contacts/common/ContactTileLoaderFactory.java index 80eda882bb..c82b670cd0 100644 --- a/java/com/android/contacts/common/ContactTileLoaderFactory.java +++ b/java/com/android/contacts/common/ContactTileLoaderFactory.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +17,13 @@ package com.android.contacts.common; import android.content.Context; -import android.content.CursorLoader; import android.net.Uri; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; +import androidx.loader.content.CursorLoader; + /** * Used to create {@link CursorLoader} which finds contacts information from the strequents table. * @@ -56,7 +58,6 @@ public final class ContactTileLoaderFactory { .buildUpon() .appendQueryParameter(ContactsContract.STREQUENT_PHONE_ONLY, "true") .build(); - return new CursorLoader(context, uri, COLUMNS_PHONE_ONLY, null, null, null); } } diff --git a/java/com/android/contacts/common/dialog/CallSubjectDialog.java b/java/com/android/contacts/common/dialog/CallSubjectDialog.java index bf0ac14b25..70d6ba25e2 100644 --- a/java/com/android/contacts/common/dialog/CallSubjectDialog.java +++ b/java/com/android/contacts/common/dialog/CallSubjectDialog.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +25,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; -import android.preference.PreferenceManager; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; @@ -41,6 +41,10 @@ import android.widget.EditText; import android.widget.ListView; import android.widget.QuickContactBadge; import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.preference.PreferenceManager; + import com.android.dialer.animation.AnimUtils; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; @@ -50,6 +54,7 @@ import com.android.dialer.contacts.resources.R; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.precall.PreCall; import com.android.dialer.util.ViewUtil; + import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; @@ -58,7 +63,7 @@ import java.util.List; * Implements a dialog which prompts for a call subject for an outgoing call. The dialog includes a * pop up list of historical call subjects. */ -public class CallSubjectDialog extends Activity { +public class CallSubjectDialog extends AppCompatActivity { public static final String PREF_KEY_SUBJECT_HISTORY_COUNT = "subject_history_count"; public static final String PREF_KEY_SUBJECT_HISTORY_ITEM = "subject_history_item"; diff --git a/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java b/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java index cd9511c38b..c3203417a8 100644 --- a/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java +++ b/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +17,7 @@ package com.android.contacts.common.dialog; -import android.app.AlertDialog; import android.app.Dialog; -import android.app.DialogFragment; -import android.app.FragmentManager; import android.app.ProgressDialog; import android.content.ContentResolver; import android.content.Context; @@ -28,6 +26,11 @@ import android.content.DialogInterface.OnClickListener; import android.os.AsyncTask; import android.os.Bundle; import android.provider.ContactsContract; + +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentManager; + import com.android.dialer.contacts.resources.R; import com.android.dialer.util.PermissionsUtil; diff --git a/java/com/android/contacts/common/list/ContactListFilterController.java b/java/com/android/contacts/common/list/ContactListFilterController.java index 60fba0d6d4..a0093e303c 100644 --- a/java/com/android/contacts/common/list/ContactListFilterController.java +++ b/java/com/android/contacts/common/list/ContactListFilterController.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +18,12 @@ package com.android.contacts.common.list; import android.content.Context; import android.content.SharedPreferences; -import android.preference.PreferenceManager; + +import androidx.preference.PreferenceManager; + import com.android.contacts.common.model.AccountTypeManager; import com.android.contacts.common.model.account.AccountWithDataSet; + import java.util.ArrayList; import java.util.List; diff --git a/java/com/android/contacts/common/list/ViewPagerTabs.java b/java/com/android/contacts/common/list/ViewPagerTabs.java index b3242ee2b7..2207936145 100644 --- a/java/com/android/contacts/common/list/ViewPagerTabs.java +++ b/java/com/android/contacts/common/list/ViewPagerTabs.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +20,6 @@ import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Outline; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; @@ -32,6 +31,10 @@ import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; + +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; + import com.android.dialer.contacts.resources.R; /** diff --git a/java/com/android/contacts/common/model/account/AccountType.java b/java/com/android/contacts/common/model/account/AccountType.java index e1fb572b73..107cefeb42 100644 --- a/java/com/android/contacts/common/model/account/AccountType.java +++ b/java/com/android/contacts/common/model/account/AccountType.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +25,15 @@ import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredPostal; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.RawContacts; -import android.support.v4.content.ContextCompat; import android.util.ArrayMap; import android.view.inputmethod.EditorInfo; import android.widget.EditText; + +import androidx.core.content.ContextCompat; + import com.android.contacts.common.model.dataitem.DataKind; import com.android.dialer.contacts.resources.R; + import java.text.Collator; import java.util.ArrayList; import java.util.Collections; diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java index 43027811c1..a3048626cf 100644 --- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java +++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +18,7 @@ package com.android.contacts.common.widget; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; -import android.app.DialogFragment; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; @@ -43,6 +42,8 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; import com.android.contacts.common.compat.PhoneAccountCompat; import com.android.dialer.contacts.resources.R; diff --git a/java/com/android/dialer/app/AccountSelectionActivity.java b/java/com/android/dialer/app/AccountSelectionActivity.java index de84a36b98..34e901d1f9 100644 --- a/java/com/android/dialer/app/AccountSelectionActivity.java +++ b/java/com/android/dialer/app/AccountSelectionActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The LineageOS Project + * Copyright (C) 2018-2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,16 @@ package com.android.dialer.app; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; +import androidx.appcompat.app.AppCompatActivity; + import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment; import com.android.contacts.common.widget.SelectPhoneAccountDialogOptions; import com.android.contacts.common.widget.SelectPhoneAccountDialogOptionsUtil; +import com.android.dialer.R; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.util.CallUtil; @@ -85,7 +87,7 @@ public class AccountSelectionActivity extends AppCompatActivity { number = getIntent().getStringExtra("number"); initiationType = CallInitiationType.Type.values()[getIntent().getIntExtra("type", 0)]; - if (getFragmentManager().findFragmentByTag("dialog") == null) { + if (getSupportFragmentManager().findFragmentByTag("dialog") == null) { List handles = getIntent().getParcelableArrayListExtra("accountHandles"); SelectPhoneAccountDialogOptions options = SelectPhoneAccountDialogOptionsUtil .builderWithAccounts(handles) @@ -95,7 +97,7 @@ public class AccountSelectionActivity extends AppCompatActivity { SelectPhoneAccountDialogFragment dialog = SelectPhoneAccountDialogFragment.newInstance(options, listener); - dialog.show(getFragmentManager(), "dialog"); + dialog.show(getSupportFragmentManager(), "dialog"); } } } diff --git a/java/com/android/dialer/app/AndroidManifest.xml b/java/com/android/dialer/app/AndroidManifest.xml index 15fd14c0d3..400551b35c 100644 --- a/java/com/android/dialer/app/AndroidManifest.xml +++ b/java/com/android/dialer/app/AndroidManifest.xml @@ -143,11 +143,16 @@ android:authorities="com.android.dialer.files" android:exported="false" android:grantUriPermissions="true" - android:name="android.support.v4.content.FileProvider"> + android:name="androidx.core.content.FileProvider"> + + diff --git a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java index 6efdc6286c..b91d164df7 100644 --- a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java +++ b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +19,11 @@ package com.android.dialer.app.calllog; import android.content.Context; import android.provider.BlockedNumberContract; -import android.support.v4.app.FragmentManager; -import android.support.v7.widget.RecyclerView; import android.view.View; import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentManager; +import androidx.recyclerview.widget.RecyclerView; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; import com.android.dialer.blockreportspam.BlockReportSpamDialogs; diff --git a/java/com/android/dialer/app/calllog/CallLogActivity.java b/java/com/android/dialer/app/calllog/CallLogActivity.java index 1a07daa1d4..94161242f7 100644 --- a/java/com/android/dialer/app/calllog/CallLogActivity.java +++ b/java/com/android/dialer/app/calllog/CallLogActivity.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,27 +16,26 @@ */ package com.android.dialer.app.calllog; -import android.app.Fragment; -import android.app.FragmentManager; import android.content.Intent; import android.os.Bundle; import android.provider.CallLog; import android.provider.CallLog.Calls; -import android.support.design.widget.Snackbar; -import android.support.v13.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; -import android.support.v7.app.ActionBar; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.ViewGroup; + +import androidx.appcompat.app.ActionBar; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; + import com.android.contacts.common.list.ViewPagerTabs; -import com.android.dialer.app.R; -import com.android.dialer.calldetails.OldCallDetailsActivity; +import com.android.dialer.R; import com.android.dialer.callstats.CallStatsFragment; import com.android.dialer.callstats.DoubleDatePickerDialog; import com.android.dialer.common.Assert; -import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.database.CallLogQueryHandler; import com.android.dialer.util.TransactionSafeActivity; import com.android.dialer.util.ViewUtil; @@ -88,7 +88,7 @@ public class CallLogActivity extends TransactionSafeActivity implements viewPager = (ViewPager) findViewById(R.id.call_log_pager); - viewPagerAdapter = new ViewPagerAdapter(getFragmentManager()); + viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(viewPagerAdapter); viewPager.setOffscreenPageLimit(1); viewPager.setOnPageChangeListener(this); @@ -151,7 +151,7 @@ public class CallLogActivity extends TransactionSafeActivity implements startActivity(intent); return true; } else if (item.getItemId() == R.id.delete_all) { - ClearCallLogDialog.show(getFragmentManager()); + ClearCallLogDialog.show(getSupportFragmentManager()); return true; } return super.onOptionsItemSelected(item); diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index 866f4d725b..53523bd84a 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,10 +30,6 @@ import android.os.Trace; import android.provider.BlockedNumberContract; import android.provider.CallLog; import android.provider.ContactsContract.CommonDataKinds.Phone; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.RecyclerView.ViewHolder; import android.telecom.PhoneAccountHandle; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; @@ -51,9 +48,13 @@ import androidx.annotation.MainThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView.ViewHolder; import com.android.contacts.common.ContactsUtils; -import com.android.dialer.app.R; +import com.android.dialer.R; import com.android.dialer.app.calllog.CallLogFragment.CallLogFragmentListener; import com.android.dialer.app.calllog.CallLogGroupBuilder.GroupCreator; import com.android.dialer.app.calllog.calllogcache.CallLogCache; @@ -80,6 +81,7 @@ import com.android.dialer.phonenumbercache.ContactInfoHelper; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.PermissionsUtil; + import java.util.ArrayList; import java.util.Map; import java.util.Set; @@ -611,7 +613,7 @@ public class CallLogAdapter extends GroupingListAdapter * @param parent the parent view. * @return The {@link ViewHolder}. */ - private ViewHolder createCallLogEntryViewHolder(ViewGroup parent) { + private RecyclerView.ViewHolder createCallLogEntryViewHolder(ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(activity); View view = inflater.inflate(R.layout.call_log_list_item, parent, false); CallLogListItemViewHolder viewHolder = diff --git a/java/com/android/dialer/app/calllog/CallLogAlertManager.java b/java/com/android/dialer/app/calllog/CallLogAlertManager.java index 40b30f001e..1440c70030 100644 --- a/java/com/android/dialer/app/calllog/CallLogAlertManager.java +++ b/java/com/android/dialer/app/calllog/CallLogAlertManager.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +17,13 @@ package com.android.dialer.app.calllog; -import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import com.android.dialer.app.R; + +import androidx.recyclerview.widget.RecyclerView; + +import com.android.dialer.R; import com.android.dialer.app.alert.AlertManager; import com.android.dialer.common.Assert; diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index e60bbfa7fc..d88306b73f 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,24 +20,18 @@ package com.android.dialer.app.calllog; import static android.Manifest.permission.READ_CALL_LOG; import android.app.Activity; -import android.app.Fragment; import android.app.KeyguardManager; import android.content.ContentResolver; import android.content.Context; -import android.content.pm.PackageManager; import android.database.ContentObserver; import android.database.Cursor; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.provider.CallLog; import android.provider.CallLog.Calls; import android.provider.ContactsContract; -import android.support.v13.app.FragmentCompat; -import android.support.v13.app.FragmentCompat.OnRequestPermissionsResultCallback; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -45,9 +40,13 @@ import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.CallSuper; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; -import com.android.dialer.app.R; +import com.android.dialer.R; import com.android.dialer.app.calllog.CallLogAdapter.CallFetcher; import com.android.dialer.app.calllog.CallLogAdapter.MultiSelectRemoveView; import com.android.dialer.app.calllog.calllogcache.CallLogCache; @@ -67,6 +66,7 @@ import com.android.dialer.phonenumbercache.ContactInfoHelper; import com.android.dialer.util.PermissionsUtil; import com.android.dialer.widget.EmptyContentView; import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClickedListener; + import java.util.Arrays; /** @@ -78,7 +78,6 @@ public class CallLogFragment extends Fragment CallFetcher, MultiSelectRemoveView, OnEmptyViewActionButtonClickedListener, - OnRequestPermissionsResultCallback, CallLogModalAlertManager.Listener, OnClickListener { private static final String KEY_FILTER_TYPE = "filter_type"; @@ -140,7 +139,7 @@ public class CallLogFragment extends Fragment private boolean isCallLogActivity = false; private boolean selectAllMode; private final Handler displayUpdateHandler = - new Handler() { + new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { switch (msg.what) { @@ -213,7 +212,7 @@ public class CallLogFragment extends Fragment selectAllMode = state.getBoolean(KEY_SELECT_ALL_MODE, false); } - final Activity activity = getActivity(); + final Activity activity = requireActivity(); final ContentResolver resolver = activity.getContentResolver(); callLogQueryHandler = new CallLogQueryHandler(activity, resolver, this, logLimit); setHasOptionsMenu(true); @@ -318,7 +317,7 @@ public class CallLogFragment extends Fragment contactInfoCache = new ContactInfoCache( - ExpirableCacheHeadlessFragment.attach((AppCompatActivity) getActivity()) + ExpirableCacheHeadlessFragment.attach(getChildFragmentManager()) .getRetainedCache(), new ContactInfoHelper(getActivity(), currentCountryIso), onContactInfoChangedListener); @@ -334,7 +333,7 @@ public class CallLogFragment extends Fragment new CallLogCache(getActivity()), contactInfoCache, getVoicemailPlaybackPresenter(), - new FilteredNumberAsyncQueryHandler(getActivity()), + new FilteredNumberAsyncQueryHandler(requireActivity()), activityType); recyclerView.setAdapter(adapter); if (adapter.getOnScrollListener() != null) { @@ -348,15 +347,6 @@ public class CallLogFragment extends Fragment return null; } - @Override - public void onActivityCreated(Bundle savedInstanceState) { - LogUtil.enterBlock("CallLogFragment.onActivityCreated"); - super.onActivityCreated(savedInstanceState); - setupData(); - updateSelectAllState(savedInstanceState); - adapter.onRestoreInstanceState(savedInstanceState); - } - private void updateSelectAllState(Bundle savedInstanceState) { if (savedInstanceState != null) { if (savedInstanceState.getBoolean(KEY_SELECT_ALL_MODE, false)) { @@ -366,9 +356,19 @@ public class CallLogFragment extends Fragment } @Override - public void onViewCreated(View view, Bundle savedInstanceState) { + public void onAttach(@NonNull Context context) { + LogUtil.enterBlock("CallLogFragment.onAttach"); + super.onAttach(context); + } + + @Override + public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { + LogUtil.enterBlock("CallLogFragment.onViewCreated"); super.onViewCreated(view, savedInstanceState); updateEmptyMessage(callTypeFilter); + setupData(); + updateSelectAllState(savedInstanceState); + adapter.onRestoreInstanceState(savedInstanceState); } @Override @@ -385,7 +385,7 @@ public class CallLogFragment extends Fragment updateEmptyMessage(callTypeFilter); } - ContentResolver resolver = getActivity().getContentResolver(); + ContentResolver resolver = requireActivity().getContentResolver(); if (PermissionsUtil.hasCallLogReadPermissions(getContext())) { resolver.registerContentObserver(CallLog.CONTENT_URI, true, callLogObserver); } else { @@ -406,15 +406,18 @@ public class CallLogFragment extends Fragment rescheduleDisplayUpdate(); // onResume() may also be called as a "side" page on the ViewPager, which is not visible. if (getUserVisibleHint()) { + LogUtil.w("CallLogFragment.onResume", "on visible hint"); onVisible(); + } else { + LogUtil.w("CallLogFragment.onResume", "not visible hint"); } } @Override public void onPause() { LogUtil.enterBlock("CallLogFragment.onPause"); - getActivity().getContentResolver().unregisterContentObserver(callLogObserver); - getActivity().getContentResolver().unregisterContentObserver(contactsObserver); + requireActivity().getContentResolver().unregisterContentObserver(callLogObserver); + requireActivity().getContentResolver().unregisterContentObserver(contactsObserver); if (getUserVisibleHint()) { onNotVisible(); } @@ -428,7 +431,7 @@ public class CallLogFragment extends Fragment LogUtil.enterBlock("CallLogFragment.onStart"); super.onStart(); CequintCallerIdManager cequintCallerIdManager = null; - if (CequintCallerIdManager.isCequintCallerIdEnabled(getContext())) { + if (CequintCallerIdManager.isCequintCallerIdEnabled(requireContext())) { cequintCallerIdManager = new CequintCallerIdManager(); } contactInfoCache.setCequintCallerIdManager(cequintCallerIdManager); @@ -452,7 +455,7 @@ public class CallLogFragment extends Fragment } @Override - public void onSaveInstanceState(Bundle outState) { + public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(KEY_FILTER_TYPE, callTypeFilter); outState.putInt(KEY_LOG_LIMIT, logLimit); @@ -562,14 +565,15 @@ public class CallLogFragment extends Fragment LogUtil.i( "CallLogFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - FragmentCompat.requestPermissions(this, deniedPermissions, PHONE_PERMISSIONS_REQUEST_CODE); + requestPermissions(deniedPermissions, PHONE_PERMISSIONS_REQUEST_CODE); } else if (!isCallLogActivity) { LogUtil.i("CallLogFragment.onEmptyViewActionButtonClicked", "showing dialpad"); // Show dialpad if we are not in the call log activity. FragmentUtils.getParentUnsafe(this, HostInterface.class).showDialpad(); } } - + //TODO: BadDaemon: Reimplement this +/* @Override public void onRequestPermissionsResult( int requestCode, String[] permissions, int[] grantResults) { @@ -579,7 +583,7 @@ public class CallLogFragment extends Fragment refreshDataRequired = true; } } - } + }*/ /** Schedules an update to the relative call times (X mins ago). */ private void rescheduleDisplayUpdate() { diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 53cc4b7067..544f1bcb7f 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +35,6 @@ import android.provider.BlockedNumberContract; import android.provider.CallLog; import android.provider.CallLog.Calls; import android.provider.ContactsContract.CommonDataKinds.Phone; -import android.support.v7.widget.CardView; -import android.support.v7.widget.RecyclerView; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; @@ -45,23 +44,25 @@ import android.telephony.TelephonyManager; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; -import android.view.ContextMenu; import android.transition.TransitionManager; -import android.view.animation.AccelerateDecelerateInterpolator; -import android.view.animation.DecelerateInterpolator; +import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ViewStub; +import android.view.animation.AccelerateDecelerateInterpolator; +import android.view.animation.DecelerateInterpolator; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.annotation.RequiresPermission; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; import com.android.contacts.common.dialog.CallSubjectDialog; -import com.android.dialer.app.R; +import com.android.dialer.R; import com.android.dialer.app.calllog.CallLogAdapter.OnActionModeStateChangedListener; import com.android.dialer.app.calllog.calllogcache.CallLogCache; import com.android.dialer.app.voicemail.VoicemailPlaybackLayout; @@ -88,6 +89,7 @@ import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.CallUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.UriUtils; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.ref.WeakReference; diff --git a/java/com/android/dialer/app/calllog/CallLogModalAlertManager.java b/java/com/android/dialer/app/calllog/CallLogModalAlertManager.java index 9de260a0ae..7d8ed4b3b6 100644 --- a/java/com/android/dialer/app/calllog/CallLogModalAlertManager.java +++ b/java/com/android/dialer/app/calllog/CallLogModalAlertManager.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +20,8 @@ package com.android.dialer.app.calllog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import com.android.dialer.app.R; + +import com.android.dialer.R; import com.android.dialer.app.alert.AlertManager; /** diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsActivity.java b/java/com/android/dialer/app/calllog/CallLogNotificationsActivity.java index c08d2c02b4..b8488c537b 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsActivity.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsActivity.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,9 @@ package com.android.dialer.app.calllog; import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AppCompatActivity; + import com.android.dialer.common.LogUtil; import com.android.dialer.util.PermissionsUtil; diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java index 60d82f69bc..00d08de0ae 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,15 +26,15 @@ import android.database.Cursor; import android.net.Uri; import android.provider.CallLog.Calls; import android.provider.VoicemailContract.Voicemails; -import android.support.v4.os.UserManagerCompat; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; +import androidx.core.os.UserManagerCompat; -import com.android.dialer.app.R; +import com.android.dialer.R; import com.android.dialer.calllogutils.PhoneNumberDisplayUtil; import com.android.dialer.common.LogUtil; import com.android.dialer.common.database.Selection; @@ -42,6 +43,7 @@ import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.phonenumbercache.ContactInfoHelper; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.util.PermissionsUtil; + import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; diff --git a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java index faece65b6d..0b4e5dbb97 100644 --- a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java +++ b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,20 +18,19 @@ package com.android.dialer.app.calllog; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; -import android.app.DialogFragment; -import android.app.FragmentManager; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; import android.provider.CallLog.Calls; -import android.support.design.widget.Snackbar; import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentManager; -import com.android.dialer.app.R; +import com.android.dialer.R; import com.android.dialer.common.Assert; import com.android.dialer.common.concurrent.DialerExecutor; import com.android.dialer.common.concurrent.DialerExecutor.Worker; @@ -58,7 +58,7 @@ public class ClearCallLogDialog extends DialogFragment { DialerExecutorComponent.get(getContext()) .dialerExecutorFactory() .createUiTaskBuilder( - getFragmentManager(), + getChildFragmentManager(), "clearCallLogTask", new ClearCallLogWorker(getActivity().getApplicationContext())) .onSuccess(this::onSuccess) diff --git a/java/com/android/dialer/app/calllog/GroupingListAdapter.java b/java/com/android/dialer/app/calllog/GroupingListAdapter.java index 29a4d4e4a3..c4bbf80c9c 100644 --- a/java/com/android/dialer/app/calllog/GroupingListAdapter.java +++ b/java/com/android/dialer/app/calllog/GroupingListAdapter.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +21,10 @@ import android.database.ContentObserver; import android.database.Cursor; import android.database.DataSetObserver; import android.os.Handler; -import android.support.v7.widget.RecyclerView; import android.util.SparseIntArray; +import androidx.recyclerview.widget.RecyclerView; + /** * Maintains a list that groups items into groups of consecutive elements which are disjoint, that * is, an item can only belong to one group. This is leveraged for grouping calls in the call log diff --git a/java/com/android/dialer/app/calllog/MissedCallNotificationReceiver.java b/java/com/android/dialer/app/calllog/MissedCallNotificationReceiver.java index 2ec1a53307..6bf9203e86 100644 --- a/java/com/android/dialer/app/calllog/MissedCallNotificationReceiver.java +++ b/java/com/android/dialer/app/calllog/MissedCallNotificationReceiver.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +20,9 @@ package com.android.dialer.app.calllog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.support.v4.util.Pair; + +import androidx.core.util.Pair; + import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java index c4acd14bcb..51bac7d941 100644 --- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java +++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,8 +30,6 @@ import android.graphics.drawable.Icon; import android.net.Uri; import android.provider.CallLog.Calls; import android.service.notification.StatusBarNotification; -import android.support.v4.os.UserManagerCompat; -import android.support.v4.util.Pair; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; @@ -43,6 +42,8 @@ import android.util.ArraySet; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; +import androidx.core.os.UserManagerCompat; +import androidx.core.util.Pair; import com.android.contacts.common.ContactsUtils; import com.android.dialer.app.MainComponent; @@ -64,6 +65,7 @@ import com.android.dialer.precall.PreCall; import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; + import java.util.Iterator; import java.util.List; import java.util.Set; diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java index 0ecdf061f5..1706b89e84 100644 --- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java +++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +22,6 @@ import android.content.res.Resources; import android.graphics.Typeface; import android.provider.CallLog.Calls; import android.provider.ContactsContract.CommonDataKinds.Phone; -import android.support.v4.content.ContextCompat; import android.telecom.PhoneAccount; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; @@ -39,6 +39,7 @@ import com.android.dialer.phonenumbercache.PhoneNumberCache; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.DialerUtils; + import java.util.ArrayList; import java.util.Calendar; import java.util.concurrent.TimeUnit; diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index 1a21b79b49..0e75aeecc4 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +28,10 @@ import android.provider.VoicemailContract; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; + import com.android.dialer.app.R; import com.android.dialer.app.voicemail.VoicemailAudioManager; import com.android.dialer.app.voicemail.VoicemailErrorManager; @@ -40,6 +45,7 @@ import com.android.dialer.voicemail.listui.error.VoicemailErrorMessageCreator; import com.android.dialer.voicemail.listui.error.VoicemailStatus; import com.android.dialer.voicemail.listui.error.VoicemailStatusWorker; import com.android.dialer.widget.EmptyContentView; + import java.util.List; public class VisualVoicemailCallLogFragment extends CallLogFragment { @@ -61,8 +67,8 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { - voicemailPlaybackPresenter = - VoicemailPlaybackPresenter.getInstance(getActivity(), savedInstanceState); + voicemailPlaybackPresenter = VoicemailPlaybackPresenter.getInstance( + (AppCompatActivity) getActivity(), savedInstanceState); if (PermissionsUtil.hasReadVoicemailPermissions(getContext()) && PermissionsUtil.hasAddVoicemailPermissions(getContext())) { getActivity() @@ -80,7 +86,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { DialerExecutorComponent.get(getContext()) .dialerExecutorFactory() .createUiTaskBuilder( - getActivity().getFragmentManager(), + getActivity().getSupportFragmentManager(), "fetchVoicemailStatus", new VoicemailStatusWorker()) .onSuccess(this::onPreSyncVoicemailStatusChecked) @@ -147,7 +153,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { } @Override - public void onSaveInstanceState(Bundle outState) { + public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); if (voicemailPlaybackPresenter != null) { voicemailPlaybackPresenter.onSaveInstanceState(outState); diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java index 150daefb72..c127b40442 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,13 +24,13 @@ import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; -import android.support.v4.app.NotificationCompat; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telephony.TelephonyManager; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.app.NotificationCompat; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.app.MainComponent; @@ -43,6 +44,7 @@ import com.android.dialer.notification.NotificationManagerUtils; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.theme.base.ThemeComponent; + import java.util.List; import java.util.Map; diff --git a/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java b/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java index 68e42b261b..82cdb7308e 100644 --- a/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java +++ b/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +22,10 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.drawable.Drawable; -import android.support.v4.graphics.drawable.RoundedBitmapDrawable; -import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; import androidx.annotation.Nullable; +import androidx.core.graphics.drawable.RoundedBitmapDrawable; +import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory; import com.android.dialer.app.R; import com.android.dialer.common.Assert; @@ -33,6 +34,7 @@ import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.location.GeoUtil; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.phonenumbercache.ContactInfoHelper; + import java.io.IOException; import java.io.InputStream; import java.util.Objects; diff --git a/java/com/android/dialer/app/contactinfo/ExpirableCacheHeadlessFragment.java b/java/com/android/dialer/app/contactinfo/ExpirableCacheHeadlessFragment.java index 72b68ffd6d..28d4f141e6 100644 --- a/java/com/android/dialer/app/contactinfo/ExpirableCacheHeadlessFragment.java +++ b/java/com/android/dialer/app/contactinfo/ExpirableCacheHeadlessFragment.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +18,11 @@ package com.android.dialer.app.contactinfo; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AppCompatActivity; import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.util.ExpirableCache; @@ -45,7 +46,7 @@ public class ExpirableCacheHeadlessFragment extends Fragment { } @NonNull - private static ExpirableCacheHeadlessFragment attach(FragmentManager fragmentManager) { + public static ExpirableCacheHeadlessFragment attach(FragmentManager fragmentManager) { ExpirableCacheHeadlessFragment fragment = (ExpirableCacheHeadlessFragment) fragmentManager.findFragmentByTag(FRAGMENT_TAG); if (fragment == null) { diff --git a/java/com/android/dialer/app/list/RemoveView.java b/java/com/android/dialer/app/list/RemoveView.java index bb54735110..ba6fbe1b6a 100644 --- a/java/com/android/dialer/app/list/RemoveView.java +++ b/java/com/android/dialer/app/list/RemoveView.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +26,8 @@ import android.view.accessibility.AccessibilityEvent; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; -import com.android.dialer.app.R; + +import com.android.dialer.R; public class RemoveView extends FrameLayout { @@ -49,6 +51,7 @@ public class RemoveView extends FrameLayout { @Override protected void onFinishInflate() { + super.onFinishInflate(); removeText = (TextView) findViewById(R.id.remove_view_text); removeIcon = (ImageView) findViewById(R.id.remove_view_icon); final Resources r = getResources(); diff --git a/java/com/android/dialer/app/res/layout/call_log_activity.xml b/java/com/android/dialer/app/res/layout/call_log_activity.xml index acbc56ec57..887fa987f3 100644 --- a/java/com/android/dialer/app/res/layout/call_log_activity.xml +++ b/java/com/android/dialer/app/res/layout/call_log_activity.xml @@ -1,5 +1,6 @@ - @@ -148,8 +150,8 @@ android:layout_gravity="center_vertical" android:background="?android:attr/selectableItemBackgroundBorderless" android:scaleType="center" - android:tint="?colorIcon" - android:visibility="gone"/> + android:visibility="gone" + app:tint="?colorIcon" /> @@ -164,6 +166,6 @@ - + diff --git a/java/com/android/dialer/app/res/layout/voicemail_playback_layout.xml b/java/com/android/dialer/app/res/layout/voicemail_playback_layout.xml index 4f10d111c8..92c0544a5e 100644 --- a/java/com/android/dialer/app/res/layout/voicemail_playback_layout.xml +++ b/java/com/android/dialer/app/res/layout/voicemail_playback_layout.xml @@ -1,5 +1,6 @@ + android:text="@string/call_details_copy_number" + app:drawableStartCompat="@drawable/quantum_ic_content_copy_vd_theme_24" /> + android:text="@string/call_details_edit_number" + app:drawableStartCompat="@drawable/quantum_ic_edit_vd_theme_24" + app:drawableTint="?colorIcon" /> + android:visibility="gone" + app:drawableStartCompat="@drawable/quantum_ic_report_vd_theme_24" /> + android:text="@string/delete" + app:drawableTint="?colorIcon" + app:drawableStartCompat="@drawable/quantum_ic_delete_vd_theme_24" /> 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 e2dc684c4a..7f67a73c96 100755 --- a/java/com/android/dialer/calldetails/res/layout/contact_container.xml +++ b/java/com/android/dialer/calldetails/res/layout/contact_container.xml @@ -1,6 +1,7 @@ + app:tint="?colorIcon" /> + app:tint="?colorIcon" /> + android:visibility="gone" + app:tint="?android:attr/textColorSecondary" /> diff --git a/java/com/android/dialer/callstats/res/layout/call_stats_detail_info.xml b/java/com/android/dialer/callstats/res/layout/call_stats_detail_info.xml index 7f02dba040..2aecd31ae7 100644 --- a/java/com/android/dialer/callstats/res/layout/call_stats_detail_info.xml +++ b/java/com/android/dialer/callstats/res/layout/call_stats_detail_info.xml @@ -1,6 +1,7 @@ - - - + - - + diff --git a/java/com/android/dialer/common/FragmentUtils.java b/java/com/android/dialer/common/FragmentUtils.java index b9c58104f7..f31d2b72a0 100644 --- a/java/com/android/dialer/common/FragmentUtils.java +++ b/java/com/android/dialer/common/FragmentUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +17,10 @@ package com.android.dialer.common; -import android.support.v4.app.Fragment; - import androidx.annotation.CheckResult; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import com.android.dialer.main.MainActivityPeer; diff --git a/java/com/android/dialer/common/concurrent/DefaultDialerExecutorFactory.java b/java/com/android/dialer/common/concurrent/DefaultDialerExecutorFactory.java index c31c5239d0..dcb4dca6e8 100644 --- a/java/com/android/dialer/common/concurrent/DefaultDialerExecutorFactory.java +++ b/java/com/android/dialer/common/concurrent/DefaultDialerExecutorFactory.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +17,9 @@ package com.android.dialer.common.concurrent; -import android.app.FragmentManager; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentManager; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; @@ -31,11 +31,13 @@ import com.android.dialer.common.concurrent.DialerExecutor.Builder; import com.android.dialer.common.concurrent.DialerExecutor.FailureListener; import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener; import com.android.dialer.common.concurrent.DialerExecutor.Worker; + import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; + import javax.inject.Inject; /** The production {@link DialerExecutorFactory}. */ diff --git a/java/com/android/dialer/common/concurrent/DialerExecutor.java b/java/com/android/dialer/common/concurrent/DialerExecutor.java index 79c469472a..bd08ccc7d4 100644 --- a/java/com/android/dialer/common/concurrent/DialerExecutor.java +++ b/java/com/android/dialer/common/concurrent/DialerExecutor.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +54,7 @@ import java.util.concurrent.ExecutorService; * *

  *
- * public class MyActivity extends Activity {
+ * public class MyActivity extends AppCompatActivity {
  *
  *   private final DialerExecutor<MyInputType> myExecutor;
  *
diff --git a/java/com/android/dialer/common/concurrent/DialerExecutorComponent.java b/java/com/android/dialer/common/concurrent/DialerExecutorComponent.java
index 6a2217416a..97e7b26b8c 100644
--- a/java/com/android/dialer/common/concurrent/DialerExecutorComponent.java
+++ b/java/com/android/dialer/common/concurrent/DialerExecutorComponent.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +17,10 @@
 
 package com.android.dialer.common.concurrent;
 
-import android.app.FragmentManager;
 import android.content.Context;
+
+import androidx.fragment.app.FragmentManager;
+
 import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
 import com.android.dialer.common.concurrent.Annotations.LightweightExecutor;
 import com.android.dialer.common.concurrent.Annotations.NonUiParallel;
@@ -25,9 +28,11 @@ import com.android.dialer.common.concurrent.Annotations.Ui;
 import com.android.dialer.inject.HasRootComponent;
 import com.android.dialer.inject.IncludeInDialerRoot;
 import com.google.common.util.concurrent.ListeningExecutorService;
-import dagger.Subcomponent;
+
 import java.util.concurrent.ExecutorService;
 
+import dagger.Subcomponent;
+
 /** Dagger component which provides a {@link DialerExecutorFactory}. */
 @Subcomponent
 public abstract class DialerExecutorComponent {
@@ -46,17 +51,12 @@ public abstract class DialerExecutorComponent {
   @LightweightExecutor
   public abstract ListeningExecutorService lightweightExecutor();
 
-  public  UiListener createUiListener(
-      FragmentManager fragmentManager, String taskId) {
-    return UiListener.create(fragmentManager, taskId);
-  }
-
   /**
    * Version of {@link #createUiListener(FragmentManager, String)} that accepts support fragment
    * manager.
    */
   public  SupportUiListener createUiListener(
-      android.support.v4.app.FragmentManager fragmentManager, String taskId) {
+          FragmentManager fragmentManager, String taskId) {
     return SupportUiListener.create(fragmentManager, taskId);
   }
 
diff --git a/java/com/android/dialer/common/concurrent/DialerExecutorFactory.java b/java/com/android/dialer/common/concurrent/DialerExecutorFactory.java
index cfde3e34a8..7ff8862a99 100644
--- a/java/com/android/dialer/common/concurrent/DialerExecutorFactory.java
+++ b/java/com/android/dialer/common/concurrent/DialerExecutorFactory.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,9 +17,8 @@
 
 package com.android.dialer.common.concurrent;
 
-import android.app.FragmentManager;
-
 import androidx.annotation.NonNull;
+import androidx.fragment.app.FragmentManager;
 
 import com.android.dialer.common.concurrent.DialerExecutor.Worker;
 
diff --git a/java/com/android/dialer/common/concurrent/DialerUiTaskFragment.java b/java/com/android/dialer/common/concurrent/DialerUiTaskFragment.java
index f502a01664..4148306794 100644
--- a/java/com/android/dialer/common/concurrent/DialerUiTaskFragment.java
+++ b/java/com/android/dialer/common/concurrent/DialerUiTaskFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,20 +17,21 @@
 
 package com.android.dialer.common.concurrent;
 
-import android.app.Fragment;
-import android.app.FragmentManager;
 import android.os.Bundle;
 
 import androidx.annotation.MainThread;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.annotation.WorkerThread;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
 
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.common.concurrent.DialerExecutor.FailureListener;
 import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener;
 import com.android.dialer.common.concurrent.DialerExecutor.Worker;
+
 import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ScheduledExecutorService;
diff --git a/java/com/android/dialer/common/concurrent/SupportUiListener.java b/java/com/android/dialer/common/concurrent/SupportUiListener.java
index a7269d965a..08ceeac975 100644
--- a/java/com/android/dialer/common/concurrent/SupportUiListener.java
+++ b/java/com/android/dialer/common/concurrent/SupportUiListener.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,12 +19,12 @@ package com.android.dialer.common.concurrent;
 
 import android.content.Context;
 import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
 
 import androidx.annotation.MainThread;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
 
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
@@ -67,7 +68,7 @@ public class SupportUiListener extends Fragment {
 
   @MainThread
   static  SupportUiListener create(
-      FragmentManager fragmentManager, String taskId) {
+          FragmentManager fragmentManager, String taskId) {
     @SuppressWarnings("unchecked")
     SupportUiListener uiListener =
         (SupportUiListener) fragmentManager.findFragmentByTag(taskId);
diff --git a/java/com/android/dialer/common/concurrent/UiListener.java b/java/com/android/dialer/common/concurrent/UiListener.java
index e6fb9835ed..78aa370132 100644
--- a/java/com/android/dialer/common/concurrent/UiListener.java
+++ b/java/com/android/dialer/common/concurrent/UiListener.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,14 +17,14 @@
 
 package com.android.dialer.common.concurrent;
 
-import android.app.Fragment;
-import android.app.FragmentManager;
 import android.content.Context;
 import android.os.Bundle;
 
 import androidx.annotation.MainThread;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
 
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
@@ -40,7 +41,7 @@ import com.google.common.util.concurrent.ListenableFuture;
  * 

Callbacks are only executed if the UI component is still alive. * *

Example usage:

- * public class MyActivity extends Activity {
+ * public class MyActivity extends AppCompatActivity {
  *
  *   private UiListener<MyOutputType> uiListener;
  *
diff --git a/java/com/android/dialer/compat/android/support/design/bottomsheet/BottomSheetStateCompat.java b/java/com/android/dialer/compat/android/support/design/bottomsheet/BottomSheetStateCompat.java
index d7079d4616..4e5932cde3 100644
--- a/java/com/android/dialer/compat/android/support/design/bottomsheet/BottomSheetStateCompat.java
+++ b/java/com/android/dialer/compat/android/support/design/bottomsheet/BottomSheetStateCompat.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +17,7 @@
 
 package com.android.dialer.compat.android.support.design.bottomsheet;
 
-import android.support.design.widget.BottomSheetBehavior;
+import com.google.android.material.bottomsheet.BottomSheetBehavior;
 
 /** Provides access to bottom sheet states. */
 public final class BottomSheetStateCompat {
diff --git a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
index 97e984bb8e..b3edae89a0 100644
--- a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
+++ b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -43,8 +44,6 @@ import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.Contacts.Photo;
 import android.provider.ContactsContract.Data;
 import android.provider.ContactsContract.Directory;
-import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
-import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
 import android.text.TextUtils;
 import android.util.LruCache;
 import android.view.View;
@@ -53,13 +52,15 @@ import android.widget.ImageView;
 
 import androidx.annotation.UiThread;
 import androidx.annotation.WorkerThread;
+import androidx.core.graphics.drawable.RoundedBitmapDrawable;
+import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
 
 import com.android.dialer.R;
 import com.android.dialer.common.LogUtil;
-import com.android.dialer.constants.Constants;
 import com.android.dialer.constants.TrafficStatsTags;
 import com.android.dialer.util.PermissionsUtil;
 import com.android.dialer.util.UriUtils;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
diff --git a/java/com/android/dialer/contacts/displaypreference/ContactDisplayPreferencesImpl.java b/java/com/android/dialer/contacts/displaypreference/ContactDisplayPreferencesImpl.java
index 4f67b1759c..1691ce3337 100644
--- a/java/com/android/dialer/contacts/displaypreference/ContactDisplayPreferencesImpl.java
+++ b/java/com/android/dialer/contacts/displaypreference/ContactDisplayPreferencesImpl.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +20,12 @@ package com.android.dialer.contacts.displaypreference;
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.os.UserManager;
-import android.preference.PreferenceManager;
+
+import androidx.preference.PreferenceManager;
+
+import com.android.dialer.R;
 import com.android.dialer.inject.ApplicationContext;
+
 import javax.inject.Inject;
 
 /**
diff --git a/java/com/android/dialer/contacts/resources/res/layout/dialog_call_subject.xml b/java/com/android/dialer/contacts/resources/res/layout/dialog_call_subject.xml
index 465d313a2b..8ebe349f4a 100644
--- a/java/com/android/dialer/contacts/resources/res/layout/dialog_call_subject.xml
+++ b/java/com/android/dialer/contacts/resources/res/layout/dialog_call_subject.xml
@@ -1,6 +1,7 @@
 
 
 
 
-
+        android:visibility="gone" />
 
     
+        android:visibility="gone" />
       
@@ -151,13 +153,13 @@
       android:layout_height="1dp"
       android:background="@android:color/transparent"/>
 
-  
 
   
 
-  
 
diff --git a/java/com/android/dialer/helplines/HelplineActivity.java b/java/com/android/dialer/helplines/HelplineActivity.java
index 17e8cc8989..8e7338b3ab 100755
--- a/java/com/android/dialer/helplines/HelplineActivity.java
+++ b/java/com/android/dialer/helplines/HelplineActivity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019-2021 The LineageOS Project
+ * Copyright (C) 2019-2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,8 +25,6 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.Bundle;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
 import android.telephony.SubscriptionManager;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -44,6 +42,9 @@ import android.widget.TextView;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.dialer.R;
 import com.android.dialer.app.calllog.IntentProvider;
@@ -55,7 +56,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-public class HelplineActivity extends Activity {
+public class HelplineActivity extends AppCompatActivity {
 
     public static final String SHARED_PREFERENCES_KEY = "com.android.dialer.prefs";
 
diff --git a/java/com/android/dialer/helplines/HelplineAdapter.java b/java/com/android/dialer/helplines/HelplineAdapter.java
index a91037d590..297d2fbe8b 100644
--- a/java/com/android/dialer/helplines/HelplineAdapter.java
+++ b/java/com/android/dialer/helplines/HelplineAdapter.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2019-2021 The LineageOS Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +17,6 @@
 package com.android.dialer.helplines;
 
 import android.content.res.Resources;
-import android.support.v7.util.DiffUtil;
-import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -26,6 +25,8 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.DiffUtil;
+import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.dialer.R;
 import com.android.dialer.helplines.utils.HelplineUtils;
diff --git a/java/com/android/dialer/helplines/LoadHelplinesTask.java b/java/com/android/dialer/helplines/LoadHelplinesTask.java
index 1ae3d62263..049cdba15d 100644
--- a/java/com/android/dialer/helplines/LoadHelplinesTask.java
+++ b/java/com/android/dialer/helplines/LoadHelplinesTask.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2019-2021 The LineageOS Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +20,6 @@ import android.content.res.Resources;
 import android.os.AsyncTask;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
-import android.util.Log;
 
 import androidx.annotation.NonNull;
 
diff --git a/java/com/android/dialer/helplines/res/layout/activity_helplines.xml b/java/com/android/dialer/helplines/res/layout/activity_helplines.xml
index c4cac0aab7..fbc0c25bdc 100644
--- a/java/com/android/dialer/helplines/res/layout/activity_helplines.xml
+++ b/java/com/android/dialer/helplines/res/layout/activity_helplines.xml
@@ -1,6 +1,6 @@
 
 
 
 
-    
 
-     getLastOutgoingCallListener;
-  private UiListener missedCallObserverUiListener;
+  private SupportUiListener getLastOutgoingCallListener;
+  private SupportUiListener missedCallObserverUiListener;
   private View bottomSheet;
 
   static boolean isShowTabIntent(Intent intent) {
@@ -198,10 +195,10 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
   private void initUiListeners() {
     getLastOutgoingCallListener =
         DialerExecutorComponent.get(activity)
-            .createUiListener(activity.getFragmentManager(), "Query last phone number");
+            .createUiListener(activity.getSupportFragmentManager(), "Query last phone number");
     missedCallObserverUiListener =
         DialerExecutorComponent.get(activity)
-            .createUiListener(activity.getFragmentManager(), "Missed call observer");
+            .createUiListener(activity.getSupportFragmentManager(), "Missed call observer");
   }
 
   private void initLayout(Bundle savedInstanceState) {
@@ -231,7 +228,6 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
     bottomNavTabListener =
         new MainBottomNavBarBottomNavTabListener(
             activity,
-            activity.getFragmentManager(),
             activity.getSupportFragmentManager(),
             fab,
             bottomSheet);
@@ -578,10 +574,11 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
 
     private final MainSearchController searchController;
     private final Context context;
-    private final UiListener listener;
+    private final SupportUiListener listener;
 
     MainDialpadListener(
-        Context context, MainSearchController searchController, UiListener uiListener) {
+        Context context, MainSearchController searchController,
+        SupportUiListener uiListener) {
       this.context = context;
       this.searchController = searchController;
       this.listener = uiListener;
@@ -966,21 +963,18 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
 
     private final TransactionSafeActivity activity;
     private final FragmentManager fragmentManager;
-    private final android.support.v4.app.FragmentManager supportFragmentManager;
     private final FloatingActionButton fab;
     private final View bottomSheet;
 
-    @TabIndex private int selectedTab = -1;
+    @TabIndex private int selectedTab = TabIndex.NONE;
 
     private MainBottomNavBarBottomNavTabListener(
         TransactionSafeActivity activity,
         FragmentManager fragmentManager,
-        android.support.v4.app.FragmentManager supportFragmentManager,
         FloatingActionButton fab,
         View bottomSheet) {
       this.activity = activity;
       this.fragmentManager = fragmentManager;
-      this.supportFragmentManager = supportFragmentManager;
       this.fab = fab;
       this.bottomSheet = bottomSheet;
     }
@@ -993,11 +987,8 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
       }
       selectedTab = TabIndex.SPEED_DIAL;
 
-      android.support.v4.app.Fragment supportFragment =
-          supportFragmentManager.findFragmentByTag(SPEED_DIAL_TAG);
-      showSupportFragment(
-          supportFragment == null ? SpeedDialFragment.newInstance() : supportFragment,
-          SPEED_DIAL_TAG);
+      Fragment fragment = fragmentManager.findFragmentByTag(SPEED_DIAL_TAG);
+      showFragment(fragment == null ? SpeedDialFragment.newInstance() : fragment, SPEED_DIAL_TAG);
 
       fab.show();
     }
@@ -1079,10 +1070,6 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
       fragment.onVisible();
     }
 
-    private void showFragment(@NonNull Fragment fragment, String tag) {
-      showFragment(fragment, null, tag);
-    }
-
     /**
      * Shows the passed in fragment and hides all of the others in one transaction.
      *
@@ -1096,61 +1083,27 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
      */
     private void showFragment(
         @Nullable Fragment fragment,
-        @Nullable android.support.v4.app.Fragment supportFragment,
         String tag) {
       LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.showFragment");
-      Fragment oldSpeedDial = fragmentManager.findFragmentByTag(SPEED_DIAL_TAG);
-      Fragment oldCallLog = fragmentManager.findFragmentByTag(CALL_LOG_TAG);
+      Fragment speedDial = fragmentManager.findFragmentByTag(SPEED_DIAL_TAG);
+      Fragment callLog = fragmentManager.findFragmentByTag(CALL_LOG_TAG);
       Fragment contacts = fragmentManager.findFragmentByTag(CONTACTS_TAG);
-      Fragment oldVoicemail = fragmentManager.findFragmentByTag(VOICEMAIL_TAG);
+      Fragment voicemail = fragmentManager.findFragmentByTag(VOICEMAIL_TAG);
 
       FragmentTransaction transaction = fragmentManager.beginTransaction();
-      boolean fragmentShown = showIfEqualElseHide(transaction, fragment, oldSpeedDial);
-      fragmentShown |= showIfEqualElseHide(transaction, fragment, oldCallLog);
+      boolean fragmentShown = showIfEqualElseHide(transaction, fragment, speedDial);
+      fragmentShown |= showIfEqualElseHide(transaction, fragment, callLog);
       fragmentShown |= showIfEqualElseHide(transaction, fragment, contacts);
-      fragmentShown |= showIfEqualElseHide(transaction, fragment, oldVoicemail);
+      fragmentShown |= showIfEqualElseHide(transaction, fragment, voicemail);
 
       if (!fragmentShown && fragment != null) {
-        LogUtil.i(
-            "MainBottomNavBarBottomNavTabListener.showFragment", "Not added yet: " + fragment);
+        LogUtil.i("MainBottomNavBarBottomNavTabListener.showFragment",
+                "Not added yet: " + fragment);
         transaction.add(R.id.fragment_container, fragment, tag);
       }
       if (activity.isSafeToCommitTransactions()) {
         transaction.commit();
       }
-
-      // Handle support fragments.
-      // TODO(calderwoodra): Handle other new fragments.
-      android.support.v4.app.Fragment speedDial =
-          supportFragmentManager.findFragmentByTag(SPEED_DIAL_TAG);
-      android.support.v4.app.Fragment newCallLog =
-          supportFragmentManager.findFragmentByTag(CALL_LOG_TAG);
-      android.support.v4.app.Fragment newVoicemail =
-          supportFragmentManager.findFragmentByTag(VOICEMAIL_TAG);
-
-      android.support.v4.app.FragmentTransaction supportTransaction =
-          supportFragmentManager.beginTransaction();
-      boolean supportFragmentShown =
-          showIfEqualElseHideSupport(supportTransaction, supportFragment, speedDial);
-      supportFragmentShown |=
-          showIfEqualElseHideSupport(supportTransaction, supportFragment, newCallLog);
-      supportFragmentShown |=
-          showIfEqualElseHideSupport(supportTransaction, supportFragment, newVoicemail);
-
-      if (!supportFragmentShown && supportFragment != null) {
-        LogUtil.i(
-            "MainBottomNavBarBottomNavTabListener.showFragment",
-            "Not added yet: " + supportFragment);
-        supportTransaction.add(R.id.fragment_container, supportFragment, tag);
-      }
-      if (activity.isSafeToCommitTransactions()) {
-        supportTransaction.commit();
-      }
-    }
-
-    private void showSupportFragment(
-        @NonNull android.support.v4.app.Fragment supportFragment, String tag) {
-      showFragment(null, supportFragment, tag);
     }
 
     /**
@@ -1158,8 +1111,8 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
      * @param fragment2 will be hidden if unequal to {@code fragment1}
      * @return {@code true} if {@code fragment1} was shown
      */
-    private boolean showIfEqualElseHide(
-        FragmentTransaction transaction, Fragment fragment1, Fragment fragment2) {
+    private boolean showIfEqualElseHide(FragmentTransaction transaction, Fragment fragment1,
+                                        Fragment fragment2) {
       boolean shown = false;
       if (fragment1 != null && fragment1.equals(fragment2)) {
         transaction.show(fragment1);
@@ -1173,25 +1126,6 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
       }
       return shown;
     }
-
-    /**
-     * @param supportFragment1 will be shown if equal to {@code fragment2}
-     * @param supportFragment2 will be hidden if unequal to {@code fragment1}
-     * @return {@code true} if {@code fragment1} was shown
-     */
-    private boolean showIfEqualElseHideSupport(
-        android.support.v4.app.FragmentTransaction supportTransaction,
-        android.support.v4.app.Fragment supportFragment1,
-        android.support.v4.app.Fragment supportFragment2) {
-      boolean shown = false;
-      if (supportFragment1 != null && supportFragment1.equals(supportFragment2)) {
-        supportTransaction.show(supportFragment1);
-        shown = true;
-      } else if (supportFragment2 != null) {
-        supportTransaction.hide(supportFragment2);
-      }
-      return shown;
-    }
   }
 
   private static final class LastTabController {
@@ -1212,9 +1146,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
      */
     @TabIndex
     int getLastTab() {
-      @TabIndex int tabIndex = TabIndex.SPEED_DIAL;
-
-      tabIndex =
+      @TabIndex int tabIndex =
           StorageComponent.get(context)
               .unencryptedSharedPrefs()
               .getInt(KEY_LAST_TAB, TabIndex.SPEED_DIAL);
diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java
index 7a7e37d681..7766687627 100644
--- a/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java
+++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -40,12 +41,14 @@ public final class BottomNavBar extends LinearLayout {
   /** Index for each tab in the bottom nav. */
   @Retention(RetentionPolicy.SOURCE)
   @IntDef({
+    TabIndex.NONE,
     TabIndex.SPEED_DIAL,
     TabIndex.CALL_LOG,
     TabIndex.CONTACTS,
     TabIndex.VOICEMAIL,
   })
   public @interface TabIndex {
+    int NONE = -1;
     int SPEED_DIAL = 0;
     int CALL_LOG = 1;
     int CONTACTS = 2;
diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java
index eafcaeda14..07cf4961d3 100644
--- a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java
+++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -38,6 +39,7 @@ import com.android.dialer.common.Assert;
 import com.android.dialer.common.MathUtil;
 import com.android.dialer.util.DialerUtils;
 import com.android.incallui.answer.impl.utils.Interpolators;
+import com.google.android.material.navigation.NavigationBarItemView;
 
 /** Navigation item in a bottom nav. */
 final class BottomNavItem extends LinearLayout {
diff --git a/java/com/android/dialer/main/impl/bottomnav/MissedCallCountObserver.java b/java/com/android/dialer/main/impl/bottomnav/MissedCallCountObserver.java
index 9907d84346..8ae76f2687 100644
--- a/java/com/android/dialer/main/impl/bottomnav/MissedCallCountObserver.java
+++ b/java/com/android/dialer/main/impl/bottomnav/MissedCallCountObserver.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import android.provider.CallLog.Calls;
 import androidx.annotation.RequiresPermission;
 
 import com.android.dialer.common.concurrent.DialerExecutorComponent;
-import com.android.dialer.common.concurrent.UiListener;
+import com.android.dialer.common.concurrent.SupportUiListener;
 import com.android.dialer.main.impl.bottomnav.BottomNavBar.TabIndex;
 import com.google.common.util.concurrent.ListenableFuture;
 
@@ -37,10 +38,10 @@ import com.google.common.util.concurrent.ListenableFuture;
 public final class MissedCallCountObserver extends ContentObserver {
   private final Context appContext;
   private final BottomNavBar bottomNavBar;
-  private final UiListener uiListener;
+  private final SupportUiListener uiListener;
 
   public MissedCallCountObserver(
-      Context appContext, BottomNavBar bottomNavBar, UiListener uiListener) {
+      Context appContext, BottomNavBar bottomNavBar, SupportUiListener uiListener) {
     super(null);
     this.appContext = appContext;
     this.bottomNavBar = bottomNavBar;
diff --git a/java/com/android/dialer/main/impl/res/layout/main_activity.xml b/java/com/android/dialer/main/impl/res/layout/main_activity.xml
index 96ad911bcb..1f6ecfa79e 100644
--- a/java/com/android/dialer/main/impl/res/layout/main_activity.xml
+++ b/java/com/android/dialer/main/impl/res/layout/main_activity.xml
@@ -1,6 +1,7 @@
 
 
   
 
 
+      android:scaleType="center"
+      app:tint="?colorIcon" />
 
   
-
\ No newline at end of file
+      android:visibility="gone"
+      app:tint="?colorIcon" />
+
diff --git a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java
index a50936531a..6cc57b9005 100644
--- a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java
+++ b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,15 +29,16 @@ import android.os.Bundle;
 import android.provider.ContactsContract.CommonDataKinds.Nickname;
 import android.provider.ContactsContract.CommonDataKinds.Organization;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.support.v4.util.ArraySet;
 import android.text.TextUtils;
 import android.util.ArrayMap;
 
 import androidx.annotation.IntDef;
 import androidx.annotation.Nullable;
+import androidx.collection.ArraySet;
 
 import com.android.dialer.searchfragment.common.Projections;
 import com.android.dialer.searchfragment.common.QueryFilteringUtil;
+
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
diff --git a/java/com/android/dialer/searchfragment/cp2/ContactTernarySearchTree.java b/java/com/android/dialer/searchfragment/cp2/ContactTernarySearchTree.java
index 88738e281d..8cfe6f669d 100644
--- a/java/com/android/dialer/searchfragment/cp2/ContactTernarySearchTree.java
+++ b/java/com/android/dialer/searchfragment/cp2/ContactTernarySearchTree.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +17,10 @@
 
 package com.android.dialer.searchfragment.cp2;
 
-import android.support.v4.util.ArraySet;
 import android.text.TextUtils;
+
+import androidx.collection.ArraySet;
+
 import java.util.Set;
 
 /** Ternary Search Tree for searching a list of contacts. */
diff --git a/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java b/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java
index f79b882cc5..49d0b2e57a 100644
--- a/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java
+++ b/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +23,6 @@ import android.database.Cursor;
 import android.net.Uri;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.provider.ContactsContract.Contacts;
-import android.support.v7.widget.RecyclerView.ViewHolder;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -30,7 +30,7 @@ import android.widget.ImageView;
 import android.widget.QuickContactBadge;
 
 import androidx.annotation.IntDef;
-import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.dialer.common.Assert;
 import com.android.dialer.contactphoto.ContactPhotoManager;
@@ -42,11 +42,13 @@ import com.android.dialer.searchfragment.common.R;
 import com.android.dialer.searchfragment.common.RowClickListener;
 import com.android.dialer.searchfragment.common.SearchCursor;
 import com.android.dialer.widget.BidiTextView;
+
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
 /** ViewHolder for a contact row. */
-public final class SearchContactViewHolder extends ViewHolder implements OnClickListener {
+public final class SearchContactViewHolder extends RecyclerView.ViewHolder
+        implements OnClickListener {
 
   /** IntDef for the different types of actions that can be shown. */
   @Retention(RetentionPolicy.SOURCE)
diff --git a/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java b/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java
index 275a093fff..d147605bad 100644
--- a/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java
+++ b/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +18,6 @@
 package com.android.dialer.searchfragment.cp2;
 
 import android.content.Context;
-import android.content.CursorLoader;
 import android.database.Cursor;
 import android.database.MatrixCursor;
 import android.database.MergeCursor;
@@ -28,6 +28,7 @@ import android.text.TextUtils;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.loader.content.CursorLoader;
 
 import com.android.dialer.R;
 import com.android.dialer.common.LogUtil;
diff --git a/java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java b/java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java
index ae8e3d3cb9..958ecb2cb5 100644
--- a/java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java
+++ b/java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java
@@ -1,32 +1,33 @@
 /*
-
-* Copyright (C) 2017 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License
-*/
+ * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS 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.searchfragment.directories;
 
 import android.content.Context;
-import android.content.CursorLoader;
 import android.database.Cursor;
 import android.provider.ContactsContract;
 
 import androidx.annotation.Nullable;
+import androidx.loader.content.CursorLoader;
 
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.util.PermissionsUtil;
 import com.google.auto.value.AutoValue;
+
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/java/com/android/dialer/searchfragment/directories/DirectoryContactViewHolder.java b/java/com/android/dialer/searchfragment/directories/DirectoryContactViewHolder.java
index 29127ffcee..8a212957bb 100644
--- a/java/com/android/dialer/searchfragment/directories/DirectoryContactViewHolder.java
+++ b/java/com/android/dialer/searchfragment/directories/DirectoryContactViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,12 +24,14 @@ import android.net.Uri;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.provider.ContactsContract.Contacts;
-import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.QuickContactBadge;
 import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+
 import com.android.dialer.common.cp2.DirectoryUtils;
 import com.android.dialer.contactphoto.ContactPhotoManager;
 import com.android.dialer.lettertile.LetterTileDrawable;
diff --git a/java/com/android/dialer/searchfragment/directories/DirectoryContactsCursorLoader.java b/java/com/android/dialer/searchfragment/directories/DirectoryContactsCursorLoader.java
index 5ef5de8d6a..d47ce4ebe4 100644
--- a/java/com/android/dialer/searchfragment/directories/DirectoryContactsCursorLoader.java
+++ b/java/com/android/dialer/searchfragment/directories/DirectoryContactsCursorLoader.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +18,6 @@
 package com.android.dialer.searchfragment.directories;
 
 import android.content.Context;
-import android.content.CursorLoader;
 import android.database.Cursor;
 import android.database.MatrixCursor;
 import android.net.Uri;
@@ -25,10 +25,12 @@ import android.provider.ContactsContract;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 
 import androidx.annotation.NonNull;
+import androidx.loader.content.CursorLoader;
 
 import com.android.dialer.common.cp2.DirectoryUtils;
 import com.android.dialer.searchfragment.common.Projections;
 import com.android.dialer.searchfragment.directories.DirectoriesCursorLoader.Directory;
+
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/java/com/android/dialer/searchfragment/list/HeaderViewHolder.java b/java/com/android/dialer/searchfragment/list/HeaderViewHolder.java
index dd35b13eec..b1d3301f29 100644
--- a/java/com/android/dialer/searchfragment/list/HeaderViewHolder.java
+++ b/java/com/android/dialer/searchfragment/list/HeaderViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,10 +17,13 @@
 
 package com.android.dialer.searchfragment.list;
 
-import android.support.v7.widget.RecyclerView;
 import android.view.View;
 import android.widget.TextView;
 
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.dialer.R;
+
 /** ViewHolder for header rows in {@link NewSearchFragment}. */
 final class HeaderViewHolder extends RecyclerView.ViewHolder {
 
diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
index 7a05c9524c..fca096b2ad 100644
--- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
+++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,16 +19,9 @@ package com.android.dialer.searchfragment.list;
 
 import static android.Manifest.permission.ACCESS_FINE_LOCATION;
 
-import android.app.Fragment;
-import android.app.LoaderManager.LoaderCallbacks;
-import android.content.Intent;
-import android.content.Loader;
 import android.content.pm.PackageManager;
 import android.database.Cursor;
 import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -41,8 +35,13 @@ import android.widget.FrameLayout.LayoutParams;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.loader.app.LoaderManager;
+import androidx.loader.content.Loader;
+import androidx.preference.PreferenceManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
 
-import com.android.contacts.common.extensions.PhoneDirectoryExtender;
 import com.android.contacts.common.extensions.PhoneDirectoryExtenderAccessor;
 import com.android.dialer.R;
 import com.android.dialer.animation.AnimUtils;
@@ -53,7 +52,6 @@ import com.android.dialer.common.Assert;
 import com.android.dialer.common.FragmentUtils;
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.common.concurrent.ThreadUtil;
-import com.android.dialer.dialercontact.DialerContact;
 import com.android.dialer.precall.PreCall;
 import com.android.dialer.searchfragment.common.RowClickListener;
 import com.android.dialer.searchfragment.common.SearchCursor;
@@ -64,11 +62,11 @@ import com.android.dialer.searchfragment.directories.DirectoryContactsCursorLoad
 import com.android.dialer.searchfragment.list.SearchActionViewHolder.Action;
 import com.android.dialer.searchfragment.nearbyplaces.NearbyPlacesCursorLoader;
 import com.android.dialer.util.CallUtil;
-import com.android.dialer.util.DialerUtils;
 import com.android.dialer.util.PermissionsUtil;
 import com.android.dialer.util.ViewUtil;
 import com.android.dialer.widget.EmptyContentView;
 import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClickedListener;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -76,7 +74,7 @@ import java.util.List;
 
 /** Fragment used for searching contacts. */
 public final class NewSearchFragment extends Fragment
-    implements LoaderCallbacks,
+    implements LoaderManager.LoaderCallbacks,
         OnEmptyViewActionButtonClickedListener,
         OnTouchListener,
         RowClickListener {
@@ -116,19 +114,19 @@ public final class NewSearchFragment extends Fragment
   private final Runnable loaderCp2ContactsRunnable =
       () -> {
         if (getHost() != null) {
-          getLoaderManager().restartLoader(CONTACTS_LOADER_ID, null, this);
+          LoaderManager.getInstance(this).restartLoader(CONTACTS_LOADER_ID, null, this);
         }
       };
   private final Runnable loadNearbyPlacesRunnable =
       () -> {
         if (getHost() != null) {
-          getLoaderManager().restartLoader(NEARBY_PLACES_LOADER_ID, null, this);
+          LoaderManager.getInstance(this).restartLoader(NEARBY_PLACES_LOADER_ID, null, this);
         }
       };
   private final Runnable loadDirectoryContactsRunnable =
       () -> {
         if (getHost() != null) {
-          getLoaderManager().restartLoader(DIRECTORY_CONTACTS_LOADER_ID, null, this);
+          LoaderManager.getInstance(this).restartLoader(DIRECTORY_CONTACTS_LOADER_ID, null, this);
         }
       };
   private final Runnable capabilitiesUpdatedRunnable = () -> adapter.notifyDataSetChanged();
@@ -184,7 +182,7 @@ public final class NewSearchFragment extends Fragment
   }
 
   private void initLoaders() {
-    getLoaderManager().initLoader(CONTACTS_LOADER_ID, null, this);
+    LoaderManager.getInstance(this).initLoader(CONTACTS_LOADER_ID, null, this);
     loadDirectoriesCursor();
   }
 
@@ -365,7 +363,7 @@ public final class NewSearchFragment extends Fragment
 
   /** Loads info about all directories (local & remote). */
   private void loadDirectoriesCursor() {
-    getLoaderManager().initLoader(DIRECTORIES_LOADER_ID, null, this);
+    LoaderManager.getInstance(this).initLoader(DIRECTORIES_LOADER_ID, null, this);
   }
 
   /**
@@ -441,7 +439,7 @@ public final class NewSearchFragment extends Fragment
   @Override
   public void onResume() {
     super.onResume();
-    getLoaderManager().restartLoader(CONTACTS_LOADER_ID, null, this);
+    LoaderManager.getInstance(this).restartLoader(CONTACTS_LOADER_ID, null, this);
   }
 
   @Override
diff --git a/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java b/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java
index eeeff116be..b8e862bdd6 100644
--- a/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java
+++ b/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +19,6 @@ package com.android.dialer.searchfragment.list;
 
 import android.content.Context;
 import android.content.Intent;
-import android.support.v7.widget.RecyclerView;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.ImageView;
@@ -26,12 +26,14 @@ import android.widget.TextView;
 
 import androidx.annotation.IntDef;
 import androidx.annotation.StringRes;
+import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
 import com.android.dialer.searchfragment.common.RowClickListener;
 import com.android.dialer.util.DialerUtils;
 import com.android.dialer.util.IntentUtil;
+
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
diff --git a/java/com/android/dialer/searchfragment/list/SearchAdapter.java b/java/com/android/dialer/searchfragment/list/SearchAdapter.java
index cc22b0a3ef..009ca64496 100644
--- a/java/com/android/dialer/searchfragment/list/SearchAdapter.java
+++ b/java/com/android/dialer/searchfragment/list/SearchAdapter.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,8 +18,6 @@
 package com.android.dialer.searchfragment.list;
 
 import android.content.Context;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.RecyclerView.ViewHolder;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -26,6 +25,8 @@ import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 
 import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView.ViewHolder;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
@@ -35,6 +36,7 @@ import com.android.dialer.searchfragment.cp2.SearchContactViewHolder;
 import com.android.dialer.searchfragment.directories.DirectoryContactViewHolder;
 import com.android.dialer.searchfragment.list.SearchCursorManager.RowType;
 import com.android.dialer.searchfragment.nearbyplaces.NearbyPlaceViewHolder;
+
 import java.util.List;
 
 /** RecyclerView adapter for {@link NewSearchFragment}. */
diff --git a/java/com/android/dialer/searchfragment/list/res/layout/fragment_search.xml b/java/com/android/dialer/searchfragment/list/res/layout/fragment_search.xml
index 30370674c2..919eea7b5f 100644
--- a/java/com/android/dialer/searchfragment/list/res/layout/fragment_search.xml
+++ b/java/com/android/dialer/searchfragment/list/res/layout/fragment_search.xml
@@ -1,6 +1,7 @@
 
 
 
diff --git a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java
index 968c1957f8..1bb3b19c59 100644
--- a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java
+++ b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,10 +21,12 @@ import android.content.Context;
 import android.net.Uri;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.Contacts;
-import android.support.v7.widget.RecyclerView;
 import android.view.View;
 import android.widget.QuickContactBadge;
 import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+
 import com.android.contacts.common.util.Constants;
 import com.android.dialer.contactphoto.ContactPhotoManager;
 import com.android.dialer.lettertile.LetterTileDrawable;
diff --git a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlacesCursorLoader.java b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlacesCursorLoader.java
index b71a50181e..e5bccc8737 100644
--- a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlacesCursorLoader.java
+++ b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlacesCursorLoader.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,12 +18,12 @@
 package com.android.dialer.searchfragment.nearbyplaces;
 
 import android.content.Context;
-import android.content.CursorLoader;
 import android.database.Cursor;
 import android.net.Uri;
 import android.provider.ContactsContract;
 
 import androidx.annotation.NonNull;
+import androidx.loader.content.CursorLoader;
 
 import com.android.contacts.common.extensions.PhoneDirectoryExtenderAccessor;
 import com.android.dialer.common.LogUtil;
diff --git a/java/com/android/dialer/searchfragment/nearbyplaces/res/layout/location_permission_row.xml b/java/com/android/dialer/searchfragment/nearbyplaces/res/layout/location_permission_row.xml
index 50d2ac06bf..8c022b6df8 100644
--- a/java/com/android/dialer/searchfragment/nearbyplaces/res/layout/location_permission_row.xml
+++ b/java/com/android/dialer/searchfragment/nearbyplaces/res/layout/location_permission_row.xml
@@ -1,6 +1,7 @@
 
 
-
   
-
+
diff --git a/java/com/android/dialer/shortcuts/CallContactActivity.java b/java/com/android/dialer/shortcuts/CallContactActivity.java
index a6bd8363a8..087475291f 100644
--- a/java/com/android/dialer/shortcuts/CallContactActivity.java
+++ b/java/com/android/dialer/shortcuts/CallContactActivity.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +20,11 @@ package com.android.dialer.shortcuts;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.Bundle;
-import android.support.v4.app.ActivityCompat;
 import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.core.app.ActivityCompat;
+
 import com.android.dialer.callintent.CallInitiationType;
 import com.android.dialer.callintent.CallSpecificAppData;
 import com.android.dialer.common.LogUtil;
@@ -105,7 +109,7 @@ public class CallContactActivity extends TransactionSafeActivity
   }
 
   @Override
-  public void onSaveInstanceState(Bundle outState) {
+  public void onSaveInstanceState(@NonNull Bundle outState) {
     super.onSaveInstanceState(outState);
     outState.putParcelable(CONTACT_URI_KEY, contactUri);
   }
diff --git a/java/com/android/dialer/shortcuts/DynamicShortcuts.java b/java/com/android/dialer/shortcuts/DynamicShortcuts.java
index cb0de7d1b1..ceb1a699c5 100644
--- a/java/com/android/dialer/shortcuts/DynamicShortcuts.java
+++ b/java/com/android/dialer/shortcuts/DynamicShortcuts.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,15 +22,16 @@ import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.pm.ShortcutInfo;
 import android.content.pm.ShortcutManager;
-import android.support.v4.content.ContextCompat;
 import android.util.ArrayMap;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.WorkerThread;
+import androidx.core.content.ContextCompat;
 
 import com.android.contacts.common.list.ContactEntry;
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
diff --git a/java/com/android/dialer/shortcuts/PeriodicJobService.java b/java/com/android/dialer/shortcuts/PeriodicJobService.java
index 2d08e36df9..038a820322 100644
--- a/java/com/android/dialer/shortcuts/PeriodicJobService.java
+++ b/java/com/android/dialer/shortcuts/PeriodicJobService.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,14 +23,15 @@ import android.app.job.JobScheduler;
 import android.app.job.JobService;
 import android.content.ComponentName;
 import android.content.Context;
-import android.support.v4.os.UserManagerCompat;
 
 import androidx.annotation.MainThread;
 import androidx.annotation.NonNull;
+import androidx.core.os.UserManagerCompat;
 
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.constants.ScheduledJobIds;
+
 import java.util.concurrent.TimeUnit;
 
 /**
diff --git a/java/com/android/dialer/shortcuts/PinnedShortcuts.java b/java/com/android/dialer/shortcuts/PinnedShortcuts.java
index 7201f95269..8e075a6650 100644
--- a/java/com/android/dialer/shortcuts/PinnedShortcuts.java
+++ b/java/com/android/dialer/shortcuts/PinnedShortcuts.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,15 +25,16 @@ import android.content.pm.ShortcutManager;
 import android.database.Cursor;
 import android.net.Uri;
 import android.provider.ContactsContract.Contacts;
-import android.support.v4.content.ContextCompat;
 import android.util.ArrayMap;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.WorkerThread;
+import androidx.core.content.ContextCompat;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
diff --git a/java/com/android/dialer/shortcuts/ShortcutUsageReporter.java b/java/com/android/dialer/shortcuts/ShortcutUsageReporter.java
index 439440f96d..3cd719b632 100644
--- a/java/com/android/dialer/shortcuts/ShortcutUsageReporter.java
+++ b/java/com/android/dialer/shortcuts/ShortcutUsageReporter.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,13 +26,13 @@ import android.net.Uri;
 import android.os.AsyncTask;
 import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.PhoneLookup;
-import android.support.v4.content.ContextCompat;
 import android.text.TextUtils;
 
 import androidx.annotation.MainThread;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.annotation.WorkerThread;
+import androidx.core.content.ContextCompat;
 
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
diff --git a/java/com/android/dialer/simulator/Simulator.java b/java/com/android/dialer/simulator/Simulator.java
index 14bc73b315..3b0a70526c 100644
--- a/java/com/android/dialer/simulator/Simulator.java
+++ b/java/com/android/dialer/simulator/Simulator.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,12 +17,12 @@
 
 package com.android.dialer.simulator;
 
-import android.support.v7.app.AppCompatActivity;
 import android.view.ActionProvider;
 
 import androidx.annotation.IntDef;
 import androidx.annotation.Nullable;
 import androidx.annotation.StringDef;
+import androidx.appcompat.app.AppCompatActivity;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
diff --git a/java/com/android/dialer/simulator/impl/SimulatorDialogFragment.java b/java/com/android/dialer/simulator/impl/SimulatorDialogFragment.java
index dcf8032503..3afcbfa209 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorDialogFragment.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorDialogFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,10 +20,13 @@ package com.android.dialer.simulator.impl;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.os.Bundle;
-import android.support.v4.app.DialogFragment;
 import android.telecom.TelecomManager;
 import android.widget.EditText;
 
+import androidx.fragment.app.DialogFragment;
+
+import com.android.dialer.R;
+
 /** Holds dialog logic for creating different types of voice calls. */
 public final class SimulatorDialogFragment extends DialogFragment {
 
diff --git a/java/com/android/dialer/simulator/impl/SimulatorImpl.java b/java/com/android/dialer/simulator/impl/SimulatorImpl.java
index 9519ba8b13..8e40885d5f 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorImpl.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorImpl.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,10 +17,13 @@
 
 package com.android.dialer.simulator.impl;
 
-import android.support.v7.app.AppCompatActivity;
 import android.view.ActionProvider;
+
+import androidx.appcompat.app.AppCompatActivity;
+
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.simulator.Simulator;
+
 import javax.inject.Inject;
 
 /** The entry point for the simulator feature. */
diff --git a/java/com/android/dialer/simulator/impl/SimulatorMainPortal.java b/java/com/android/dialer/simulator/impl/SimulatorMainPortal.java
index f0489ab9c0..9667f21bc1 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorMainPortal.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorMainPortal.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,10 +18,12 @@
 package com.android.dialer.simulator.impl;
 
 import android.content.Context;
-import android.support.v7.app.AppCompatActivity;
 import android.telecom.TelecomManager;
 import android.telecom.VideoProfile;
 import android.view.ActionProvider;
+
+import androidx.appcompat.app.AppCompatActivity;
+
 import com.android.dialer.common.concurrent.DialerExecutorComponent;
 import com.android.dialer.simulator.Simulator;
 import com.android.dialer.simulator.SimulatorComponent;
diff --git a/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java b/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java
index 902b9d74d5..2db8fe122d 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,13 +19,13 @@ package com.android.dialer.simulator.impl;
 
 import android.content.Context;
 import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
 import android.telecom.Connection;
 import android.telecom.Connection.RttModifyStatus;
 import android.telecom.DisconnectCause;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
 
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
diff --git a/java/com/android/dialer/smartdial/map/BulgarianSmartDialMap.java b/java/com/android/dialer/smartdial/map/BulgarianSmartDialMap.java
index 5be9761a1b..d34d325b69 100644
--- a/java/com/android/dialer/smartdial/map/BulgarianSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/BulgarianSmartDialMap.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +17,8 @@
 
 package com.android.dialer.smartdial.map;
 
-import android.support.v4.util.SimpleArrayMap;
+import androidx.collection.SimpleArrayMap;
+
 import com.android.dialer.dialpadview.DialpadCharMappings;
 import com.google.common.base.Optional;
 
diff --git a/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java b/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java
index ace9b09cc2..b47ea88a02 100644
--- a/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +18,9 @@
 package com.android.dialer.smartdial.map;
 
 import android.content.Context;
-import android.support.v4.util.SimpleArrayMap;
+
+import androidx.collection.SimpleArrayMap;
+
 import com.android.dialer.i18n.LocaleUtils;
 import com.google.common.base.Optional;
 
diff --git a/java/com/android/dialer/smartdial/map/LatinSmartDialMap.java b/java/com/android/dialer/smartdial/map/LatinSmartDialMap.java
index b8ef951c51..aa60f4f167 100644
--- a/java/com/android/dialer/smartdial/map/LatinSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/LatinSmartDialMap.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +17,8 @@
 
 package com.android.dialer.smartdial.map;
 
-import android.support.v4.util.SimpleArrayMap;
+import androidx.collection.SimpleArrayMap;
+
 import com.android.dialer.dialpadview.DialpadCharMappings;
 import com.google.common.base.Optional;
 
diff --git a/java/com/android/dialer/smartdial/map/RussianSmartDialMap.java b/java/com/android/dialer/smartdial/map/RussianSmartDialMap.java
index c10bbb0cee..914f2f39fe 100644
--- a/java/com/android/dialer/smartdial/map/RussianSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/RussianSmartDialMap.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +17,8 @@
 
 package com.android.dialer.smartdial.map;
 
-import android.support.v4.util.SimpleArrayMap;
+import androidx.collection.SimpleArrayMap;
+
 import com.android.dialer.dialpadview.DialpadCharMappings;
 import com.google.common.base.Optional;
 
diff --git a/java/com/android/dialer/smartdial/map/SmartDialMap.java b/java/com/android/dialer/smartdial/map/SmartDialMap.java
index c74dd28939..dc9eeb7517 100644
--- a/java/com/android/dialer/smartdial/map/SmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/SmartDialMap.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +17,8 @@
 
 package com.android.dialer.smartdial.map;
 
-import android.support.v4.util.SimpleArrayMap;
+import androidx.collection.SimpleArrayMap;
+
 import com.google.common.base.Optional;
 
 /** Definition for utilities that supports smart dial in different languages. */
diff --git a/java/com/android/dialer/smartdial/map/UkrainianSmartDialMap.java b/java/com/android/dialer/smartdial/map/UkrainianSmartDialMap.java
index 844732c32c..69d2ccf7f5 100644
--- a/java/com/android/dialer/smartdial/map/UkrainianSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/UkrainianSmartDialMap.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +17,8 @@
 
 package com.android.dialer.smartdial.map;
 
-import android.support.v4.util.SimpleArrayMap;
+import androidx.collection.SimpleArrayMap;
+
 import com.android.dialer.dialpadview.DialpadCharMappings;
 import com.google.common.base.Optional;
 
diff --git a/java/com/android/dialer/smartdial/util/SmartDialPrefix.java b/java/com/android/dialer/smartdial/util/SmartDialPrefix.java
index e28d5a4486..0089fd416d 100644
--- a/java/com/android/dialer/smartdial/util/SmartDialPrefix.java
+++ b/java/com/android/dialer/smartdial/util/SmartDialPrefix.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,10 +19,13 @@ package com.android.dialer.smartdial.util;
 
 import android.content.Context;
 import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
+
+import androidx.preference.PreferenceManager;
+
 import com.android.dialer.smartdial.map.CompositeSmartDialMap;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Set;
diff --git a/java/com/android/dialer/speeddial/ContextMenu.java b/java/com/android/dialer/speeddial/ContextMenu.java
index a07dd751d9..eda85ae428 100644
--- a/java/com/android/dialer/speeddial/ContextMenu.java
+++ b/java/com/android/dialer/speeddial/ContextMenu.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,14 +18,13 @@
 package com.android.dialer.speeddial;
 
 import android.content.Context;
-import android.support.v7.widget.PopupMenu;
-import android.support.v7.widget.PopupMenu.OnMenuItemClickListener;
 import android.text.TextUtils;
 import android.view.Gravity;
 import android.view.MenuItem;
 import android.view.View;
 
 import androidx.annotation.NonNull;
+import androidx.appcompat.widget.PopupMenu;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
@@ -32,7 +32,7 @@ import com.android.dialer.speeddial.database.SpeedDialEntry.Channel;
 import com.android.dialer.speeddial.loader.SpeedDialUiItem;
 
 /** {@link PopupMenu} which presents contact options for starred contacts. */
-public class ContextMenu extends PopupMenu implements OnMenuItemClickListener {
+public class ContextMenu extends PopupMenu implements PopupMenu.OnMenuItemClickListener {
 
   private final ContextMenuItemListener listener;
 
diff --git a/java/com/android/dialer/speeddial/DisambigDialog.java b/java/com/android/dialer/speeddial/DisambigDialog.java
index cff54e7a09..e4fe34b142 100644
--- a/java/com/android/dialer/speeddial/DisambigDialog.java
+++ b/java/com/android/dialer/speeddial/DisambigDialog.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,9 +20,6 @@ package com.android.dialer.speeddial;
 import android.app.Dialog;
 import android.content.Context;
 import android.os.Bundle;
-import android.support.v4.app.DialogFragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v7.app.AlertDialog;
 import android.util.ArraySet;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -31,6 +29,9 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import androidx.annotation.WorkerThread;
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.DialogFragment;
+import androidx.fragment.app.FragmentManager;
 
 import com.android.dialer.R;
 import com.android.dialer.callintent.CallInitiationType;
@@ -47,6 +48,7 @@ import com.android.dialer.speeddial.loader.SpeedDialUiItem;
 import com.google.common.collect.ImmutableList;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+
 import java.util.List;
 import java.util.Set;
 
diff --git a/java/com/android/dialer/speeddial/FavoritesViewHolder.java b/java/com/android/dialer/speeddial/FavoritesViewHolder.java
index 600c8c734a..2f43d81e19 100644
--- a/java/com/android/dialer/speeddial/FavoritesViewHolder.java
+++ b/java/com/android/dialer/speeddial/FavoritesViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,8 +19,6 @@ package com.android.dialer.speeddial;
 
 import android.content.Context;
 import android.provider.ContactsContract.Contacts;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.helper.ItemTouchHelper;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.View.OnLongClickListener;
@@ -27,6 +26,11 @@ import android.view.ViewConfiguration;
 import android.widget.FrameLayout;
 import android.widget.QuickContactBadge;
 import android.widget.TextView;
+
+import androidx.recyclerview.widget.ItemTouchHelper;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.dialer.R;
 import com.android.dialer.common.Assert;
 import com.android.dialer.glidephotomanager.GlidePhotoManagerComponent;
 import com.android.dialer.glidephotomanager.PhotoInfo;
diff --git a/java/com/android/dialer/speeddial/HeaderViewHolder.java b/java/com/android/dialer/speeddial/HeaderViewHolder.java
index e89dffbb4a..6443f2dee1 100644
--- a/java/com/android/dialer/speeddial/HeaderViewHolder.java
+++ b/java/com/android/dialer/speeddial/HeaderViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,13 +17,13 @@
 
 package com.android.dialer.speeddial;
 
-import android.support.v7.widget.RecyclerView;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.TextView;
 
 import androidx.annotation.StringRes;
+import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.dialer.R;
 
diff --git a/java/com/android/dialer/speeddial/RemoveViewHolder.java b/java/com/android/dialer/speeddial/RemoveViewHolder.java
index 998e1ae2fe..670c026fa1 100644
--- a/java/com/android/dialer/speeddial/RemoveViewHolder.java
+++ b/java/com/android/dialer/speeddial/RemoveViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,10 +17,11 @@
 
 package com.android.dialer.speeddial;
 
-import android.support.v7.widget.RecyclerView;
 import android.view.View;
 import android.view.View.OnClickListener;
 
+import androidx.recyclerview.widget.RecyclerView;
+
 /** ViewHolder for headers in {@link SpeedDialFragment}. */
 public class RemoveViewHolder extends RecyclerView.ViewHolder implements OnClickListener {
 
diff --git a/java/com/android/dialer/speeddial/SpeedDialAdapter.java b/java/com/android/dialer/speeddial/SpeedDialAdapter.java
index 2cc48aebcc..de0172fed4 100644
--- a/java/com/android/dialer/speeddial/SpeedDialAdapter.java
+++ b/java/com/android/dialer/speeddial/SpeedDialAdapter.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,10 +18,6 @@
 package com.android.dialer.speeddial;
 
 import android.content.Context;
-import android.support.v7.widget.GridLayoutManager.SpanSizeLookup;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.RecyclerView.ViewHolder;
-import android.support.v7.widget.helper.ItemTouchHelper;
 import android.util.ArrayMap;
 import android.view.LayoutInflater;
 import android.view.ViewGroup;
@@ -30,6 +27,10 @@ import android.widget.FrameLayout;
 import androidx.annotation.IntDef;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.ItemTouchHelper;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView.ViewHolder;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
@@ -40,6 +41,7 @@ import com.android.dialer.speeddial.SuggestionViewHolder.SuggestedContactsListen
 import com.android.dialer.speeddial.draghelper.SpeedDialItemTouchHelperCallback.ItemTouchHelperAdapter;
 import com.android.dialer.speeddial.loader.SpeedDialUiItem;
 import com.google.common.collect.ImmutableList;
+
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
@@ -214,8 +216,8 @@ public final class SpeedDialAdapter extends RecyclerView.Adapter
 
 
+      android:layout_centerVertical="true"
+      app:tint="?colorIcon" />
 
diff --git a/java/com/android/dialer/speeddial/res/layout/favorite_remove_view_layout.xml b/java/com/android/dialer/speeddial/res/layout/favorite_remove_view_layout.xml
index 47343c77c1..f78b864740 100644
--- a/java/com/android/dialer/speeddial/res/layout/favorite_remove_view_layout.xml
+++ b/java/com/android/dialer/speeddial/res/layout/favorite_remove_view_layout.xml
@@ -1,6 +1,7 @@
 
 
 
 
 
+      android:contentDescription="@string/content_description_overflow"
+      app:tint="?colorIcon" />
 
diff --git a/java/com/android/dialer/storage/StorageModule.java b/java/com/android/dialer/storage/StorageModule.java
index e1c5b4b08f..8a734a0e77 100644
--- a/java/com/android/dialer/storage/StorageModule.java
+++ b/java/com/android/dialer/storage/StorageModule.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,12 +18,16 @@ package com.android.dialer.storage;
 
 import android.content.Context;
 import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.support.v4.content.ContextCompat;
+
+import androidx.core.content.ContextCompat;
+import androidx.preference.PreferenceManager;
+
 import com.android.dialer.inject.ApplicationContext;
+
+import javax.inject.Singleton;
+
 import dagger.Module;
 import dagger.Provides;
-import javax.inject.Singleton;
 
 /** Module for the storage component. */
 @Module
diff --git a/java/com/android/dialer/telecom/TelecomUtil.java b/java/com/android/dialer/telecom/TelecomUtil.java
index 7867820ded..2d75973ac6 100644
--- a/java/com/android/dialer/telecom/TelecomUtil.java
+++ b/java/com/android/dialer/telecom/TelecomUtil.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,7 +27,6 @@ import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.UserHandle;
 import android.provider.CallLog.Calls;
-import android.support.v4.content.ContextCompat;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
@@ -38,9 +38,11 @@ import android.util.Pair;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.annotation.RequiresPermission;
+import androidx.core.content.ContextCompat;
 
 import com.android.dialer.common.LogUtil;
 import com.google.common.base.Optional;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
diff --git a/java/com/android/dialer/util/DrawableConverter.java b/java/com/android/dialer/util/DrawableConverter.java
index 03c9b67ffb..22fe22c8bb 100644
--- a/java/com/android/dialer/util/DrawableConverter.java
+++ b/java/com/android/dialer/util/DrawableConverter.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,11 +22,11 @@ import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
-import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
-import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.core.graphics.drawable.RoundedBitmapDrawable;
+import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
 
 import com.android.dialer.common.LogUtil;
 
diff --git a/java/com/android/dialer/util/PermissionsUtil.java b/java/com/android/dialer/util/PermissionsUtil.java
index 76bc5b1758..c526b6afd8 100644
--- a/java/com/android/dialer/util/PermissionsUtil.java
+++ b/java/com/android/dialer/util/PermissionsUtil.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,15 +37,16 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.pm.PackageManager;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.content.LocalBroadcastManager;
 import android.widget.Toast;
 
 import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 
 import com.android.dialer.R;
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.storage.StorageComponent;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
diff --git a/java/com/android/dialer/util/SettingsUtil.java b/java/com/android/dialer/util/SettingsUtil.java
index 5043c3d562..ceaa0f092a 100644
--- a/java/com/android/dialer/util/SettingsUtil.java
+++ b/java/com/android/dialer/util/SettingsUtil.java
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- *
+ * Copyright (C) 2023 The LineageOS 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
@@ -23,10 +24,13 @@ import android.media.Ringtone;
 import android.media.RingtoneManager;
 import android.net.Uri;
 import android.os.Handler;
-import android.preference.PreferenceManager;
 import android.provider.Settings;
 import android.text.TextUtils;
 
+import androidx.preference.PreferenceManager;
+
+import com.android.dialer.R;
+
 public class SettingsUtil {
 
   private static final String DEFAULT_NOTIFICATION_URI_STRING =
diff --git a/java/com/android/dialer/util/TransactionSafeActivity.java b/java/com/android/dialer/util/TransactionSafeActivity.java
index aa472493b6..9ea1a9b75b 100644
--- a/java/com/android/dialer/util/TransactionSafeActivity.java
+++ b/java/com/android/dialer/util/TransactionSafeActivity.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +18,9 @@ package com.android.dialer.util;
 
 import android.app.Activity;
 import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
 
 /**
  * A common superclass that keeps track of whether an {@link Activity} has saved its state yet or
@@ -46,7 +49,7 @@ public abstract class TransactionSafeActivity extends AppCompatActivity {
   }
 
   @Override
-  protected void onSaveInstanceState(Bundle outState) {
+  protected void onSaveInstanceState(@NonNull Bundle outState) {
     super.onSaveInstanceState(outState);
     isSafeToCommitTransactions = false;
   }
diff --git a/java/com/android/dialer/voicemail/listui/error/OmtpVoicemailMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/OmtpVoicemailMessageCreator.java
index 03ec86a094..edeb5f69b8 100644
--- a/java/com/android/dialer/voicemail/listui/error/OmtpVoicemailMessageCreator.java
+++ b/java/com/android/dialer/voicemail/listui/error/OmtpVoicemailMessageCreator.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,11 +18,11 @@
 package com.android.dialer.voicemail.listui.error;
 
 import android.content.Context;
-import android.preference.PreferenceManager;
 import android.provider.VoicemailContract.Status;
 import android.telecom.PhoneAccountHandle;
 
 import androidx.annotation.Nullable;
+import androidx.preference.PreferenceManager;
 
 import com.android.dialer.R;
 import com.android.dialer.common.LogUtil;
@@ -29,6 +30,7 @@ import com.android.dialer.common.PerAccountSharedPreferences;
 import com.android.dialer.voicemail.listui.error.VoicemailErrorMessage.Action;
 import com.android.voicemail.VoicemailClient;
 import com.android.voicemail.VoicemailComponent;
+
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java
index 4749f3a3b5..63cee71ea5 100644
--- a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java
+++ b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +23,6 @@ import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
 import android.telecom.PhoneAccountHandle;
 import android.telephony.TelephonyManager;
 import android.text.Layout;
@@ -36,6 +36,7 @@ import android.view.View;
 import android.view.View.OnClickListener;
 
 import androidx.annotation.Nullable;
+import androidx.preference.PreferenceManager;
 
 import com.android.dialer.R;
 import com.android.dialer.common.LogUtil;
@@ -45,6 +46,7 @@ import com.android.voicemail.VisualVoicemailTypeExtensions;
 import com.android.voicemail.VoicemailClient;
 import com.android.voicemail.VoicemailComponent;
 import com.android.voicemail.VoicemailVersionConstants;
+
 import java.util.Locale;
 
 /**
diff --git a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml
index dab2f21137..e70e749255 100644
--- a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml
+++ b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml
@@ -1,5 +1,6 @@
 
 
-
   
-
+
diff --git a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_tos_fragment.xml b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_tos_fragment.xml
index 17a1f74b61..0882717837 100644
--- a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_tos_fragment.xml
+++ b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_tos_fragment.xml
@@ -1,5 +1,6 @@
 
 
 
+        tools:ignore="ContentDescription"
+        app:tint="?android:attr/colorBackground" />
   
-
\ No newline at end of file
+
diff --git a/java/com/android/dialer/widget/res/layout/fragment_message.xml b/java/com/android/dialer/widget/res/layout/fragment_message.xml
index f88f2502ed..5e2a00e9e9 100644
--- a/java/com/android/dialer/widget/res/layout/fragment_message.xml
+++ b/java/com/android/dialer/widget/res/layout/fragment_message.xml
@@ -1,6 +1,7 @@
 
 
 
@@ -77,7 +79,7 @@
         android:visibility="gone"
         android:src="@drawable/quantum_ic_send_vd_theme_24"
         android:background="?android:attr/selectableItemBackgroundBorderless"
-        android:tint="@color/dialer_tint_state"/>
+        app:tint="@color/dialer_tint_state" />
 
        preferredAccountWorkerResultListener;
+  private SupportUiListener preferredAccountWorkerResultListener;
 
   private Animation dialpadSlideInAnimation;
   private Animation dialpadSlideOutAnimation;
@@ -178,7 +179,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
 
     preferredAccountWorkerResultListener =
         DialerExecutorComponent.get(this)
-            .createUiListener(getFragmentManager(), "preferredAccountWorkerResultListener");
+            .createUiListener(getSupportFragmentManager(), "preferredAccountWorkerResultListener");
 
     selectPhoneAccountListener = new SelectPhoneAccountListener(getApplicationContext());
 
@@ -230,7 +231,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
 
       SelectPhoneAccountDialogFragment selectPhoneAccountDialogFragment =
           (SelectPhoneAccountDialogFragment)
-              getFragmentManager().findFragmentByTag(Tags.SELECT_ACCOUNT_FRAGMENT);
+              getSupportFragmentManager().findFragmentByTag(Tags.SELECT_ACCOUNT_FRAGMENT);
       if (selectPhoneAccountDialogFragment != null) {
         selectPhoneAccountDialogFragment.setListener(selectPhoneAccountListener);
       }
@@ -376,7 +377,8 @@ public class InCallActivity extends TransactionSafeFragmentActivity
               SelectPhoneAccountDialogFragment.newInstance(
                   result.getDialogOptionsBuilder().get().setCallId(callId).build(),
                   selectPhoneAccountListener);
-          selectPhoneAccountDialogFragment.show(getFragmentManager(), Tags.SELECT_ACCOUNT_FRAGMENT);
+          selectPhoneAccountDialogFragment.show(getSupportFragmentManager(),
+                  Tags.SELECT_ACCOUNT_FRAGMENT);
         },
         throwable -> {
           throw new RuntimeException(throwable);
diff --git a/java/com/android/incallui/InCallDndHandler.java b/java/com/android/incallui/InCallDndHandler.java
index dd4aea3c4e..3aef7720c6 100644
--- a/java/com/android/incallui/InCallDndHandler.java
+++ b/java/com/android/incallui/InCallDndHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The LineageOS Project
+ * Copyright (C) 2018-2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +19,8 @@ package com.android.incallui;
 import android.app.NotificationManager;
 import android.content.Context;
 import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
+
+import androidx.preference.PreferenceManager;
 
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
diff --git a/java/com/android/incallui/InCallVibrationHandler.java b/java/com/android/incallui/InCallVibrationHandler.java
index 0279cca671..092c134f37 100644
--- a/java/com/android/incallui/InCallVibrationHandler.java
+++ b/java/com/android/incallui/InCallVibrationHandler.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2014 The CyanogenMod Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,9 +22,10 @@ import android.content.SharedPreferences;
 import android.os.Handler;
 import android.os.Message;
 import android.os.Vibrator;
-import android.preference.PreferenceManager;
 import android.telecom.DisconnectCause;
 
+import androidx.preference.PreferenceManager;
+
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
 import com.android.incallui.call.state.DialerCallState;
@@ -44,9 +46,9 @@ public class InCallVibrationHandler extends Handler implements
   private DialerCall activeCall;
 
   public InCallVibrationHandler(Context context) {
+    String name = context.getPackageName() + "_preferences";
     prefs = context.createDeviceProtectedStorageContext()
-            .getSharedPreferences(PreferenceManager.getDefaultSharedPreferencesName(context),
-                    Context.MODE_PRIVATE);
+            .getSharedPreferences(name, Context.MODE_PRIVATE);
     vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
   }
 
diff --git a/java/com/android/incallui/ManageConferenceActivity.java b/java/com/android/incallui/ManageConferenceActivity.java
index 6584e4f674..259d11a707 100644
--- a/java/com/android/incallui/ManageConferenceActivity.java
+++ b/java/com/android/incallui/ManageConferenceActivity.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,10 +18,13 @@
 package com.android.incallui;
 
 import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v7.app.AppCompatActivity;
 import android.view.MenuItem;
 
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
+
+import com.android.dialer.R;
+
 /** Shows the {@link ConferenceManagerFragment} */
 public class ManageConferenceActivity extends AppCompatActivity {
 
diff --git a/java/com/android/incallui/PostCharDialogActivity.java b/java/com/android/incallui/PostCharDialogActivity.java
index 445e83c791..6ee755d462 100644
--- a/java/com/android/incallui/PostCharDialogActivity.java
+++ b/java/com/android/incallui/PostCharDialogActivity.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,10 +18,10 @@
 package com.android.incallui;
 
 import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
 
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
diff --git a/java/com/android/incallui/PostCharDialogFragment.java b/java/com/android/incallui/PostCharDialogFragment.java
index 4bcc68e332..228482d6cb 100644
--- a/java/com/android/incallui/PostCharDialogFragment.java
+++ b/java/com/android/incallui/PostCharDialogFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +21,10 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
-import android.support.v4.app.DialogFragment;
+
+import androidx.fragment.app.DialogFragment;
+
+import com.android.dialer.R;
 import com.android.incallui.call.TelecomAdapter;
 
 /**
diff --git a/java/com/android/incallui/RttRequestDialogFragment.java b/java/com/android/incallui/RttRequestDialogFragment.java
index 9a944ea703..4722af0260 100644
--- a/java/com/android/incallui/RttRequestDialogFragment.java
+++ b/java/com/android/incallui/RttRequestDialogFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +21,6 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.os.Bundle;
-import android.support.v4.app.DialogFragment;
 import android.telephony.PhoneNumberUtils;
 import android.text.BidiFormatter;
 import android.text.TextDirectionHeuristics;
@@ -29,6 +29,7 @@ import android.view.View;
 import android.widget.TextView;
 
 import androidx.annotation.NonNull;
+import androidx.fragment.app.DialogFragment;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
@@ -38,6 +39,7 @@ import com.android.incallui.ContactInfoCache.ContactCacheEntry;
 import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback;
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
+
 import java.lang.ref.WeakReference;
 
 /** Dialog that shown to user when receiving RTT request mid call. */
diff --git a/java/com/android/incallui/TransactionSafeFragmentActivity.java b/java/com/android/incallui/TransactionSafeFragmentActivity.java
index 696ecf1bdb..0e2c5afa27 100644
--- a/java/com/android/incallui/TransactionSafeFragmentActivity.java
+++ b/java/com/android/incallui/TransactionSafeFragmentActivity.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +17,10 @@
 
 package com.android.incallui;
 
+import android.app.Activity;
 import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
+
+import androidx.fragment.app.FragmentActivity;
 
 /**
  * A common superclass that keeps track of whether an {@link Activity} has saved its state yet or
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index c04864066b..78eb1b64e5 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,7 +33,6 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Trace;
-import android.support.v4.app.Fragment;
 import android.text.TextUtils;
 import android.transition.TransitionManager;
 import android.view.LayoutInflater;
@@ -52,6 +52,7 @@ import androidx.annotation.FloatRange;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.annotation.StringRes;
+import androidx.fragment.app.Fragment;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
@@ -87,7 +88,7 @@ import com.android.incallui.sessiondata.MultimediaFragment;
 import com.android.incallui.util.AccessibilityUtil;
 import com.android.incallui.video.protocol.VideoCallScreen;
 import com.android.incallui.videotech.utils.VideoUtils;
-import com.google.common.base.Optional;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
diff --git a/java/com/android/incallui/answer/impl/AnswerVideoCallScreen.java b/java/com/android/incallui/answer/impl/AnswerVideoCallScreen.java
index 249ad37019..4b166661f4 100644
--- a/java/com/android/incallui/answer/impl/AnswerVideoCallScreen.java
+++ b/java/com/android/incallui/answer/impl/AnswerVideoCallScreen.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,11 +19,11 @@ package com.android.incallui.answer.impl;
 
 import android.content.res.Configuration;
 import android.graphics.Point;
-import android.support.v4.app.Fragment;
 import android.view.TextureView;
 import android.view.View;
 
 import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
diff --git a/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java b/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java
index 5f440702d4..b6a192be2d 100644
--- a/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java
+++ b/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +23,6 @@ import android.content.DialogInterface;
 import android.content.DialogInterface.OnCancelListener;
 import android.content.DialogInterface.OnShowListener;
 import android.os.Bundle;
-import android.support.v7.app.AppCompatDialogFragment;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.View;
@@ -31,6 +31,7 @@ import android.widget.Button;
 import android.widget.EditText;
 
 import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatDialogFragment;
 
 import com.android.dialer.R;
 import com.android.dialer.common.FragmentUtils;
diff --git a/java/com/android/incallui/answer/impl/SelfManagedAnswerVideoCallScreen.java b/java/com/android/incallui/answer/impl/SelfManagedAnswerVideoCallScreen.java
index 68db14a405..7f33ff98bd 100644
--- a/java/com/android/incallui/answer/impl/SelfManagedAnswerVideoCallScreen.java
+++ b/java/com/android/incallui/answer/impl/SelfManagedAnswerVideoCallScreen.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,7 +27,6 @@ import android.hardware.camera2.CameraManager;
 import android.hardware.camera2.CameraMetadata;
 import android.hardware.camera2.CaptureRequest;
 import android.hardware.camera2.params.StreamConfigurationMap;
-import android.support.v4.app.Fragment;
 import android.util.Size;
 import android.view.Surface;
 import android.view.SurfaceHolder;
@@ -35,11 +35,13 @@ import android.view.View;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
 import com.android.incallui.video.protocol.VideoCallScreen;
+
 import java.util.Arrays;
 
 /**
diff --git a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
index 28cfcaaf97..d3f0ca124c 100644
--- a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
+++ b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +23,6 @@ import android.content.DialogInterface;
 import android.content.res.TypedArray;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
-import android.support.design.widget.BottomSheetDialogFragment;
 import android.view.ContextThemeWrapper;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -40,6 +40,8 @@ import com.android.dialer.common.DpUtil;
 import com.android.dialer.common.FragmentUtils;
 import com.android.dialer.common.LogUtil;
 import com.android.incallui.incalluilock.InCallUiLock;
+import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
+
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/java/com/android/incallui/answer/impl/answermethod/AnswerMethod.java b/java/com/android/incallui/answer/impl/answermethod/AnswerMethod.java
index 6b055cf2c4..08629512e5 100644
--- a/java/com/android/incallui/answer/impl/answermethod/AnswerMethod.java
+++ b/java/com/android/incallui/answer/impl/answermethod/AnswerMethod.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,9 +19,9 @@ package com.android.incallui.answer.impl.answermethod;
 
 import android.content.Context;
 import android.graphics.drawable.Drawable;
-import android.support.v4.app.Fragment;
 
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
 
 import com.android.dialer.common.FragmentUtils;
 
diff --git a/java/com/android/incallui/answer/impl/answermethod/AnswerMethodFactory.java b/java/com/android/incallui/answer/impl/answermethod/AnswerMethodFactory.java
index 6ccfed3510..a05ac38b18 100644
--- a/java/com/android/incallui/answer/impl/answermethod/AnswerMethodFactory.java
+++ b/java/com/android/incallui/answer/impl/answermethod/AnswerMethodFactory.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,10 +18,10 @@
 package com.android.incallui.answer.impl.answermethod;
 
 import android.app.Activity;
-import android.support.v4.app.Fragment;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
 
 import com.android.incallui.util.AccessibilityUtil;
 
diff --git a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
index 386d7d6d32..e773983049 100644
--- a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
+++ b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,11 +30,6 @@ import android.graphics.PorterDuff.Mode;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Trace;
-import android.support.v4.graphics.ColorUtils;
-import android.support.v4.view.animation.FastOutLinearInInterpolator;
-import android.support.v4.view.animation.FastOutSlowInInterpolator;
-import android.support.v4.view.animation.LinearOutSlowInInterpolator;
-import android.support.v4.view.animation.PathInterpolatorCompat;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
@@ -52,6 +48,11 @@ import androidx.annotation.FloatRange;
 import androidx.annotation.IntDef;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.core.graphics.ColorUtils;
+import androidx.core.view.animation.PathInterpolatorCompat;
+import androidx.interpolator.view.animation.FastOutLinearInInterpolator;
+import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
+import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
 
 import com.android.dialer.R;
 import com.android.dialer.common.DpUtil;
diff --git a/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml b/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml
index 18dd838f2b..e5761c2958 100644
--- a/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml
+++ b/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml
@@ -1,6 +1,7 @@
 
 
    {
+public class RttChatAdapter extends RecyclerView.Adapter {
 
   /** IntDef for the different types of rows that can be shown in the call log. */
   @Retention(RetentionPolicy.SOURCE)
@@ -77,7 +78,7 @@ public class RttChatAdapter extends RecyclerView.Adapter {
   }
 
   @Override
-  public ViewHolder onCreateViewHolder(ViewGroup parent, @RowType int viewType) {
+  public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, @RowType int viewType) {
     LayoutInflater layoutInflater = LayoutInflater.from(context);
     switch (viewType) {
       case RowType.ADVISORY:
@@ -101,7 +102,7 @@ public class RttChatAdapter extends RecyclerView.Adapter {
   }
 
   @Override
-  public void onBindViewHolder(ViewHolder viewHolder, int itemPosition) {
+  public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int itemPosition) {
     switch (getItemViewType(itemPosition)) {
       case RowType.ADVISORY:
         return;
diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java
index 0a9f0d5115..5ca8be04c5 100644
--- a/java/com/android/incallui/rtt/impl/RttChatFragment.java
+++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,11 +21,6 @@ import android.app.Activity;
 import android.content.Context;
 import android.os.Bundle;
 import android.os.SystemClock;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.RecyclerView.OnScrollListener;
 import android.telecom.CallAudioState;
 import android.text.Editable;
 import android.text.TextUtils;
@@ -45,6 +41,10 @@ import android.widget.TextView.OnEditorActionListener;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentTransaction;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
@@ -74,6 +74,7 @@ import com.android.incallui.rtt.protocol.Constants;
 import com.android.incallui.rtt.protocol.RttCallScreen;
 import com.android.incallui.rtt.protocol.RttCallScreenDelegate;
 import com.android.incallui.rtt.protocol.RttCallScreenDelegateFactory;
+
 import java.util.List;
 
 /** RTT chat fragment to show chat bubbles. */
@@ -203,7 +204,7 @@ public class RttChatFragment extends Fragment
     adapter = new RttChatAdapter(getContext(), this);
     recyclerView.setAdapter(adapter);
     recyclerView.addOnScrollListener(
-        new OnScrollListener() {
+        new RecyclerView.OnScrollListener() {
           @Override
           public void onScrollStateChanged(RecyclerView recyclerView, int i) {
             if (i == RecyclerView.SCROLL_STATE_DRAGGING) {
diff --git a/java/com/android/incallui/rtt/impl/RttChatMessageViewHolder.java b/java/com/android/incallui/rtt/impl/RttChatMessageViewHolder.java
index 56161ecccf..59e85c5a53 100644
--- a/java/com/android/incallui/rtt/impl/RttChatMessageViewHolder.java
+++ b/java/com/android/incallui/rtt/impl/RttChatMessageViewHolder.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,17 +19,20 @@ package com.android.incallui.rtt.impl;
 
 import android.content.res.Resources;
 import android.graphics.drawable.Drawable;
-import android.support.v7.widget.RecyclerView.ViewHolder;
 import android.view.Gravity;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.LinearLayout.LayoutParams;
 import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.dialer.R;
 import com.android.incallui.rtt.protocol.RttChatMessage;
 
 /** ViewHolder class for RTT chat message bubble. */
-public class RttChatMessageViewHolder extends ViewHolder {
+public class RttChatMessageViewHolder extends RecyclerView.ViewHolder {
 
   private final TextView messageTextView;
   private final Resources resources;
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 cff2b3f385..9fc4e76988 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
@@ -1,6 +1,7 @@
 
 
 
 
-  
+        android:visibility="gone"
+        app:tint="@color/submit_button_color" />
   
 
   
 
 
+        app:tint="@color/dialer_end_call_button_color" />
     
+        app:tint="?colorIconOnUnthemedDarkBackground" />
 
   
   
 
-
\ No newline at end of file
+
diff --git a/java/com/android/incallui/rtt/impl/res/layout/rtt_transcript_advisory.xml b/java/com/android/incallui/rtt/impl/res/layout/rtt_transcript_advisory.xml
index a2cf3e74f3..aa20f1cd95 100644
--- a/java/com/android/incallui/rtt/impl/res/layout/rtt_transcript_advisory.xml
+++ b/java/com/android/incallui/rtt/impl/res/layout/rtt_transcript_advisory.xml
@@ -1,6 +1,7 @@
 
 
 
+      android:tintMode="src_in"
+      app:tint="#DEFFFFFF" />
   
-
\ No newline at end of file
+
diff --git a/java/com/android/incallui/rtt/protocol/RttCallScreen.java b/java/com/android/incallui/rtt/protocol/RttCallScreen.java
index 420274c731..6a4622d418 100644
--- a/java/com/android/incallui/rtt/protocol/RttCallScreen.java
+++ b/java/com/android/incallui/rtt/protocol/RttCallScreen.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,10 +17,12 @@
 
 package com.android.incallui.rtt.protocol;
 
-import android.support.v4.app.Fragment;
+import androidx.fragment.app.Fragment;
+
 import com.android.dialer.rtt.RttTranscript;
 import com.android.dialer.rtt.RttTranscriptMessage;
 import com.android.incallui.incall.protocol.InCallScreen;
+
 import java.util.List;
 
 /** Interface for call RTT call module. */
diff --git a/java/com/android/incallui/sessiondata/MultimediaFragment.java b/java/com/android/incallui/sessiondata/MultimediaFragment.java
index 137cd31582..f3747138c4 100644
--- a/java/com/android/incallui/sessiondata/MultimediaFragment.java
+++ b/java/com/android/incallui/sessiondata/MultimediaFragment.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +21,6 @@ import android.graphics.drawable.Drawable;
 import android.location.Location;
 import android.net.Uri;
 import android.os.Bundle;
-import android.support.v4.app.Fragment;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -31,6 +31,7 @@ import android.widget.TextView;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
 
 import com.android.dialer.R;
 import com.android.dialer.common.FragmentUtils;
diff --git a/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml b/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml
index 5da3cc46ab..fc5ab9dcfa 100644
--- a/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml
+++ b/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml
@@ -1,6 +1,7 @@
 
 
 
+        app:tint="?colorIcon" />
 
     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
+ * 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 + * 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 + * 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.voicemail.impl; @@ -17,7 +20,6 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.PersistableBundle; -import android.preference.PreferenceManager; import android.provider.VoicemailContract.Status; import android.provider.VoicemailContract.Voicemails; import android.telecom.PhoneAccountHandle; @@ -26,6 +28,7 @@ import android.telephony.TelephonyManager; import androidx.annotation.MainThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.preference.PreferenceManager; import com.android.dialer.common.LogUtil; import com.android.voicemail.PinChanger; @@ -35,7 +38,9 @@ import com.android.voicemail.VoicemailVersionConstants; import com.android.voicemail.impl.configui.VoicemailSecretCodeActivity; import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil; import com.android.voicemail.impl.sync.VvmAccountManager; + import java.util.List; + import javax.inject.Inject; /** diff --git a/java/com/android/voicemail/impl/configui/ConfigOverrideFragment.java b/java/com/android/voicemail/impl/configui/ConfigOverrideFragment.java index 5546be1bb0..db77930340 100644 --- a/java/com/android/voicemail/impl/configui/ConfigOverrideFragment.java +++ b/java/com/android/voicemail/impl/configui/ConfigOverrideFragment.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,19 +21,19 @@ import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.os.PersistableBundle; -import android.preference.EditTextPreference; -import android.preference.Preference; -import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceFragment; -import android.preference.PreferenceManager; -import android.preference.PreferenceScreen; -import android.preference.SwitchPreference; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.text.TextUtils; import androidx.annotation.Nullable; +import androidx.preference.EditTextPreference; +import androidx.preference.Preference; +import androidx.preference.Preference.OnPreferenceChangeListener; +import androidx.preference.PreferenceFragmentCompat; +import androidx.preference.PreferenceManager; +import androidx.preference.PreferenceScreen; +import androidx.preference.SwitchPreferenceCompat; import com.android.dialer.R; import com.android.dialer.common.Assert; @@ -43,7 +44,7 @@ import com.android.voicemail.VoicemailComponent; * Fragment to edit the override values for the {@link import * com.android.voicemail.impl.OmtpVvmCarrierConfigHelper} */ -public class ConfigOverrideFragment extends PreferenceFragment +public class ConfigOverrideFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener { /** @@ -81,12 +82,23 @@ public class ConfigOverrideFragment extends PreferenceFragment } @Override - public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - if (TextUtils.equals( - preference.getKey(), getString(R.string.vvm_config_override_load_current_key))) { - loadCurrentConfig(); - } - return super.onPreferenceTreeClick(preferenceScreen, preference); + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + setPreferencesFromResource(R.xml.vvm_config_override, rootKey); + + for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) { + Preference preference = getPreferenceScreen().getPreference(i); + preference.setOnPreferenceChangeListener(this); + updatePreference(preference); + } + } + + @Override + public boolean onPreferenceTreeClick(Preference preference) { + if (TextUtils.equals( + preference.getKey(), getString(R.string.vvm_config_override_load_current_key))) { + loadCurrentConfig(); + } + return super.onPreferenceTreeClick(preference); } /** @@ -113,7 +125,7 @@ public class ConfigOverrideFragment extends PreferenceFragment String configKey = key.substring(CONFIG_OVERRIDE_KEY_PREFIX.length()); if (configKey.endsWith("bool")) { - ((SwitchPreference) preference).setChecked(config.getBoolean(configKey)); + ((SwitchPreferenceCompat) preference).setChecked(config.getBoolean(configKey)); } else if (configKey.endsWith("int")) { ((EditTextPreference) preference).setText(String.valueOf(config.getInt(configKey))); } else if (configKey.endsWith("string")) { diff --git a/java/com/android/voicemail/impl/configui/res/xml/vvm_config_override.xml b/java/com/android/voicemail/impl/configui/res/xml/vvm_config_override.xml index c4a23c789b..2b5fa58ec9 100644 --- a/java/com/android/voicemail/impl/configui/res/xml/vvm_config_override.xml +++ b/java/com/android/voicemail/impl/configui/res/xml/vvm_config_override.xml @@ -1,5 +1,6 @@ "; - private static String ADDRESS_REGEX = "\n?(.*?)"; - private static String WEBSITE_REGEX = ".*"; + private static final String NUMBER_REGEX = ""; + private static final String ADDRESS_REGEX = "\n?(.*?)"; + private static final String WEBSITE_REGEX = ".* priorityPromotionList; + private final ImmutableList priorityPromotionList; @Inject public PromotionManager(ImmutableList priorityPromotionList) { diff --git a/java/com/android/dialer/searchfragment/list/SearchAdapter.java b/java/com/android/dialer/searchfragment/list/SearchAdapter.java index 009ca64496..4dc222fc72 100644 --- a/java/com/android/dialer/searchfragment/list/SearchAdapter.java +++ b/java/com/android/dialer/searchfragment/list/SearchAdapter.java @@ -51,7 +51,7 @@ public final class SearchAdapter extends RecyclerView.Adapter { private String rawNumber; private OnClickListener allowClickListener; private OnClickListener dismissClickListener; - private RowClickListener rowClickListener; + private final RowClickListener rowClickListener; public SearchAdapter( Context context, SearchCursorManager searchCursorManager, RowClickListener rowClickListener) { diff --git a/java/com/android/dialer/simulator/Simulator.java b/java/com/android/dialer/simulator/Simulator.java index 3b0a70526c..00a6152e88 100644 --- a/java/com/android/dialer/simulator/Simulator.java +++ b/java/com/android/dialer/simulator/Simulator.java @@ -43,8 +43,8 @@ public interface Simulator { }) @interface ConferenceType {} - static final int CONFERENCE_TYPE_GSM = 1; - static final int CONFERENCE_TYPE_VOLTE = 2; + int CONFERENCE_TYPE_GSM = 1; + int CONFERENCE_TYPE_VOLTE = 2; /** The types of connection service listener events */ @Retention(RetentionPolicy.SOURCE) @@ -55,11 +55,11 @@ public interface Simulator { }) @interface ConnectionServiceEventType {} - static final int ON_NEW_OUTGOING_CONNECTION = 1; - static final int ON_NEW_INCOMING_CONNECTION = 2; - static final int ON_CONFERENCE = 3; + int ON_NEW_OUTGOING_CONNECTION = 1; + int ON_NEW_INCOMING_CONNECTION = 2; + int ON_CONFERENCE = 3; - static final String CALLER_ID_PRESENTATION_TYPE = "caller_id_"; + String CALLER_ID_PRESENTATION_TYPE = "caller_id_"; /** Bundle keys that are used in making fake call. */ @Retention(RetentionPolicy.SOURCE) @@ -69,8 +69,8 @@ public interface Simulator { }) @interface BundleKey {} - public final String IS_VOLTE = "ISVOLTE"; - public final String PRESENTATION_CHOICE = "PRESENTATIONCHOICE"; + String IS_VOLTE = "ISVOLTE"; + String PRESENTATION_CHOICE = "PRESENTATIONCHOICE"; boolean isSimulatorMode(); @@ -79,7 +79,7 @@ public interface Simulator { void disableSimulatorMode(); /** Information about a connection event. */ - public static class Event { + class Event { /** The type of connection event. */ @Retention(RetentionPolicy.SOURCE) @IntDef({ diff --git a/java/com/android/dialer/simulator/impl/SimulatorMenu.java b/java/com/android/dialer/simulator/impl/SimulatorMenu.java index 8c9cf1eceb..0d4deb0af1 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorMenu.java +++ b/java/com/android/dialer/simulator/impl/SimulatorMenu.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,9 +31,9 @@ import java.util.Map.Entry; /** Makes option menu for simulator. */ public final class SimulatorMenu extends ActionProvider { - SimulatorPortalEntryGroup portal; + final SimulatorPortalEntryGroup portal; - Context context; + final Context context; public SimulatorMenu(@NonNull Context context, SimulatorPortalEntryGroup portal) { super(Assert.isNotNull(context)); diff --git a/java/com/android/dialer/simulator/impl/SimulatorUtils.java b/java/com/android/dialer/simulator/impl/SimulatorUtils.java index 9bb8618d24..debcd75696 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorUtils.java +++ b/java/com/android/dialer/simulator/impl/SimulatorUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -195,8 +196,8 @@ public class SimulatorUtils { } private static class PopulateDatabaseWorkerInput { - Context context; - boolean fastMode; + final Context context; + final boolean fastMode; PopulateDatabaseWorkerInput(Context context, boolean fastMode) { this.context = context; diff --git a/java/com/android/dialer/telecom/TelecomUtil.java b/java/com/android/dialer/telecom/TelecomUtil.java index 2d75973ac6..cb769b9fd4 100644 --- a/java/com/android/dialer/telecom/TelecomUtil.java +++ b/java/com/android/dialer/telecom/TelecomUtil.java @@ -59,7 +59,7 @@ public abstract class TelecomUtil { private static final String TAG = "TelecomUtil"; private static boolean warningLogged = false; - private static TelecomUtilImpl instance = new TelecomUtilImpl(); + private static final TelecomUtilImpl instance = new TelecomUtilImpl(); /** * Cache for {@link #isVoicemailNumber(Context, PhoneAccountHandle, String)}. Both diff --git a/java/com/android/dialer/util/ExpirableCache.java b/java/com/android/dialer/util/ExpirableCache.java index a1b0afd749..ba3951e1f4 100644 --- a/java/com/android/dialer/util/ExpirableCache.java +++ b/java/com/android/dialer/util/ExpirableCache.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +101,7 @@ public class ExpirableCache { */ private final AtomicInteger generation; /** The underlying cache used to stored the cached values. */ - private LruCache> cache; + private final LruCache> cache; private ExpirableCache(LruCache> cache) { this.cache = cache; diff --git a/java/com/android/dialer/util/TouchPointManager.java b/java/com/android/dialer/util/TouchPointManager.java index ad5b007761..625558d303 100644 --- a/java/com/android/dialer/util/TouchPointManager.java +++ b/java/com/android/dialer/util/TouchPointManager.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +28,9 @@ public class TouchPointManager { public static final String TOUCH_POINT = "touchPoint"; - private static TouchPointManager instance = new TouchPointManager(); + private static final TouchPointManager instance = new TouchPointManager(); - private Point point = new Point(); + private final Point point = new Point(); /** Private constructor. Instance should only be acquired through getRunningInstance(). */ private TouchPointManager() {} diff --git a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java index 4606f72d0f..47d8ee39f0 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java @@ -98,7 +98,7 @@ public class VoicemailChangePinActivity extends AppCompatActivity private Button cancelButton; private Button nextButton; - private Handler handler = new ChangePinHandler(new WeakReference<>(this)); + private final Handler handler = new ChangePinHandler(new WeakReference<>(this)); private enum State { /** diff --git a/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java b/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java index 47ec4e5e19..3e651c231e 100644 --- a/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java +++ b/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java @@ -45,15 +45,15 @@ public class VisualVoicemailEnabledChecker implements CallLogQueryHandler.Listen public static final String PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER = "has_active_voicemail_provider"; - private SharedPreferences prefs; + private final SharedPreferences prefs; private boolean hasActiveVoicemailProvider; private Context context; - private Callback callback; + private final Callback callback; public VisualVoicemailEnabledChecker(Context context, @Nullable Callback callback) { this.context = context; this.callback = callback; - prefs = PreferenceManager.getDefaultSharedPreferences(this.context); + prefs = PreferenceManager.getDefaultSharedPreferences(context); hasActiveVoicemailProvider = prefs.getBoolean(PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER, false); } diff --git a/java/com/android/dialer/widget/EmptyContentView.java b/java/com/android/dialer/widget/EmptyContentView.java index 6c5571efa9..10e3f99f1a 100644 --- a/java/com/android/dialer/widget/EmptyContentView.java +++ b/java/com/android/dialer/widget/EmptyContentView.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,9 +42,9 @@ public class EmptyContentView extends LinearLayout implements View.OnClickListen public static final int NO_LABEL = 0; public static final int NO_IMAGE = 0; - private ImageView imageView; - private TextView descriptionView; - private Button actionView; + private final ImageView imageView; + private final TextView descriptionView; + private final Button actionView; private OnEmptyViewActionButtonClickedListener onActionButtonClickedListener; private @StringRes int actionLabel; diff --git a/java/com/android/incallui/AccelerometerListener.java b/java/com/android/incallui/AccelerometerListener.java index 92e62b098b..378971a5f7 100644 --- a/java/com/android/incallui/AccelerometerListener.java +++ b/java/com/android/incallui/AccelerometerListener.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,8 +43,8 @@ public class AccelerometerListener { private static final int VERTICAL_DEBOUNCE = 100; private static final int HORIZONTAL_DEBOUNCE = 500; private static final double VERTICAL_ANGLE = 50.0; - private SensorManager sensorManager; - private Sensor sensor; + private final SensorManager sensorManager; + private final Sensor sensor; // mOrientation is the orientation value most recently reported to the client. private int orientation; // mPendingOrientation is the latest orientation computed based on the sensor value. @@ -75,7 +76,7 @@ public class AccelerometerListener { } } }; - SensorEventListener sensorListener = + final SensorEventListener sensorListener = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent event) { diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java index b78563bd8e..5ac76aac35 100644 --- a/java/com/android/incallui/CallButtonPresenter.java +++ b/java/com/android/incallui/CallButtonPresenter.java @@ -76,7 +76,7 @@ public class CallButtonPresenter private boolean isInCallButtonUiReady; private PhoneAccountHandle otherAccount; - private CallRecorder.RecordingProgressListener recordingProgressListener = + private final CallRecorder.RecordingProgressListener recordingProgressListener = new CallRecorder.RecordingProgressListener() { @Override public void onStartRecording() { diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java index f0f31c6ff0..376034202d 100644 --- a/java/com/android/incallui/ConferenceParticipantListAdapter.java +++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java @@ -90,7 +90,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { } }; /** The conference participants to show in the ListView. */ - private List conferenceParticipants = new ArrayList<>(); + private final List conferenceParticipants = new ArrayList<>(); /** {@code True} if the conference parent supports separating calls from the conference. */ private boolean parentCanSeparate; diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java index 29de0c1420..3be820db3d 100644 --- a/java/com/android/incallui/ExternalCallNotifier.java +++ b/java/com/android/incallui/ExternalCallNotifier.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +76,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen private final Context context; private final ContactInfoCache contactInfoCache; - private Map notifications = new ArrayMap<>(); + private final Map notifications = new ArrayMap<>(); private int nextUniqueNotificationId; /** Initializes a new instance of the external call notifier. */ diff --git a/java/com/android/incallui/InCallCameraManager.java b/java/com/android/incallui/InCallCameraManager.java index b5a8f91af9..2296afb4e5 100644 --- a/java/com/android/incallui/InCallCameraManager.java +++ b/java/com/android/incallui/InCallCameraManager.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +42,7 @@ public class InCallCameraManager { */ private boolean isInitialized = false; /** The context. */ - private Context context; + private final Context context; /** * Initializes the InCall CameraManager. diff --git a/java/com/android/incallui/InCallDndHandler.java b/java/com/android/incallui/InCallDndHandler.java index 3aef7720c6..062ab34934 100644 --- a/java/com/android/incallui/InCallDndHandler.java +++ b/java/com/android/incallui/InCallDndHandler.java @@ -31,10 +31,10 @@ public class InCallDndHandler implements InCallPresenter.InCallStateListener { private static final String KEY_ENABLE_DND = "incall_enable_dnd"; - private SharedPreferences prefs; + private final SharedPreferences prefs; private DialerCall activeCall; - private NotificationManager notificationManager; - private int userSelectedDndMode; + private final NotificationManager notificationManager; + private final int userSelectedDndMode; public InCallDndHandler(Context context) { prefs = PreferenceManager.getDefaultSharedPreferences( diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 9e0dd49fe7..ada3935f12 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -212,7 +213,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud private boolean awaitingCallListUpdate = false; - private ExternalCallList.ExternalCallListener externalCallListener = + private final ExternalCallList.ExternalCallListener externalCallListener = new ExternalCallList.ExternalCallListener() { @Override diff --git a/java/com/android/incallui/InCallVibrationHandler.java b/java/com/android/incallui/InCallVibrationHandler.java index 092c134f37..8ce8d0bfe2 100644 --- a/java/com/android/incallui/InCallVibrationHandler.java +++ b/java/com/android/incallui/InCallVibrationHandler.java @@ -41,8 +41,8 @@ public class InCallVibrationHandler extends Handler implements private static final String KEY_VIBRATE_45SECS = "incall_vibrate_45secs"; private static final String KEY_VIBRATE_HANGUP = "incall_vibrate_hangup"; - private SharedPreferences prefs; - private Vibrator vibrator; + private final SharedPreferences prefs; + private final Vibrator vibrator; private DialerCall activeCall; public InCallVibrationHandler(Context context) { diff --git a/java/com/android/incallui/ProximitySensor.java b/java/com/android/incallui/ProximitySensor.java index b124d45a4f..ad5b77c1de 100644 --- a/java/com/android/incallui/ProximitySensor.java +++ b/java/com/android/incallui/ProximitySensor.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -271,7 +272,7 @@ public class ProximitySensor */ public class ProximityDisplayListener implements DisplayListener { - private DisplayManager displayManager; + private final DisplayManager displayManager; private boolean isDisplayOn = true; ProximityDisplayListener(DisplayManager displayManager) { diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 563c1578ad..423e401978 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -978,7 +979,7 @@ public class StatusBarNotifier private class StatusBarCallListener implements DialerCallListener { - private DialerCall dialerCall; + private final DialerCall dialerCall; StatusBarCallListener(DialerCall dialerCall) { this.dialerCall = dialerCall; diff --git a/java/com/android/incallui/answer/impl/AffordanceHolderLayout.java b/java/com/android/incallui/answer/impl/AffordanceHolderLayout.java index 7b6c200985..a0833ff34c 100644 --- a/java/com/android/incallui/answer/impl/AffordanceHolderLayout.java +++ b/java/com/android/incallui/answer/impl/AffordanceHolderLayout.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +34,7 @@ import com.android.incallui.util.AccessibilityUtil; /** Layout that delegates touches to its SwipeButtonHelper */ public class AffordanceHolderLayout extends FrameLayout { - private SwipeButtonHelper affordanceHelper; + private final SwipeButtonHelper affordanceHelper; private Callback affordanceCallback; diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java index 78eb1b64e5..a171b22c56 100644 --- a/java/com/android/incallui/answer/impl/AnswerFragment.java +++ b/java/com/android/incallui/answer/impl/AnswerFragment.java @@ -158,7 +158,7 @@ public class AnswerFragment extends Fragment private SecondaryBehavior answerAndReleaseBehavior; private ContactGridManager contactGridManager; private VideoCallScreen answerVideoCallScreen; - private Handler handler = new Handler(Looper.getMainLooper()); + private final Handler handler = new Handler(Looper.getMainLooper()); private enum SecondaryBehavior { REJECT_WITH_SMS( @@ -195,7 +195,7 @@ public class AnswerFragment extends Fragment }; @DrawableRes - public int icon; + public final int icon; @StringRes public final int contentDescription; @StringRes public final int accessibilityLabel; @@ -336,7 +336,7 @@ public class AnswerFragment extends Fragment } }; - private Runnable swipeHintRestoreTimer = this::restoreSwipeHintTexts; + private final Runnable swipeHintRestoreTimer = this::restoreSwipeHintTexts; private void performSecondaryButtonAction() { secondaryBehavior.performAction(this); diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java index abeb2a7fcb..32711622d0 100644 --- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java +++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +64,7 @@ public class SwipeButtonHelper { private int touchTargetSize; private View targetedView; private boolean touchSlopExeeded; - private AnimatorListenerAdapter flingEndListener = + private final AnimatorListenerAdapter flingEndListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java index fb512f34c1..a875723849 100644 --- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java +++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,9 +63,9 @@ public class SwipeButtonView extends ImageView { private ValueAnimator scaleAnimator; private float circleStartValue; private boolean circleWillBeHidden; - private int[] tempPoint = new int[2]; + private final int[] tempPoint = new int[2]; private float tmageScale = 1f; - private int circleColor; + private final int circleColor; private View previewView; private float circleStartRadius; private float maxCircleSize; @@ -73,28 +74,28 @@ public class SwipeButtonView extends ImageView { private boolean finishing; private boolean launchingAffordance; - private AnimatorListenerAdapter clipEndListener = + private final AnimatorListenerAdapter clipEndListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { previewClipper = null; } }; - private AnimatorListenerAdapter circleEndListener = + private final AnimatorListenerAdapter circleEndListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { circleAnimator = null; } }; - private AnimatorListenerAdapter scaleEndListener = + private final AnimatorListenerAdapter scaleEndListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { scaleAnimator = null; } }; - private AnimatorListenerAdapter alphaEndListener = + private final AnimatorListenerAdapter alphaEndListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { diff --git a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java index e773983049..53080cb933 100644 --- a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java +++ b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java @@ -1137,8 +1137,8 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged private static final long RAMP_DOWN_END_MS = RAMP_DOWN_BEGIN_MS + RAMP_DOWN_DURATION_MS; private static final long RAMP_TOTAL_TIME_MS = RAMP_DOWN_END_MS; private final float ampMax; - private final float freqMax = 80; - private Interpolator sliderInterpolator = new FastOutSlowInInterpolator(); + private static final float FREQ_MAX = 80; + private final Interpolator sliderInterpolator = new FastOutSlowInInterpolator(); VibrateInterpolator(Context context) { ampMax = DpUtil.dpToPx(context, 1 /* dp */); @@ -1168,7 +1168,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged } float ampNormalized = ampMax * slider; - float freqNormalized = freqMax * slider; + float freqNormalized = FREQ_MAX * slider; return (float) (ampNormalized * Math.sin(time * freqNormalized)); } diff --git a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java index 39d97d164e..f42e6bdf6c 100644 --- a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java +++ b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -143,7 +144,7 @@ class FlingUpDownTouchHandler implements OnTouchListener { @NonNull private final OnProgressChangedListener listener; private VelocityTracker velocityTracker; - private FlingAnimationUtils flingAnimationUtils; + private final FlingAnimationUtils flingAnimationUtils; private boolean touchEnabled = true; private boolean flingEnabled = true; @@ -156,14 +157,14 @@ class FlingUpDownTouchHandler implements OnTouchListener { private int trackingPointer; private Animator progressAnimator; - private float touchSlop; + private final float touchSlop; private float initialTouchY; private float acceptThresholdY; private float rejectThresholdY; private float zeroY; private boolean touchAboveFalsingThreshold; - private float falsingThresholdPx; + private final float falsingThresholdPx; private boolean touchUsesFalsing; private final float acceptThresholdPx; diff --git a/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java b/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java index 24f04c4387..8c997c7556 100644 --- a/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java +++ b/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +48,7 @@ import java.util.Map; * angels or right angles) */ class AnglesClassifier extends StrokeClassifier { - private Map strokeMap = new ArrayMap<>(); + private final Map strokeMap = new ArrayMap<>(); public AnglesClassifier(ClassifierData classifierData) { this.classifierData = classifierData; @@ -87,7 +88,7 @@ class AnglesClassifier extends StrokeClassifier { private static final float ANGLE_DEVIATION = (float) Math.PI / 20.0f; private static final float MIN_MOVE_DIST_DP = .01f; - private List lastThreePoints = new ArrayList<>(); + private final List lastThreePoints = new ArrayList<>(); private float firstAngleVariance; private float previousAngle; private float biggestAngle; diff --git a/java/com/android/incallui/answer/impl/classifier/ClassifierData.java b/java/com/android/incallui/answer/impl/classifier/ClassifierData.java index fe3fbe0cf8..462204a6b0 100644 --- a/java/com/android/incallui/answer/impl/classifier/ClassifierData.java +++ b/java/com/android/incallui/answer/impl/classifier/ClassifierData.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,8 +27,8 @@ import java.util.concurrent.TimeUnit; * example, provide information on the current touch state. */ class ClassifierData { - private SparseArray currentStrokes = new SparseArray<>(); - private ArrayList endingStrokes = new ArrayList<>(); + private final SparseArray currentStrokes = new SparseArray<>(); + private final ArrayList endingStrokes = new ArrayList<>(); private final float dpi; private final float screenHeight; diff --git a/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java b/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java index c0256a5d8a..ac76a0148a 100644 --- a/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java +++ b/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,7 +104,7 @@ class HistoryEvaluator { * to 1.0 */ private static class Data { - public float evaluation; + public final float evaluation; public float weight; public Data(float evaluation) { diff --git a/java/com/android/incallui/answer/impl/classifier/Point.java b/java/com/android/incallui/answer/impl/classifier/Point.java index 5ea48b4ce4..2919e79261 100644 --- a/java/com/android/incallui/answer/impl/classifier/Point.java +++ b/java/com/android/incallui/answer/impl/classifier/Point.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +18,9 @@ package com.android.incallui.answer.impl.classifier; class Point { - public float x; - public float y; - public long timeOffsetNano; + public final float x; + public final float y; + public final long timeOffsetNano; public Point(float x, float y) { this.x = x; diff --git a/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java b/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java index 034c4fea33..2fc7b0fe14 100644 --- a/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java +++ b/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +34,7 @@ import java.util.Map; * a good stroke is most often increases, so most of these angels should be in this interval. */ class SpeedAnglesClassifier extends StrokeClassifier { - private Map strokeMap = new ArrayMap<>(); + private final Map strokeMap = new ArrayMap<>(); public SpeedAnglesClassifier(ClassifierData classifierData) { this.classifierData = classifierData; @@ -79,7 +80,7 @@ class SpeedAnglesClassifier extends StrokeClassifier { private static final float LENGTH_SCALE = 1.0f; private static final float ANGLE_DEVIATION = (float) Math.PI / 10.0f; - private List lastThreePoints = new ArrayList<>(); + private final List lastThreePoints = new ArrayList<>(); private Point previousPoint; private float previousAngle; private float sumSquares; diff --git a/java/com/android/incallui/answer/impl/classifier/Stroke.java b/java/com/android/incallui/answer/impl/classifier/Stroke.java index a334249463..caba894e3c 100644 --- a/java/com/android/incallui/answer/impl/classifier/Stroke.java +++ b/java/com/android/incallui/answer/impl/classifier/Stroke.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,8 +27,8 @@ class Stroke { private static final float NANOS_TO_SECONDS = 1e9f; - private ArrayList points = new ArrayList<>(); - private long startTimeNano; + private final ArrayList points = new ArrayList<>(); + private final long startTimeNano; private long endTimeNano; private float length; private final float dpi; diff --git a/java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java b/java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java index b30afa0f68..6d142de352 100644 --- a/java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java +++ b/java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,13 +36,13 @@ public class FlingAnimationUtils { /** Fancy math. http://en.wikipedia.org/wiki/B%C3%A9zier_curve */ private static final float LINEAR_OUT_SLOW_IN_START_GRADIENT = 1.0f / LINEAR_OUT_SLOW_IN_X2; - private Interpolator linearOutSlowIn; + private final Interpolator linearOutSlowIn; - private float minVelocityPxPerSecond; - private float maxLengthSeconds; - private float highVelocityPxPerSecond; + private final float minVelocityPxPerSecond; + private final float maxLengthSeconds; + private final float highVelocityPxPerSecond; - private AnimatorProperties animatorProperties = new AnimatorProperties(); + private final AnimatorProperties animatorProperties = new AnimatorProperties(); public FlingAnimationUtils(Context ctx, float maxLengthSeconds) { this.maxLengthSeconds = maxLengthSeconds; @@ -246,9 +247,9 @@ public class FlingAnimationUtils { /** An interpolator which interpolates two interpolators with an interpolator. */ private static final class InterpolatorInterpolator implements Interpolator { - private Interpolator interpolator1; - private Interpolator interpolator2; - private Interpolator crossfader; + private final Interpolator interpolator1; + private final Interpolator interpolator2; + private final Interpolator crossfader; InterpolatorInterpolator( Interpolator interpolator1, Interpolator interpolator2, Interpolator crossfader) { @@ -268,9 +269,9 @@ public class FlingAnimationUtils { /** An interpolator which interpolates with a fixed velocity. */ private static final class VelocityInterpolator implements Interpolator { - private float durationSeconds; - private float velocity; - private float diff; + private final float durationSeconds; + private final float velocity; + private final float diff; private VelocityInterpolator(float durationSeconds, float velocity, float diff) { this.durationSeconds = durationSeconds; diff --git a/java/com/android/incallui/baseui/BaseFragment.java b/java/com/android/incallui/baseui/BaseFragment.java index 0fa268478d..ac05984ff6 100644 --- a/java/com/android/incallui/baseui/BaseFragment.java +++ b/java/com/android/incallui/baseui/BaseFragment.java @@ -26,7 +26,7 @@ public abstract class BaseFragment, U extends Ui> extends private static final String KEY_FRAGMENT_HIDDEN = "key_fragment_hidden"; - private T presenter; + private final T presenter; protected BaseFragment() { presenter = createPresenter(); diff --git a/java/com/android/incallui/call/CallRecorder.java b/java/com/android/incallui/call/CallRecorder.java index 867d5a57cf..105f756936 100644 --- a/java/com/android/incallui/call/CallRecorder.java +++ b/java/com/android/incallui/call/CallRecorder.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The CyanogenMod Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,11 +68,10 @@ public class CallRecorder implements CallList.Listener { private boolean initialized = false; private ICallRecorderService service = null; - private HashSet progressListeners = - new HashSet(); - private Handler handler = new Handler(); + private final HashSet progressListeners = new HashSet<>(); + private final Handler handler = new Handler(Looper.getMainLooper()); - private ServiceConnection connection = new ServiceConnection() { + private final ServiceConnection connection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { CallRecorder.this.service = ICallRecorderService.Stub.asInterface(service); @@ -286,7 +286,7 @@ public class CallRecorder implements CallList.Listener { private static final int UPDATE_INTERVAL = 500; - private Runnable updateRecordingProgressTask = new Runnable() { + private final Runnable updateRecordingProgressTask = new Runnable() { @Override public void run() { CallRecording active = getActiveRecording(); diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index b5101a9394..87aa087616 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -345,7 +346,7 @@ public class DialerCall implements VideoTechListener { } }; - private long timeAddedMs; + private final long timeAddedMs; private int peerDimensionWidth = UNKNOWN_PEER_DIMENSIONS; private int peerDimensionHeight = UNKNOWN_PEER_DIMENSIONS; diff --git a/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java b/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java index 610d03d653..59b83ac0ec 100644 --- a/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java +++ b/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java @@ -28,7 +28,8 @@ import java.util.concurrent.ConcurrentHashMap; public class InCallVideoCallCallbackNotifier { /** Singleton instance of this class. */ - private static InCallVideoCallCallbackNotifier instance = new InCallVideoCallCallbackNotifier(); + private static final InCallVideoCallCallbackNotifier instance = + new InCallVideoCallCallbackNotifier(); /** * ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is load factor before diff --git a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java index 5929c15850..cd8ff810ad 100644 --- a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java +++ b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java @@ -41,7 +41,7 @@ public class InCallButtonGridFragment extends Fragment { private static final int BUTTON_COUNT = 6; private static final int BUTTONS_PER_ROW = 3; - private CheckableLabeledButton[] buttons = new CheckableLabeledButton[BUTTON_COUNT]; + private final CheckableLabeledButton[] buttons = new CheckableLabeledButton[BUTTON_COUNT]; private OnButtonGridCreatedListener buttonGridListener; public static Fragment newInstance() { diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index 65b6f0b68d..12e1927c27 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -81,7 +81,7 @@ public class InCallFragment extends Fragment AudioRouteSelectorPresenter, OnButtonGridCreatedListener { - private List buttonControllers = new ArrayList<>(); + private final List buttonControllers = new ArrayList<>(); private View endCallButton; private InCallPaginator paginator; private LockableViewPager pager; diff --git a/java/com/android/incallui/video/impl/SpeakerButtonController.java b/java/com/android/incallui/video/impl/SpeakerButtonController.java index e7a89783c7..6efc089cc2 100644 --- a/java/com/android/incallui/video/impl/SpeakerButtonController.java +++ b/java/com/android/incallui/video/impl/SpeakerButtonController.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +39,7 @@ public class SpeakerButtonController implements OnCheckedChangeListener, OnClick @NonNull private final VideoCallScreenDelegate videoCallScreenDelegate; @NonNull - private CheckableImageButton button; + private final CheckableImageButton button; @DrawableRes private int icon = R.drawable.quantum_ic_volume_up_vd_theme_24; diff --git a/java/com/android/incallui/video/impl/SwitchOnHoldCallController.java b/java/com/android/incallui/video/impl/SwitchOnHoldCallController.java index de4e5e7ea7..a90850f6d7 100644 --- a/java/com/android/incallui/video/impl/SwitchOnHoldCallController.java +++ b/java/com/android/incallui/video/impl/SwitchOnHoldCallController.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,12 +32,15 @@ import com.android.incallui.video.protocol.VideoCallScreenDelegate; public class SwitchOnHoldCallController implements OnClickListener { @NonNull - private InCallScreenDelegate inCallScreenDelegate; - @NonNull private VideoCallScreenDelegate videoCallScreenDelegate; + private final InCallScreenDelegate inCallScreenDelegate; + @NonNull + private final VideoCallScreenDelegate videoCallScreenDelegate; - @NonNull private View switchOnHoldButton; + @NonNull + private final View switchOnHoldButton; - @NonNull private View onHoldBanner; + @NonNull + private final View onHoldBanner; private boolean isVisible; diff --git a/java/com/android/voicemail/impl/OmtpConstants.java b/java/com/android/voicemail/impl/OmtpConstants.java index aa09ff56ce..593cc9878a 100644 --- a/java/com/android/voicemail/impl/OmtpConstants.java +++ b/java/com/android/voicemail/impl/OmtpConstants.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -232,7 +233,7 @@ public class OmtpConstants { return String.format("%s.%s.%s", manufacturer, model, version); } - private static final String truncate(String string, int length) { + private static String truncate(String string, int length) { return string.substring(0, Math.min(length, string.length())); } diff --git a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java index 96994f39aa..9178bbe39d 100644 --- a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java +++ b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +99,7 @@ public class OmtpVvmCarrierConfigHelper { @Nullable private final PersistableBundle overrideConfig; - private PhoneAccountHandle phoneAccountHandle; + private final PhoneAccountHandle phoneAccountHandle; public OmtpVvmCarrierConfigHelper(Context context, @Nullable PhoneAccountHandle handle) { this.context = context; diff --git a/java/com/android/voicemail/impl/VoicemailStatus.java b/java/com/android/voicemail/impl/VoicemailStatus.java index d04df77147..05999776e9 100644 --- a/java/com/android/voicemail/impl/VoicemailStatus.java +++ b/java/com/android/voicemail/impl/VoicemailStatus.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +37,7 @@ public class VoicemailStatus { @Nullable private final PhoneAccountHandle phoneAccountHandle; - private ContentValues values = new ContentValues(); + private final ContentValues values = new ContentValues(); private Editor(Context context, PhoneAccountHandle phoneAccountHandle) { this.context = context; diff --git a/java/com/android/voicemail/impl/VvmPhoneStateListener.java b/java/com/android/voicemail/impl/VvmPhoneStateListener.java index a9082e8955..ff8b106ceb 100644 --- a/java/com/android/voicemail/impl/VvmPhoneStateListener.java +++ b/java/com/android/voicemail/impl/VvmPhoneStateListener.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +32,8 @@ public class VvmPhoneStateListener extends PhoneStateListener { private static final String TAG = "VvmPhoneStateListener"; - private PhoneAccountHandle phoneAccount; - private Context context; + private final PhoneAccountHandle phoneAccount; + private final Context context; private int previousState = -1; public VvmPhoneStateListener(Context context, PhoneAccountHandle accountHandle) { diff --git a/java/com/android/voicemail/impl/imap/ImapHelper.java b/java/com/android/voicemail/impl/imap/ImapHelper.java index edf7a6144f..f2c2e5f26d 100644 --- a/java/com/android/voicemail/impl/imap/ImapHelper.java +++ b/java/com/android/voicemail/impl/imap/ImapHelper.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +70,7 @@ public class ImapHelper implements Closeable { private static final String TAG = "ImapHelper"; private ImapFolder folder; - private ImapStore imapStore; + private final ImapStore imapStore; private final Context context; private final PhoneAccountHandle phoneAccount; diff --git a/java/com/android/voicemail/impl/mail/MessagingException.java b/java/com/android/voicemail/impl/mail/MessagingException.java index fda5fbc9de..8522769bd6 100644 --- a/java/com/android/voicemail/impl/mail/MessagingException.java +++ b/java/com/android/voicemail/impl/mail/MessagingException.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,9 +71,9 @@ public class MessagingException extends Exception { /** The server indicates it experienced an internal error */ public static final int SERVER_ERROR = 19; - protected int exceptionType; + protected final int exceptionType; // Exception type-specific data - protected Object exceptionData; + protected final Object exceptionData; public MessagingException(String message, Throwable throwable) { this(UNSPECIFIED_EXCEPTION, message, throwable); diff --git a/java/com/android/voicemail/impl/mail/Multipart.java b/java/com/android/voicemail/impl/mail/Multipart.java index c226ca5ce8..429a262c69 100644 --- a/java/com/android/voicemail/impl/mail/Multipart.java +++ b/java/com/android/voicemail/impl/mail/Multipart.java @@ -20,7 +20,7 @@ import java.util.ArrayList; public abstract class Multipart implements Body { protected Part parent; - protected ArrayList parts = new ArrayList(); + protected final ArrayList parts = new ArrayList<>(); protected String contentType; diff --git a/java/com/android/voicemail/impl/mail/PackedString.java b/java/com/android/voicemail/impl/mail/PackedString.java index de04b6bbc5..5b74b56317 100644 --- a/java/com/android/voicemail/impl/mail/PackedString.java +++ b/java/com/android/voicemail/impl/mail/PackedString.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +37,7 @@ public class PackedString { private static final char DELIMITER_TAG = '\2'; - private String string; + private final String string; private ArrayMap exploded; private static final ArrayMap EMPTY_MAP = new ArrayMap(); @@ -118,7 +119,7 @@ public class PackedString { * PackedString representations. */ public static class Builder { - ArrayMap map; + final ArrayMap map; /** Create a builder that's empty (for filling) */ public Builder() { diff --git a/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java b/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java index 12a2b0b7d3..5445611bc5 100644 --- a/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java +++ b/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +28,7 @@ import java.util.regex.Pattern; /** TODO this is a close approximation of Message, need to update along with Message. */ public class MimeBodyPart extends BodyPart { - protected MimeHeader header = new MimeHeader(); + protected final MimeHeader header = new MimeHeader(); protected MimeHeader extendedHeader; protected Body body; protected int size; diff --git a/java/com/android/voicemail/impl/mail/internet/MimeHeader.java b/java/com/android/voicemail/impl/mail/internet/MimeHeader.java index 00a9eccf2b..17d2556dbe 100644 --- a/java/com/android/voicemail/impl/mail/internet/MimeHeader.java +++ b/java/com/android/voicemail/impl/mail/internet/MimeHeader.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -143,12 +144,12 @@ public class MimeHeader { return (fields == null) ? null : fields.toString(); } - public static final boolean arrayContains(Object[] a, Object o) { + public static boolean arrayContains(Object[] a, Object o) { int index = arrayIndex(a, o); return (index >= 0); } - public static final int arrayIndex(Object[] a, Object o) { + public static int arrayIndex(Object[] a, Object o) { for (int i = 0, count = a.length; i < count; i++) { if (a[i].equals(o)) { return i; diff --git a/java/com/android/voicemail/impl/mail/internet/TextBody.java b/java/com/android/voicemail/impl/mail/internet/TextBody.java index 506e1f52e7..b3bccb7217 100644 --- a/java/com/android/voicemail/impl/mail/internet/TextBody.java +++ b/java/com/android/voicemail/impl/mail/internet/TextBody.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +26,7 @@ import java.io.OutputStream; import java.io.UnsupportedEncodingException; public class TextBody implements Body { - String body; + final String body; public TextBody(String body) { this.body = body; diff --git a/java/com/android/voicemail/impl/mail/store/ImapConnection.java b/java/com/android/voicemail/impl/mail/store/ImapConnection.java index ac43f8d725..31511b7db7 100644 --- a/java/com/android/voicemail/impl/mail/store/ImapConnection.java +++ b/java/com/android/voicemail/impl/mail/store/ImapConnection.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +47,7 @@ public class ImapConnection { private ImapStore imapStore; private MailTransport transport; private ImapResponseParser parser; - private Set capabilities = new ArraySet<>(); + private final Set capabilities = new ArraySet<>(); static final String IMAP_REDACTED_LOG = "[IMAP command redacted]"; diff --git a/java/com/android/voicemail/impl/mail/store/ImapFolder.java b/java/com/android/voicemail/impl/mail/store/ImapFolder.java index d0a8fe0dfd..bf99ddef23 100644 --- a/java/com/android/voicemail/impl/mail/store/ImapFolder.java +++ b/java/com/android/voicemail/impl/mail/store/ImapFolder.java @@ -743,7 +743,7 @@ public class ImapFolder { exists = true; } - public class Quota { + public static class Quota { public final int occupied; public final int total; diff --git a/java/com/android/voicemail/impl/mail/store/ImapStore.java b/java/com/android/voicemail/impl/mail/store/ImapStore.java index 44b78be446..3561da1004 100644 --- a/java/com/android/voicemail/impl/mail/store/ImapStore.java +++ b/java/com/android/voicemail/impl/mail/store/ImapStore.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,7 +102,7 @@ public class ImapStore { } static class ImapMessage extends MimeMessage { - private ImapFolder folder; + private final ImapFolder folder; ImapMessage(String uid, ImapFolder folder) { this.uid = uid; diff --git a/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java b/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java index 133209c0f5..7be99b5f36 100644 --- a/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java +++ b/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,14 +55,14 @@ public class DigestMd5Utils { private static final String CHARSET = "utf-8"; - public String username; - public String password; - public String realm; - public String nonce; - public String nc; - public String cnonce; - public String digestUri; - public String qop; + public final String username; + public final String password; + public final String realm; + public final String nonce; + public final String nc; + public final String cnonce; + public final String digestUri; + public final String qop; public Data(ImapStore imapStore, MailTransport transport, Map challenge) { username = imapStore.getUsername(); @@ -114,7 +115,7 @@ public class DigestMd5Utils { private static class ResponseBuilder { - private StringBuilder builder = new StringBuilder(); + private final StringBuilder builder = new StringBuilder(); public ResponseBuilder appendQuoted(String key, String value) { if (builder.length() != 0) { @@ -223,7 +224,7 @@ public class DigestMd5Utils { private final String message; private int position = 0; - private Map result = new ArrayMap<>(); + private final Map result = new ArrayMap<>(); public DigestMessageParser(String message) { this.message = message; diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapList.java b/java/com/android/voicemail/impl/mail/store/imap/ImapList.java index a72883fa60..9fcd562aab 100644 --- a/java/com/android/voicemail/impl/mail/store/imap/ImapList.java +++ b/java/com/android/voicemail/impl/mail/store/imap/ImapList.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -190,7 +191,7 @@ public class ImapList extends ImapElement { *

We can't use toString(), because it's for debugging (meaning the format may change any * time), and it won't expand literals. */ - private final StringBuilder flatten(StringBuilder sb) { + private StringBuilder flatten(StringBuilder sb) { sb.append('['); for (int i = 0; i < list.size(); i++) { if (i > 0) { diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java b/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java index 76d3c6e912..9fb5c7b3c7 100644 --- a/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java +++ b/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ import java.io.UnsupportedEncodingException; /** Subclass of {@link ImapString} used for non literals. */ public class ImapSimpleString extends ImapString { - private final String TAG = "ImapSimpleString"; + private static final String TAG = "ImapSimpleString"; private String string; /* package */ ImapSimpleString(String string) { diff --git a/java/com/android/voicemail/impl/protocol/CvvmProtocol.java b/java/com/android/voicemail/impl/protocol/CvvmProtocol.java index a4b54f68c8..ae5c6d9451 100644 --- a/java/com/android/voicemail/impl/protocol/CvvmProtocol.java +++ b/java/com/android/voicemail/impl/protocol/CvvmProtocol.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,9 +30,9 @@ import com.android.voicemail.impl.sms.OmtpMessageSender; */ public class CvvmProtocol extends VisualVoicemailProtocol { - private static String IMAP_CHANGE_TUI_PWD_FORMAT = "CHANGE_TUI_PWD PWD=%1$s OLD_PWD=%2$s"; - private static String IMAP_CHANGE_VM_LANG_FORMAT = "CHANGE_VM_LANG Lang=%1$s"; - private static String IMAP_CLOSE_NUT = "CLOSE_NUT"; + private static final String IMAP_CHANGE_TUI_PWD_FORMAT = "CHANGE_TUI_PWD PWD=%1$s OLD_PWD=%2$s"; + private static final String IMAP_CHANGE_VM_LANG_FORMAT = "CHANGE_VM_LANG Lang=%1$s"; + private static final String IMAP_CLOSE_NUT = "CLOSE_NUT"; @Override public OmtpMessageSender createMessageSender( diff --git a/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java b/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java index 6d6a0a1af0..df4d5c8127 100644 --- a/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java +++ b/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +30,7 @@ public class MinimalIntervalPolicy implements Policy { BaseTask task; TaskId id; - int blockForMillis; + final int blockForMillis; public MinimalIntervalPolicy(int blockForMillis) { this.blockForMillis = blockForMillis; diff --git a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java index 883827b877..9a41c119c1 100644 --- a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java +++ b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +61,7 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable { private static final int ACTION_REQUEST_SENT_REQUEST_CODE = 0; - private CompletableFuture future = new CompletableFuture<>(); + private final CompletableFuture future = new CompletableFuture<>(); private final Context context; private final PhoneAccountHandle phoneAccountHandle; diff --git a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java index 439afd92fd..561ba6339d 100644 --- a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java +++ b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -301,8 +302,8 @@ public class OmtpVvmSyncService { /** Callback for {@link ImapHelper#fetchTranscription(TranscriptionFetchedCallback, String)} */ public static class TranscriptionFetchedCallback { - private Context context; - private Voicemail voicemail; + private final Context context; + private final Voicemail voicemail; public TranscriptionFetchedCallback(Context context, Voicemail voicemail) { this.context = context; diff --git a/java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java b/java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java index 259d79bcc0..4cdf330acc 100644 --- a/java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java +++ b/java/com/android/voicemail/impl/sync/VoicemailStatusQueryHelper.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,9 +40,9 @@ public class VoicemailStatusQueryHelper { public static final int NOTIFICATION_CHANNEL_STATE = 2; public static final int SOURCE_PACKAGE = 3; - private Context context; - private ContentResolver contentResolver; - private Uri sourceUri; + private final Context context; + private final ContentResolver contentResolver; + private final Uri sourceUri; public VoicemailStatusQueryHelper(Context context) { this.context = context; diff --git a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java index a033ba86ea..43ba5af01e 100644 --- a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java +++ b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,9 +53,9 @@ public class VoicemailsQueryHelper { static final String DELETED_SELECTION = Voicemails.DELETED + "=1"; static final String ARCHIVED_SELECTION = Voicemails.ARCHIVED + "=0"; - private Context context; - private ContentResolver contentResolver; - private Uri sourceUri; + private final Context context; + private final ContentResolver contentResolver; + private final Uri sourceUri; public VoicemailsQueryHelper(Context context) { this.context = context; diff --git a/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java b/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java index 8136f43cdf..1fdf917b09 100644 --- a/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java +++ b/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,9 +51,9 @@ public abstract class VvmNetworkRequestCallback extends ConnectivityManager.Netw public static final String NETWORK_REQUEST_FAILED_TIMEOUT = "timeout"; public static final String NETWORK_REQUEST_FAILED_LOST = "lost"; - protected Context context; - protected PhoneAccountHandle phoneAccount; - protected NetworkRequest networkRequest; + protected final Context context; + protected final PhoneAccountHandle phoneAccount; + protected final NetworkRequest networkRequest; private ConnectivityManager connectivityManager; private final OmtpVvmCarrierConfigHelper carrierConfigHelper; private final VoicemailStatus.Editor status; diff --git a/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java b/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java index b72aecebf3..ab00c6b9c1 100644 --- a/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java +++ b/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +34,7 @@ public class IndentingPrintWriter extends PrintWriter { private final int wrapLength; /** Mutable version of current indent */ - private StringBuilder indentBuilder = new StringBuilder(); + private final StringBuilder indentBuilder = new StringBuilder(); /** Cache of current {@link #indentBuilder} value */ private char[] currentIndent; /** Length of current line being built, excluding any indent */ @@ -45,7 +46,7 @@ public class IndentingPrintWriter extends PrintWriter { */ private boolean emptyLine = true; - private char[] singleChar = new char[1]; + private final char[] singleChar = new char[1]; public IndentingPrintWriter(Writer writer, String singleIndent) { this(writer, singleIndent, -1); diff --git a/java/com/android/voicemail/impl/utils/XmlUtils.java b/java/com/android/voicemail/impl/utils/XmlUtils.java index f5703f30f8..4abb34cb2f 100644 --- a/java/com/android/voicemail/impl/utils/XmlUtils.java +++ b/java/com/android/voicemail/impl/utils/XmlUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +26,7 @@ import org.xmlpull.v1.XmlPullParserException; public class XmlUtils { - public static final ArrayMap readThisArrayMapXml( + public static ArrayMap readThisArrayMapXml( XmlPullParser parser, String endTag, String[] name, ReadMapCallback callback) throws XmlPullParserException, java.io.IOException { ArrayMap map = new ArrayMap<>(); @@ -57,7 +58,7 @@ public class XmlUtils { * @param name An array of one string, used to return the name attribute of the list's tag. * @return HashMap The newly generated list. */ - public static final ArrayList readThisListXml( + public static ArrayList readThisListXml( XmlPullParser parser, String endTag, String[] name, @@ -197,7 +198,7 @@ public class XmlUtils { throw new XmlPullParserException("Unexpected end of document in <" + tagName + ">"); } - private static final Object readThisPrimitiveValueXml(XmlPullParser parser, String tagName) + private static Object readThisPrimitiveValueXml(XmlPullParser parser, String tagName) throws XmlPullParserException, java.io.IOException { try { if (tagName.equals("int")) { -- GitLab From d864eabf1236884c6a0529bae69fdca6e752a3c7 Mon Sep 17 00:00:00 2001 From: Michael W Date: Sat, 21 Oct 2023 21:25:40 +0200 Subject: [PATCH 06/36] Dialer: Lambs...erm...Lambdas! Change-Id: I19532d0d6b8f0e821d1908f473b51157f72520e0 --- .../common/dialog/CallSubjectDialog.java | 76 +++++------- .../contacts/common/list/ViewPagerTabs.java | 8 +- .../common/model/AccountTypeManager.java | 56 +++++---- .../common/model/account/BaseAccountType.java | 39 +++---- .../SelectPhoneAccountDialogFragment.java | 38 +++--- .../dialer/app/calllog/CallLogAdapter.java | 39 ++----- .../dialer/app/calllog/CallLogFragment.java | 16 +-- .../VoicemailNotificationJobService.java | 7 +- .../app/calllog/VoicemailQueryHandler.java | 13 +-- .../app/settings/SoundSettingsFragment.java | 28 ++--- .../voicemail/VoicemailPlaybackLayout.java | 29 ++--- .../binary/aosp/AospDialerApplication.java | 9 +- .../dialer/callstats/CallStatsAdapter.java | 3 +- .../callstats/DoubleDatePickerDialog.java | 59 +++------- .../concurrent/DialerExecutorModule.java | 52 ++++----- .../common/concurrent/DialerFutures.java | 50 ++++---- .../dialer/helplines/HelplineActivity.java | 3 +- .../dialer/helplines/HelplineAdapter.java | 8 +- .../UndemoteOutgoingCallReceiver.java | 14 +-- .../android/dialer/lookup/LookupProvider.java | 10 +- .../notification/NotificationThrottler.java | 10 +- .../simulator/impl/SimulatorVideoCall.java | 2 +- .../simulator/service/SimulatorService.java | 21 +--- java/com/android/dialer/util/DialerUtils.java | 8 +- .../listui/error/VoicemailErrorMessage.java | 105 +++++++---------- .../error/VoicemailTosMessageCreator.java | 90 +++++---------- .../error/Vvm3VoicemailMessageCreator.java | 24 ++-- .../settings/VoicemailChangePinActivity.java | 7 +- .../settings/VoicemailSettingsFragment.java | 31 ++--- .../com/android/incallui/CallerInfoUtils.java | 19 ++- .../ConferenceParticipantListAdapter.java | 78 ++++++------- .../incallui/PostCharDialogFragment.java | 16 +-- .../android/incallui/VideoCallPresenter.java | 33 +++--- .../incallui/answer/impl/AnswerFragment.java | 60 +++------- .../impl/CreateCustomSmsDialogFragment.java | 45 ++------ .../answer/impl/SmsBottomSheetFragment.java | 14 +-- .../impl/affordance/SwipeButtonHelper.java | 25 ++-- .../impl/affordance/SwipeButtonView.java | 44 +++---- .../answermethod/FlingUpDownTouchHandler.java | 9 +- .../incall/impl/MappedButtonConfig.java | 26 ++--- .../incallui/ringtone/InCallTonePlayer.java | 10 +- .../incallui/rtt/impl/AudioSelectMenu.java | 6 +- .../incallui/spam/SpamCallListListener.java | 3 +- .../spam/SpamNotificationActivity.java | 75 +++++------- .../impl/SurfaceViewVideoCallFragment.java | 56 ++------- .../video/impl/VideoCallFragment.java | 108 +++--------------- .../impl/fetch/FetchVoicemailReceiver.java | 59 +++++----- .../impl/scheduling/TaskExecutor.java | 33 ++---- .../impl/sync/VvmNetworkRequestCallback.java | 14 +-- 49 files changed, 534 insertions(+), 1054 deletions(-) diff --git a/java/com/android/contacts/common/dialog/CallSubjectDialog.java b/java/com/android/contacts/common/dialog/CallSubjectDialog.java index 70d6ba25e2..1e1ee0d56b 100644 --- a/java/com/android/contacts/common/dialog/CallSubjectDialog.java +++ b/java/com/android/contacts/common/dialog/CallSubjectDialog.java @@ -115,27 +115,19 @@ public class CallSubjectDialog extends AppCompatActivity { private SharedPreferences mPrefs; private List mSubjectHistory; /** Handles displaying the list of past call subjects. */ - private final View.OnClickListener mHistoryOnClickListener = - new View.OnClickListener() { - @Override - public void onClick(View v) { - hideSoftKeyboard(CallSubjectDialog.this, mCallSubjectView); - showCallHistory(mSubjectList.getVisibility() == View.GONE); - } - }; + private final View.OnClickListener mHistoryOnClickListener = v -> { + hideSoftKeyboard(CallSubjectDialog.this, mCallSubjectView); + showCallHistory(mSubjectList.getVisibility() == View.GONE); + }; /** * Handles auto-hiding the call history when user clicks in the call subject field to give it * focus. */ - private final View.OnClickListener mCallSubjectClickListener = - new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mSubjectList.getVisibility() == View.VISIBLE) { - showCallHistory(false); - } - } - }; + private final View.OnClickListener mCallSubjectClickListener = v -> { + if (mSubjectList.getVisibility() == View.VISIBLE) { + showCallHistory(false); + } + }; private long mPhotoID; private Uri mPhotoUri; @@ -147,43 +139,31 @@ public class CallSubjectDialog extends AppCompatActivity { private int mContactType; private PhoneAccountHandle mPhoneAccountHandle; /** Handles starting a call with a call subject specified. */ - private final View.OnClickListener mSendAndCallOnClickListener = - new View.OnClickListener() { - @Override - public void onClick(View v) { - String subject = mCallSubjectView.getText().toString(); - PreCall.start( - CallSubjectDialog.this, - new CallIntentBuilder(mNumber, CallInitiationType.Type.CALL_SUBJECT_DIALOG) - .setPhoneAccountHandle(mPhoneAccountHandle) - .setCallSubject(subject)); - - mSubjectHistory.add(subject); - saveSubjectHistory(mSubjectHistory); - finish(); - } - }; + private final View.OnClickListener mSendAndCallOnClickListener = v -> { + String subject = mCallSubjectView.getText().toString(); + PreCall.start( + CallSubjectDialog.this, + new CallIntentBuilder(mNumber, CallInitiationType.Type.CALL_SUBJECT_DIALOG) + .setPhoneAccountHandle(mPhoneAccountHandle) + .setCallSubject(subject)); + + mSubjectHistory.add(subject); + saveSubjectHistory(mSubjectHistory); + finish(); + }; + /** Click listener which handles user clicks outside of the dialog. */ - private View.OnClickListener mBackgroundListener = - new View.OnClickListener() { - @Override - public void onClick(View v) { - finish(); - } - }; + private final View.OnClickListener mBackgroundListener = v -> finish(); /** * Item click listener which handles user clicks on the items in the list view. Dismisses the * activity, returning the subject to the caller and closing the activity with the {@link * Activity#RESULT_OK} result code. */ - private AdapterView.OnItemClickListener mItemClickListener = - new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView arg0, View view, int position, long arg3) { - mCallSubjectView.setText(mSubjectHistory.get(position)); - showCallHistory(false); - } - }; + private final AdapterView.OnItemClickListener mItemClickListener = + (arg0, view, position, arg3) -> { + mCallSubjectView.setText(mSubjectHistory.get(position)); + showCallHistory(false); + }; /** * Show the call subject dialog given a phone number to dial (e.g. from the dialpad). diff --git a/java/com/android/contacts/common/list/ViewPagerTabs.java b/java/com/android/contacts/common/list/ViewPagerTabs.java index acbe1e5669..5ab23b867f 100644 --- a/java/com/android/contacts/common/list/ViewPagerTabs.java +++ b/java/com/android/contacts/common/list/ViewPagerTabs.java @@ -184,13 +184,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP tabView = textView; } - tabView.setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - mPager.setCurrentItem(getRtlPosition(position)); - } - }); + tabView.setOnClickListener(v -> mPager.setCurrentItem(getRtlPosition(position))); tabView.setOnLongClickListener(new OnTabLongClickListener(position)); diff --git a/java/com/android/contacts/common/model/AccountTypeManager.java b/java/com/android/contacts/common/model/AccountTypeManager.java index f5b113c273..070c9a7e37 100644 --- a/java/com/android/contacts/common/model/AccountTypeManager.java +++ b/java/com/android/contacts/common/model/AccountTypeManager.java @@ -174,37 +174,33 @@ class AccountTypeManagerImpl extends AccountTypeManager private static final int MESSAGE_LOAD_DATA = 0; private static final int MESSAGE_PROCESS_BROADCAST_INTENT = 1; - private static final Comparator ACCOUNT_COMPARATOR = - new Comparator() { - @Override - public int compare(AccountWithDataSet a, AccountWithDataSet b) { - if (Objects.equals(a.name, b.name) - && Objects.equals(a.type, b.type) - && Objects.equals(a.dataSet, b.dataSet)) { - return 0; - } else if (b.name == null || b.type == null) { - return -1; - } else if (a.name == null || a.type == null) { - return 1; - } else { - int diff = a.name.compareTo(b.name); - if (diff != 0) { - return diff; - } - diff = a.type.compareTo(b.type); - if (diff != 0) { - return diff; - } + private static final Comparator ACCOUNT_COMPARATOR = (a, b) -> { + if (Objects.equals(a.name, b.name) + && Objects.equals(a.type, b.type) + && Objects.equals(a.dataSet, b.dataSet)) { + return 0; + } else if (b.name == null || b.type == null) { + return -1; + } else if (a.name == null || a.type == null) { + return 1; + } else { + int diff = a.name.compareTo(b.name); + if (diff != 0) { + return diff; + } + diff = a.type.compareTo(b.type); + if (diff != 0) { + return diff; + } - // Accounts without data sets get sorted before those that have them. - if (a.dataSet != null) { - return b.dataSet == null ? 1 : a.dataSet.compareTo(b.dataSet); - } else { - return -1; - } - } - } - }; + // Accounts without data sets get sorted before those that have them. + if (a.dataSet != null) { + return b.dataSet == null ? 1 : a.dataSet.compareTo(b.dataSet); + } else { + return -1; + } + } + }; private final InvitableAccountTypeCache mInvitableAccountTypeCache; /** * The boolean value is equal to true if the {@link InvitableAccountTypeCache} has been diff --git a/java/com/android/contacts/common/model/account/BaseAccountType.java b/java/com/android/contacts/common/model/account/BaseAccountType.java index 1cf41514a2..d96e28c836 100644 --- a/java/com/android/contacts/common/model/account/BaseAccountType.java +++ b/java/com/android/contacts/common/model/account/BaseAccountType.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,28 +53,22 @@ import org.xmlpull.v1.XmlPullParserException; public abstract class BaseAccountType extends AccountType { - public static final StringInflater ORGANIZATION_BODY_INFLATER = - new StringInflater() { - @Override - public CharSequence inflateUsing(Context context, ContentValues values) { - final CharSequence companyValue = - values.containsKey(Organization.COMPANY) - ? values.getAsString(Organization.COMPANY) - : null; - final CharSequence titleValue = - values.containsKey(Organization.TITLE) - ? values.getAsString(Organization.TITLE) - : null; - - if (companyValue != null && titleValue != null) { - return companyValue + ": " + titleValue; - } else if (companyValue == null) { - return titleValue; - } else { - return companyValue; - } - } - }; + public static final StringInflater ORGANIZATION_BODY_INFLATER = (context, values) -> { + final CharSequence companyValue = values.containsKey(Organization.COMPANY) + ? values.getAsString(Organization.COMPANY) + : null; + final CharSequence titleValue = values.containsKey(Organization.TITLE) + ? values.getAsString(Organization.TITLE) + : null; + + if (companyValue != null && titleValue != null) { + return companyValue + ": " + titleValue; + } else if (companyValue == null) { + return titleValue; + } else { + return companyValue; + } + }; protected static final int FLAGS_PHONE = EditorInfo.TYPE_CLASS_PHONE; protected static final int FLAGS_EMAIL = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java index b4d7b82b9a..0b3575bd91 100644 --- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java +++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java @@ -102,31 +102,23 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { isSelected = false; final DialogInterface.OnClickListener selectionListener = - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - isSelected = true; - PhoneAccountHandle selectedAccountHandle = - SelectPhoneAccountDialogOptionsUtil.getPhoneAccountHandle( - options.getEntriesList().get(which)); - Bundle result = new Bundle(); - result.putParcelable( - SelectPhoneAccountListener.EXTRA_SELECTED_ACCOUNT_HANDLE, selectedAccountHandle); - result.putBoolean(SelectPhoneAccountListener.EXTRA_SET_DEFAULT, isDefaultChecked); - result.putString(SelectPhoneAccountListener.EXTRA_CALL_ID, getCallId()); - if (listener != null) { - listener.onReceiveResult(SelectPhoneAccountListener.RESULT_SELECTED, result); - } - } - }; + (dialog, which) -> { + isSelected = true; + PhoneAccountHandle selectedAccountHandle = + SelectPhoneAccountDialogOptionsUtil.getPhoneAccountHandle( + options.getEntriesList().get(which)); + Bundle result = new Bundle(); + result.putParcelable( + SelectPhoneAccountListener.EXTRA_SELECTED_ACCOUNT_HANDLE, selectedAccountHandle); + result.putBoolean(SelectPhoneAccountListener.EXTRA_SET_DEFAULT, isDefaultChecked); + result.putString(SelectPhoneAccountListener.EXTRA_CALL_ID, getCallId()); + if (listener != null) { + listener.onReceiveResult(SelectPhoneAccountListener.RESULT_SELECTED, result); + } + }; final CompoundButton.OnCheckedChangeListener checkListener = - new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton check, boolean isChecked) { - isDefaultChecked = isChecked; - } - }; + (check, isChecked) -> isDefaultChecked = isChecked; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); ListAdapter selectAccountListAdapter = diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index d4f16b2049..6057649e61 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -205,34 +205,17 @@ public class CallLogAdapter extends GroupingListAdapter .getResources() .getQuantityString( R.plurals.delete_voicemails_confirmation_dialog_title, selectedItems.size())) - .setPositiveButton( - R.string.voicemailMultiSelectDeleteConfirm, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int button) { - LogUtil.i( - "CallLogAdapter.showDeleteSelectedItemsDialog", - "onClick, these items to delete " + voicemailsToDeleteOnConfirmation); - deleteSelectedItems(voicemailsToDeleteOnConfirmation); - actionMode.finish(); - dialog.cancel(); - } - }) - .setOnCancelListener( - new OnCancelListener() { - @Override - public void onCancel(DialogInterface dialogInterface) { - dialogInterface.cancel(); - } - }) - .setNegativeButton( - R.string.voicemailMultiSelectDeleteCancel, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int button) { - dialog.cancel(); - } - }) + .setPositiveButton(R.string.voicemailMultiSelectDeleteConfirm, (dialog, button) -> { + LogUtil.i( + "CallLogAdapter.showDeleteSelectedItemsDialog", + "onClick, these items to delete " + voicemailsToDeleteOnConfirmation); + deleteSelectedItems(voicemailsToDeleteOnConfirmation); + actionMode.finish(); + dialog.cancel(); + }) + .setOnCancelListener(dialogInterface -> dialogInterface.cancel()) + .setNegativeButton(R.string.voicemailMultiSelectDeleteCancel, + (dialog, button) -> dialog.cancel()) .show(); } diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index d88306b73f..3442d73d61 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -256,16 +256,12 @@ public class CallLogFragment extends Fragment } // Workaround for framework issue: the smooth-scroll doesn't // occur if setSelection() is called immediately before. - handler.post( - new Runnable() { - @Override - public void run() { - if (getActivity() == null || getActivity().isFinishing()) { - return; - } - recyclerView.smoothScrollToPosition(0); - } - }); + handler.post(() -> { + if (getActivity() == null || getActivity().isFinishing()) { + return; + } + recyclerView.smoothScrollToPosition(0); + }); scrollToTop = false; } diff --git a/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java b/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java index 754ab2727a..c6ea0699b2 100644 --- a/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java +++ b/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,11 +53,7 @@ public class VoicemailNotificationJobService extends JobService { @Override public boolean onStartJob(JobParameters params) { LogUtil.i("VoicemailNotificationJobService.onStartJob", "updating notification"); - VisualVoicemailUpdateTask.scheduleTask( - this, - () -> { - jobFinished(params, false); - }); + VisualVoicemailUpdateTask.scheduleTask(this, () -> jobFinished(params, false)); return true; // Running in background } diff --git a/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java b/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java index cad838a553..c2729bc423 100644 --- a/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java +++ b/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,10 +47,8 @@ public class VoicemailQueryHandler extends AsyncQueryHandler { @WorkerThread public static void markAllNewVoicemailsAsOld(final @NonNull Context context) { ThreadUtil.postOnUiThread( - () -> { - new VoicemailQueryHandler(context.getContentResolver()) - .markNewVoicemailsAsOld(context, null); - }); + () -> new VoicemailQueryHandler(context.getContentResolver()) + .markNewVoicemailsAsOld(context, null)); } @WorkerThread @@ -60,10 +59,8 @@ public class VoicemailQueryHandler extends AsyncQueryHandler { return; } ThreadUtil.postOnUiThread( - () -> { - new VoicemailQueryHandler(context.getContentResolver()) - .markNewVoicemailsAsOld(context, voicemailUri); - }); + () -> new VoicemailQueryHandler(context.getContentResolver()) + .markNewVoicemailsAsOld(context, voicemailUri)); } /** Updates all new voicemails to mark them as old. */ diff --git a/java/com/android/dialer/app/settings/SoundSettingsFragment.java b/java/com/android/dialer/app/settings/SoundSettingsFragment.java index 128ebdc1e0..b2743391f0 100644 --- a/java/com/android/dialer/app/settings/SoundSettingsFragment.java +++ b/java/com/android/dialer/app/settings/SoundSettingsFragment.java @@ -20,7 +20,6 @@ package com.android.dialer.app.settings; import android.app.AlertDialog; import android.app.NotificationManager; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.media.RingtoneManager; import android.os.Bundle; @@ -67,13 +66,8 @@ public class SoundSettingsFragment extends DialerPreferenceFragment } } }; - private final Runnable ringtoneLookupRunnable = - new Runnable() { - @Override - public void run() { - updateRingtonePreferenceSummary(); - } - }; + private final Runnable ringtoneLookupRunnable = () -> updateRingtonePreferenceSummary(); + private SwitchPreferenceCompat vibrateWhenRinging; private SwitchPreferenceCompat playDtmfTone; private ListPreference dtmfToneLength; @@ -201,20 +195,12 @@ public class SoundSettingsFragment extends DialerPreferenceFragment if (newValue && !notificationManager.isNotificationPolicyAccessGranted()) { new AlertDialog.Builder(getContext()) .setMessage(R.string.incall_dnd_dialog_message) - .setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS); - startActivity(intent); - } - }) - .setNegativeButton(R.string.deny, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } + .setPositiveButton(R.string.allow, (dialog, which) -> { + dialog.dismiss(); + Intent intent = new Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS); + startActivity(intent); }) + .setNegativeButton(R.string.deny, (dialog, which) -> dialog.dismiss()) .show(); // At this time, it is unknown whether the user granted the permission diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java index 99967dcd0c..3f802207cd 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java +++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java @@ -92,16 +92,12 @@ public class VoicemailPlaybackLayout extends LinearLayout presenter.onVoicemailDeleted(viewHolder); final Uri deleteUri = voicemailUri; - final Runnable deleteCallback = - new Runnable() { - @Override - public void run() { - if (Objects.equals(deleteUri, voicemailUri)) { - CallLogAsyncTaskUtil.deleteVoicemail( - context, deleteUri, VoicemailPlaybackLayout.this); - } - } - }; + final Runnable deleteCallback = () -> { + if (Objects.equals(deleteUri, voicemailUri)) { + CallLogAsyncTaskUtil.deleteVoicemail( + context, deleteUri, VoicemailPlaybackLayout.this); + } + }; final Handler handler = new Handler(); // Add a little buffer time in case the user clicked "undo" at the end of the delay @@ -113,15 +109,10 @@ public class VoicemailPlaybackLayout extends LinearLayout R.string.snackbar_voicemail_deleted, Snackbar.LENGTH_LONG) .setDuration(VOICEMAIL_DELETE_DELAY_MS) - .setAction( - R.string.snackbar_undo, - new View.OnClickListener() { - @Override - public void onClick(View view) { - presenter.onVoicemailDeleteUndo(adapterPosition); - handler.removeCallbacks(deleteCallback); - } - }) + .setAction(R.string.snackbar_undo, view1 -> { + presenter.onVoicemailDeleteUndo(adapterPosition); + handler.removeCallbacks(deleteCallback); + }) .setActionTextColor( context.getResources().getColor(R.color.dialer_snackbar_action_text_color)) .show(); diff --git a/java/com/android/dialer/binary/aosp/AospDialerApplication.java b/java/com/android/dialer/binary/aosp/AospDialerApplication.java index fd50110a39..52366cefc9 100644 --- a/java/com/android/dialer/binary/aosp/AospDialerApplication.java +++ b/java/com/android/dialer/binary/aosp/AospDialerApplication.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,12 +82,6 @@ public class AospDialerApplication extends DialerApplication implements @Override public PhoneNumberCacheBindings newPhoneNumberCacheBindings() { - return new PhoneNumberCacheBindings() { - @Override - @Nullable - public CachedNumberLookupService getCachedNumberLookupService() { - return new LookupCacheService(); - } - }; + return LookupCacheService::new; } } diff --git a/java/com/android/dialer/callstats/CallStatsAdapter.java b/java/com/android/dialer/callstats/CallStatsAdapter.java index b55190e0a7..2f18a8cffa 100644 --- a/java/com/android/dialer/callstats/CallStatsAdapter.java +++ b/java/com/android/dialer/callstats/CallStatsAdapter.java @@ -135,8 +135,7 @@ class CallStatsAdapter extends RecyclerView.Adapter { mTotalItem = new CallStatsDetails(null, 0, null, null, null, null, null, 0); mInfoLookup = new ConcurrentHashMap<>(); - mContactInfoCache = new ContactInfoCache(cache, - mContactInfoHelper, () -> notifyDataSetChanged()); + mContactInfoCache = new ContactInfoCache(cache, mContactInfoHelper, this::notifyDataSetChanged); if (!PermissionsUtil.hasContactsReadPermissions(context)) { mContactInfoCache.disableRequestProcessing(); } diff --git a/java/com/android/dialer/callstats/DoubleDatePickerDialog.java b/java/com/android/dialer/callstats/DoubleDatePickerDialog.java index ffbf46ab39..e0c40bfc86 100644 --- a/java/com/android/dialer/callstats/DoubleDatePickerDialog.java +++ b/java/com/android/dialer/callstats/DoubleDatePickerDialog.java @@ -106,51 +106,20 @@ public class DoubleDatePickerDialog extends AlertDialog }; private static final QuickSelection[] QUICKSELECTIONS = new QuickSelection[] { - new QuickSelection() { - @Override - public void adjustStartDate(Calendar date) { - date.set(Calendar.DAY_OF_MONTH, 1); - } - }, - new QuickSelection() { - @Override - public void adjustStartDate(Calendar date) { - final int currentMonth = date.get(Calendar.MONTH); - date.set(Calendar.MONTH, currentMonth - (currentMonth % 3)); - date.set(Calendar.DAY_OF_MONTH, 1); - } - }, - new QuickSelection() { - @Override - public void adjustStartDate(Calendar date) { - date.set(Calendar.MONTH, 0); - date.set(Calendar.DAY_OF_MONTH, 1); - } - }, - new QuickSelection() { - @Override - public void adjustStartDate(Calendar date) { - date.add(Calendar.WEEK_OF_YEAR, -1); - } - }, - new QuickSelection() { - @Override - public void adjustStartDate(Calendar date) { - date.add(Calendar.MONTH, -1); - } - }, - new QuickSelection() { - @Override - public void adjustStartDate(Calendar date) { - date.add(Calendar.MONTH, -3); - } - }, - new QuickSelection() { - @Override - public void adjustStartDate(Calendar date) { - date.add(Calendar.YEAR, -1); - } - }, + date -> date.set(Calendar.DAY_OF_MONTH, 1), + date -> { + final int currentMonth = date.get(Calendar.MONTH); + date.set(Calendar.MONTH, currentMonth - (currentMonth % 3)); + date.set(Calendar.DAY_OF_MONTH, 1); + }, + date -> { + date.set(Calendar.MONTH, 0); + date.set(Calendar.DAY_OF_MONTH, 1); + }, + date -> date.add(Calendar.WEEK_OF_YEAR, -1), + date -> date.add(Calendar.MONTH, -1), + date -> date.add(Calendar.MONTH, -3), + date -> date.add(Calendar.YEAR, -1), }; private static final String YEAR = "year"; diff --git a/java/com/android/dialer/common/concurrent/DialerExecutorModule.java b/java/com/android/dialer/common/concurrent/DialerExecutorModule.java index 98738ed37f..b8659b14d2 100644 --- a/java/com/android/dialer/common/concurrent/DialerExecutorModule.java +++ b/java/com/android/dialer/common/concurrent/DialerExecutorModule.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,16 +57,13 @@ public abstract class DialerExecutorModule { static ExecutorService provideNonUiThreadPool() { return Executors.newFixedThreadPool( 5, - new ThreadFactory() { - @Override - public Thread newThread(Runnable runnable) { - LogUtil.i("DialerExecutorModule.newThread", "creating low priority thread"); - Thread thread = new Thread(runnable, "DialerExecutors-LowPriority"); - // Java thread priority 4 corresponds to Process.THREAD_PRIORITY_BACKGROUND (10) - thread.setPriority(4); - return thread; - } - }); + runnable -> { + LogUtil.i("DialerExecutorModule.newThread", "creating low priority thread"); + Thread thread = new Thread(runnable, "DialerExecutors-LowPriority"); + // Java thread priority 4 corresponds to Process.THREAD_PRIORITY_BACKGROUND (10) + thread.setPriority(4); + return thread; + }); } @Provides @@ -73,16 +71,13 @@ public abstract class DialerExecutorModule { @NonUiSerial static ScheduledExecutorService provideNonUiSerialExecutorService() { return Executors.newSingleThreadScheduledExecutor( - new ThreadFactory() { - @Override - public Thread newThread(Runnable runnable) { - LogUtil.i("NonUiTaskBuilder.newThread", "creating serial thread"); - Thread thread = new Thread(runnable, "DialerExecutors-LowPriority-Serial"); - // Java thread priority 4 corresponds to Process.THREAD_PRIORITY_BACKGROUND (10) - thread.setPriority(4); - return thread; - } - }); + runnable -> { + LogUtil.i("NonUiTaskBuilder.newThread", "creating serial thread"); + Thread thread = new Thread(runnable, "DialerExecutors-LowPriority-Serial"); + // Java thread priority 4 corresponds to Process.THREAD_PRIORITY_BACKGROUND (10) + thread.setPriority(4); + return thread; + }); } @Provides @@ -96,16 +91,13 @@ public abstract class DialerExecutorModule { @UiSerial static ScheduledExecutorService provideUiSerialExecutorService() { return Executors.newSingleThreadScheduledExecutor( - new ThreadFactory() { - @Override - public Thread newThread(Runnable runnable) { - LogUtil.i("DialerExecutorModule.newThread", "creating serial thread"); - Thread thread = new Thread(runnable, "DialerExecutors-HighPriority-Serial"); - // Java thread priority 5 corresponds to Process.THREAD_PRIORITY_DEFAULT (0) - thread.setPriority(5); - return thread; - } - }); + runnable -> { + LogUtil.i("DialerExecutorModule.newThread", "creating serial thread"); + Thread thread = new Thread(runnable, "DialerExecutors-HighPriority-Serial"); + // Java thread priority 5 corresponds to Process.THREAD_PRIORITY_DEFAULT (0) + thread.setPriority(5); + return thread; + }); } @Provides diff --git a/java/com/android/dialer/common/concurrent/DialerFutures.java b/java/com/android/dialer/common/concurrent/DialerFutures.java index ac88e6aa15..0c9f455bf7 100644 --- a/java/com/android/dialer/common/concurrent/DialerFutures.java +++ b/java/com/android/dialer/common/concurrent/DialerFutures.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,34 +58,31 @@ public class DialerFutures { final AtomicInteger pending = new AtomicInteger(output.futures.size()); for (final ListenableFuture future : output.futures) { future.addListener( - new Runnable() { - @Override - public void run() { - // Call get() and then set() instead of getAndSet() because a volatile read/write is - // cheaper than a CAS and atomicity is guaranteed by setFuture. - AggregateFuture output = ref.get(); - if (output != null) { - T value = null; - try { - value = Futures.getDone(future); - } catch (ExecutionException e) { - ref.set(null); // unpin - output.setException(e); - return; - } - if (!predicate.apply(value)) { - if (pending.decrementAndGet() == 0) { - // we are the last future (and every other future hasn't matched or failed). - output.set(defaultValue); - // no point in clearing the ref, every other listener has already run + () -> { + // Call get() and then set() instead of getAndSet() because a volatile read/write is + // cheaper than a CAS and atomicity is guaranteed by setFuture. + AggregateFuture output1 = ref.get(); + if (output1 != null) { + T value = null; + try { + value = Futures.getDone(future); + } catch (ExecutionException e) { + ref.set(null); // unpin + output1.setException(e); + return; + } + if (!predicate.apply(value)) { + if (pending.decrementAndGet() == 0) { + // we are the last future (and every other future hasn't matched or failed). + output1.set(defaultValue); + // no point in clearing the ref, every other listener has already run + } + } else { + ref.set(null); // unpin + output1.set(value); } - } else { - ref.set(null); // unpin - output.set(value); } - } - } - }, + }, MoreExecutors.directExecutor()); } return output; diff --git a/java/com/android/dialer/helplines/HelplineActivity.java b/java/com/android/dialer/helplines/HelplineActivity.java index fefe69204a..5a624890a4 100755 --- a/java/com/android/dialer/helplines/HelplineActivity.java +++ b/java/com/android/dialer/helplines/HelplineActivity.java @@ -141,8 +141,7 @@ public class HelplineActivity extends AppCompatActivity { .setTitle(R.string.helplines_help_title) .setMessage(R.string.helplines_help_message) .setPositiveButton(android.R.string.ok, null) - .setNeutralButton(R.string.helpline_button_more, (dialog, which) -> { - showMoreInfo(); }) + .setNeutralButton(R.string.helpline_button_more, (dialog, which) -> showMoreInfo()) .show(); } diff --git a/java/com/android/dialer/helplines/HelplineAdapter.java b/java/com/android/dialer/helplines/HelplineAdapter.java index 26e9011428..1f676869b4 100644 --- a/java/com/android/dialer/helplines/HelplineAdapter.java +++ b/java/com/android/dialer/helplines/HelplineAdapter.java @@ -125,9 +125,7 @@ class HelplineAdapter extends RecyclerView.Adapter { } void bind(HelplineItem item) { - mItemView.setOnClickListener(v -> { - mListener.onItemClicked(item); - }); + mItemView.setOnClickListener(v -> mListener.onItemClicked(item)); String name = item.getName(); if (!TextUtils.isEmpty(name)) { @@ -151,9 +149,7 @@ class HelplineAdapter extends RecyclerView.Adapter { String number = item.getItem().getNumber(); if (!TextUtils.isEmpty(number)) { mCallIcon.setVisibility(View.VISIBLE); - mCallIcon.setOnClickListener(v -> { - mListener.initiateCall(number); - }); + mCallIcon.setOnClickListener(v -> mListener.initiateCall(number)); } } } diff --git a/java/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java b/java/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java index 68b011a041..76f7adec39 100644 --- a/java/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java +++ b/java/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,15 +51,12 @@ public class UndemoteOutgoingCallReceiver extends BroadcastReceiver { if (TextUtils.isEmpty(number)) { return; } - new Thread() { - @Override - public void run() { - final long id = getContactIdFromPhoneNumber(context, number); - if (id != NO_CONTACT_FOUND) { - undemoteContactWithId(context, id); - } + new Thread(() -> { + final long id = getContactIdFromPhoneNumber(context, number); + if (id != NO_CONTACT_FOUND) { + undemoteContactWithId(context, id); } - }.start(); + }).start(); } } diff --git a/java/com/android/dialer/lookup/LookupProvider.java b/java/com/android/dialer/lookup/LookupProvider.java index 42d7dd2e31..3061b5558c 100644 --- a/java/com/android/dialer/lookup/LookupProvider.java +++ b/java/com/android/dialer/lookup/LookupProvider.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 Xiao-Long Chen + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -166,12 +167,9 @@ public class LookupProvider extends ContentProvider { final Location finalLastLocation = lastLocation; final int finalMaxResults = maxResults; - return execute(new Callable() { - @Override - public Cursor call() { - return handleFilter(match, projection, filter, finalMaxResults, finalLastLocation); - } - }, "FilterThread"); + return execute( + () -> handleFilter(match, projection, filter, finalMaxResults, finalLastLocation), + "FilterThread"); } return null; diff --git a/java/com/android/dialer/notification/NotificationThrottler.java b/java/com/android/dialer/notification/NotificationThrottler.java index f55f815ce7..c34a883d4e 100644 --- a/java/com/android/dialer/notification/NotificationThrottler.java +++ b/java/com/android/dialer/notification/NotificationThrottler.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,14 +113,7 @@ class NotificationThrottler { notifications.add(notification); } } - Collections.sort( - notifications, - new Comparator() { - @Override - public int compare(StatusBarNotification left, StatusBarNotification right) { - return Long.compare(left.getPostTime(), right.getPostTime()); - } - }); + notifications.sort(Comparator.comparingLong(StatusBarNotification::getPostTime)); return notifications; } diff --git a/java/com/android/dialer/simulator/impl/SimulatorVideoCall.java b/java/com/android/dialer/simulator/impl/SimulatorVideoCall.java index 3c7cb3b36e..9dfe0782d8 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorVideoCall.java +++ b/java/com/android/dialer/simulator/impl/SimulatorVideoCall.java @@ -79,7 +79,7 @@ final class SimulatorVideoCall handleNewConnection(connection); // Telecom will force the connection to switch to Dialing when we return it. Wait until after // we're returned it before changing call state. - ThreadUtil.postOnUiThread(() -> connection.setActive()); + ThreadUtil.postOnUiThread(connection::setActive); } } diff --git a/java/com/android/dialer/simulator/service/SimulatorService.java b/java/com/android/dialer/simulator/service/SimulatorService.java index 974a3eeda8..1b679b5bb9 100644 --- a/java/com/android/dialer/simulator/service/SimulatorService.java +++ b/java/com/android/dialer/simulator/service/SimulatorService.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,34 +90,22 @@ public class SimulatorService extends Service { @Override public void populateDataBase() throws RemoteException { - doSecurityCheck( - () -> { - simulatorMainPortal.execute(new String[] {POPULATE_DATABASE}); - }); + doSecurityCheck(() -> simulatorMainPortal.execute(new String[] {POPULATE_DATABASE})); } @Override public void cleanDataBase() throws RemoteException { - doSecurityCheck( - () -> { - simulatorMainPortal.execute(new String[] {CLEAN_DATABASE}); - }); + doSecurityCheck(() -> simulatorMainPortal.execute(new String[] {CLEAN_DATABASE})); } @Override public void enableSimulatorMode() throws RemoteException { - doSecurityCheck( - () -> { - simulatorMainPortal.execute(new String[] {ENABLE_SIMULATOR_MODE}); - }); + doSecurityCheck(() -> simulatorMainPortal.execute(new String[] {ENABLE_SIMULATOR_MODE})); } @Override public void disableSimulatorMode() throws RemoteException { - doSecurityCheck( - () -> { - simulatorMainPortal.execute(new String[] {DISABLE_SIMULATOR_MODE}); - }); + doSecurityCheck(() -> simulatorMainPortal.execute(new String[] {DISABLE_SIMULATOR_MODE})); } @Override diff --git a/java/com/android/dialer/util/DialerUtils.java b/java/com/android/dialer/util/DialerUtils.java index 13c4929594..ff0ba4f11e 100644 --- a/java/com/android/dialer/util/DialerUtils.java +++ b/java/com/android/dialer/util/DialerUtils.java @@ -95,13 +95,7 @@ public class DialerUtils { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(R.string.outgoing_wps_warning); builder.setPositiveButton( - R.string.dialog_continue, - new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - placeCallOrMakeToast(context, intent); - } - }); + R.string.dialog_continue, (dialog, which) -> placeCallOrMakeToast(context, intent)); builder.setNegativeButton(android.R.string.cancel, null); builder.create().show(); } else { diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java index cb1c32934b..c73a563e74 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +23,6 @@ import android.provider.Settings; import android.provider.VoicemailContract; import android.telecom.PhoneAccountHandle; import android.view.View; -import android.view.View.OnClickListener; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -130,13 +130,10 @@ public class VoicemailErrorMessage { public static Action createChangeAirplaneModeAction(final Context context) { return new Action( context.getString(R.string.voicemail_action_turn_off_airplane_mode), - new OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS); - context.startActivity(intent); - } - }); + v -> { + Intent intent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS); + context.startActivity(intent); + }); } @NonNull @@ -144,14 +141,11 @@ public class VoicemailErrorMessage { final Context context, PhoneAccountHandle phoneAccountHandle) { return new Action( context.getString(R.string.voicemail_action_set_pin), - new OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(context, VoicemailChangePinActivity.class); - intent.putExtra(VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); - context.startActivity(intent); - } - }); + v -> { + Intent intent = new Intent(context, VoicemailChangePinActivity.class); + intent.putExtra(VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); + context.startActivity(intent); + }); } @NonNull @@ -159,43 +153,32 @@ public class VoicemailErrorMessage { final Context context) { return new Action( context.getString(R.string.voicemail_action_call_voicemail), - new OnClickListener() { - @Override - public void onClick(View v) { - PreCall.start( + v -> PreCall.start( context, CallIntentBuilder.forVoicemail( - CallInitiationType.Type.VOICEMAIL_ERROR_MESSAGE)); - } - }); + CallInitiationType.Type.VOICEMAIL_ERROR_MESSAGE))); } @NonNull public static Action createSyncAction(final Context context, final VoicemailStatus status) { return new Action( context.getString(R.string.voicemail_action_sync), - new OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL); - intent.setPackage(status.sourcePackage); - context.sendBroadcast(intent); - } - }); + v -> { + Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL); + intent.setPackage(status.sourcePackage); + context.sendBroadcast(intent); + }); } @NonNull public static Action createRetryAction(final Context context, final VoicemailStatus status) { return new Action( context.getString(R.string.voicemail_action_retry), - new OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL); - intent.setPackage(status.sourcePackage); - context.sendBroadcast(intent); - } - }); + v -> { + Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL); + intent.setPackage(status.sourcePackage); + context.sendBroadcast(intent); + }); } @NonNull @@ -207,20 +190,17 @@ public class VoicemailErrorMessage { PhoneAccountHandle phoneAccountHandle) { return new Action( context.getString(R.string.voicemail_action_turn_archive_on), - new OnClickListener() { - @Override - public void onClick(View v) { - Assert.checkArgument( - VoicemailComponent.get(context) - .getVoicemailClient() - .isVoicemailArchiveAvailable(context)); - voicemailClient.setVoicemailArchiveEnabled(context, phoneAccountHandle, true); - Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL); - intent.setPackage(status.sourcePackage); - context.sendBroadcast(intent); - statusReader.refresh(); - } - }); + v -> { + Assert.checkArgument( + VoicemailComponent.get(context) + .getVoicemailClient() + .isVoicemailArchiveAvailable(context)); + voicemailClient.setVoicemailArchiveEnabled(context, phoneAccountHandle, true); + Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL); + intent.setPackage(status.sourcePackage); + context.sendBroadcast(intent); + statusReader.refresh(); + }); } @NonNull @@ -231,16 +211,13 @@ public class VoicemailErrorMessage { String preferenceKeyToUpdate) { return new Action( context.getString(R.string.voicemail_action_dimiss), - new OnClickListener() { - @Override - public void onClick(View v) { - Assert.checkArgument( - VoicemailComponent.get(context) - .getVoicemailClient() - .isVoicemailArchiveAvailable(context)); - sharedPreferenceForAccount.edit().putBoolean(preferenceKeyToUpdate, true).apply(); - statusReader.refresh(); - } - }); + v -> { + Assert.checkArgument( + VoicemailComponent.get(context) + .getVoicemailClient() + .isVoicemailArchiveAvailable(context)); + sharedPreferenceForAccount.edit().putBoolean(preferenceKeyToUpdate, true).apply(); + statusReader.refresh(); + }); } } diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java index 63cee71ea5..1ce09dd3a3 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java @@ -89,29 +89,23 @@ public class VoicemailTosMessageCreator { getNewUserTosMessageText(), new Action( getDeclineText(), - new OnClickListener() { - @Override - public void onClick(View v) { - LogUtil.i("VoicemailTosMessageCreator.getTosMessage", "decline clicked"); - PhoneAccountHandle handle = - new PhoneAccountHandle( - ComponentName.unflattenFromString(status.phoneAccountComponentName), - status.phoneAccountId); - showDeclineTosDialog(handle); - } - }), + v -> { + LogUtil.i("VoicemailTosMessageCreator.getTosMessage", "decline clicked"); + PhoneAccountHandle handle = + new PhoneAccountHandle( + ComponentName.unflattenFromString(status.phoneAccountComponentName), + status.phoneAccountId); + showDeclineTosDialog(handle); + }), new Action( getAcceptText(), - new OnClickListener() { - @Override - public void onClick(View v) { - LogUtil.i("VoicemailTosMessageCreator.getTosMessage", "accept clicked"); - recordTosAcceptance(); - // Accepting the TOS also acknowledges the latest features - recordFeatureAcknowledgement(); - statusReader.refresh(); - } - }, + v -> { + LogUtil.i("VoicemailTosMessageCreator.getTosMessage", "accept clicked"); + recordTosAcceptance(); + // Accepting the TOS also acknowledges the latest features + recordFeatureAcknowledgement(); + statusReader.refresh(); + }, true /* raised */)) .setModal(true) .setImageResourceId(R.drawable.voicemail_tos_image); @@ -174,28 +168,15 @@ public class VoicemailTosMessageCreator { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.terms_and_conditions_decline_dialog_title); builder.setMessage(getTosDeclinedDialogMessageId()); - builder.setPositiveButton( - getTosDeclinedDialogDowngradeId(), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - VoicemailClient voicemailClient = VoicemailComponent.get(context).getVoicemailClient(); - if (voicemailClient.isVoicemailModuleEnabled()) { - voicemailClient.setVoicemailEnabled(context, status.getPhoneAccountHandle(), false); - } else { - TelephonyManagerCompat.setVisualVoicemailEnabled(telephonyManager, handle, false); - } - } - }); - - builder.setNegativeButton( - android.R.string.cancel, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } - }); + builder.setPositiveButton(getTosDeclinedDialogDowngradeId(), (dialog, which) -> { + VoicemailClient voicemailClient = VoicemailComponent.get(context).getVoicemailClient(); + if (voicemailClient.isVoicemailModuleEnabled()) { + voicemailClient.setVoicemailEnabled(context, status.getPhoneAccountHandle(), false); + } else { + TelephonyManagerCompat.setVisualVoicemailEnabled(telephonyManager, handle, false); + } + }); + builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss()); builder.setCancelable(true); builder.show(); @@ -206,23 +187,12 @@ public class VoicemailTosMessageCreator { builder.setMessage(R.string.verizon_terms_and_conditions_decline_set_pin_dialog_message); builder.setPositiveButton( R.string.verizon_terms_and_conditions_decline_set_pin_dialog_set_pin, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Intent intent = new Intent(TelephonyManager.ACTION_CONFIGURE_VOICEMAIL); - intent.putExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); - context.startActivity(intent); - } - }); - - builder.setNegativeButton( - android.R.string.cancel, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } - }); + (dialog, which) -> { + Intent intent = new Intent(TelephonyManager.ACTION_CONFIGURE_VOICEMAIL); + intent.putExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); + context.startActivity(intent); + }); + builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss()); builder.setCancelable(true); builder.show(); diff --git a/java/com/android/dialer/voicemail/listui/error/Vvm3VoicemailMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/Vvm3VoicemailMessageCreator.java index 84bbe6034e..9da10e97f4 100644 --- a/java/com/android/dialer/voicemail/listui/error/Vvm3VoicemailMessageCreator.java +++ b/java/com/android/dialer/voicemail/listui/error/Vvm3VoicemailMessageCreator.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -288,18 +289,15 @@ public class Vvm3VoicemailMessageCreator { private static Action createCallCustomerSupportAction(final Context context) { return new Action( context.getString(R.string.voicemail_action_call_customer_support), - new OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = - new Intent( - Intent.ACTION_CALL, - Uri.parse( - "tel:" - + context.getString( - R.string.verizon_domestic_customer_support_number))); - context.startActivity(intent); - } - }); + v -> { + Intent intent = + new Intent( + Intent.ACTION_CALL, + Uri.parse( + "tel:" + + context.getString( + R.string.verizon_domestic_customer_support_number))); + context.startActivity(intent); + }); } } diff --git a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java index 47d8ee39f0..45c5cc04db 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java @@ -166,12 +166,7 @@ public class VoicemailChangePinActivity extends AppCompatActivity .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); activity.showError( activity.getString(R.string.change_pin_system_error), - new OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - activity.finish(); - } - }); + dialog -> activity.finish()); } else { LogUtil.e(TAG, "invalid default old PIN: " + activity.getChangePinResultMessage(result)); // If the default old PIN is rejected by the server, the PIN is probably changed diff --git a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java index 49d4a6083e..942f3967f2 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java @@ -18,7 +18,6 @@ package com.android.dialer.voicemail.settings; import android.app.AlertDialog; -import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.provider.Settings; @@ -303,26 +302,16 @@ public class VoicemailSettingsFragment extends DialerPreferenceFragment AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(R.string.confirm_disable_voicemail_dialog_title); builder.setMessage(R.string.confirm_disable_voicemail_dialog_message); - builder.setPositiveButton( - R.string.confirm_disable_voicemail_accept_dialog_label, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - LogUtil.i(TAG, "showDisableConfirmationDialog, confirmed"); - updateVoicemailEnabled(false); - dialog.dismiss(); - } - }); - - builder.setNegativeButton( - android.R.string.cancel, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - LogUtil.i(TAG, "showDisableConfirmationDialog, cancelled"); - dialog.dismiss(); - } - }); + builder.setPositiveButton(R.string.confirm_disable_voicemail_accept_dialog_label, + (dialog, which) -> { + LogUtil.i(TAG, "showDisableConfirmationDialog, confirmed"); + updateVoicemailEnabled(false); + dialog.dismiss(); + }); + builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> { + LogUtil.i(TAG, "showDisableConfirmationDialog, cancelled"); + dialog.dismiss(); + }); builder.setCancelable(true); builder.show(); diff --git a/java/com/android/incallui/CallerInfoUtils.java b/java/com/android/incallui/CallerInfoUtils.java index 6f73f2f641..27cb6a8462 100644 --- a/java/com/android/incallui/CallerInfoUtils.java +++ b/java/com/android/incallui/CallerInfoUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,12 +20,10 @@ package com.android.incallui; import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; import android.content.Context; -import android.content.Loader; -import android.content.Loader.OnLoadCompleteListener; import android.net.Uri; import android.telecom.TelecomManager; import android.text.TextUtils; -import com.android.contacts.common.model.Contact; + import com.android.contacts.common.model.ContactLoader; import com.android.dialer.common.LogUtil; import com.android.dialer.phonenumbercache.CachedNumberLookupService; @@ -268,15 +267,11 @@ public class CallerInfoUtils { final ContactLoader loader = new ContactLoader(context, contactUri, true /* postViewNotification */); loader.registerListener( - 0, - new OnLoadCompleteListener() { - @Override - public void onLoadComplete(Loader loader, Contact contact) { - try { - loader.reset(); - } catch (RuntimeException e) { - LogUtil.e("CallerInfoUtils.onLoadComplete", "Error resetting loader", e); - } + 0, (loader1, contact) -> { + try { + loader1.reset(); + } catch (RuntimeException e) { + LogUtil.e("CallerInfoUtils.onLoadComplete", "Error resetting loader", e); } }); loader.startLoading(); diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java index 376034202d..38e8e86f8c 100644 --- a/java/com/android/incallui/ConferenceParticipantListAdapter.java +++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java @@ -65,30 +65,21 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { /** Contact photo manager to retrieve cached contact photo information. */ private final ContactPhotoManager contactPhotoManager; /** Listener used to handle tap of the "disconnect' button for a participant. */ - private View.OnClickListener disconnectListener = - new View.OnClickListener() { - @Override - public void onClick(View view) { - DialerCall call = getCallFromView(view); - LogUtil.i( - "ConferenceParticipantListAdapter.mDisconnectListener.onClick", "call: " + call); - if (call != null) { - call.disconnect(); - } - } - }; + private final View.OnClickListener disconnectListener = view -> { + DialerCall call = getCallFromView(view); + LogUtil.i("ConferenceParticipantListAdapter.mDisconnectListener.onClick", "call: " + call); + if (call != null) { + call.disconnect(); + } + }; /** Listener used to handle tap of the "separate' button for a participant. */ - private View.OnClickListener separateListener = - new View.OnClickListener() { - @Override - public void onClick(View view) { - DialerCall call = getCallFromView(view); - LogUtil.i("ConferenceParticipantListAdapter.mSeparateListener.onClick", "call: " + call); - if (call != null) { - call.splitFromConference(); - } - } - }; + private final View.OnClickListener separateListener = view -> { + DialerCall call = getCallFromView(view); + LogUtil.i("ConferenceParticipantListAdapter.mSeparateListener.onClick", "call: " + call); + if (call != null) { + call.splitFromConference(); + } + }; /** The conference participants to show in the ListView. */ private final List conferenceParticipants = new ArrayList<>(); /** {@code True} if the conference parent supports separating calls from the conference. */ @@ -430,29 +421,24 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { /** Sorts the participant list by contact name. */ private void sortParticipantList() { - Collections.sort( - conferenceParticipants, - new Comparator() { - @Override - public int compare(ParticipantInfo p1, ParticipantInfo p2) { - // Contact names might be null, so replace with empty string. - ContactCacheEntry c1 = p1.getContactCacheEntry(); - String p1Name = - ContactsComponent.get(getContext()) - .contactDisplayPreferences() - .getSortName(c1.namePrimary, c1.nameAlternative); - p1Name = p1Name != null ? p1Name : ""; - - ContactCacheEntry c2 = p2.getContactCacheEntry(); - String p2Name = - ContactsComponent.get(getContext()) - .contactDisplayPreferences() - .getSortName(c2.namePrimary, c2.nameAlternative); - p2Name = p2Name != null ? p2Name : ""; - - return p1Name.compareToIgnoreCase(p2Name); - } - }); + conferenceParticipants.sort((p1, p2) -> { + // Contact names might be null, so replace with empty string. + ContactCacheEntry c1 = p1.getContactCacheEntry(); + String p1Name = + ContactsComponent.get(getContext()) + .contactDisplayPreferences() + .getSortName(c1.namePrimary, c1.nameAlternative); + p1Name = p1Name != null ? p1Name : ""; + + ContactCacheEntry c2 = p2.getContactCacheEntry(); + String p2Name = + ContactsComponent.get(getContext()) + .contactDisplayPreferences() + .getSortName(c2.namePrimary, c2.nameAlternative); + p2Name = p2Name != null ? p2Name : ""; + + return p1Name.compareToIgnoreCase(p2Name); + }); } private DialerCall getCallFromView(View view) { diff --git a/java/com/android/incallui/PostCharDialogFragment.java b/java/com/android/incallui/PostCharDialogFragment.java index 228482d6cb..42e3d346ad 100644 --- a/java/com/android/incallui/PostCharDialogFragment.java +++ b/java/com/android/incallui/PostCharDialogFragment.java @@ -64,20 +64,8 @@ public class PostCharDialogFragment extends DialogFragment { builder.setPositiveButton( R.string.pause_prompt_yes, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int whichButton) { - TelecomAdapter.getInstance().postDialContinue(callId, true); - } - }); - builder.setNegativeButton( - R.string.pause_prompt_no, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int whichButton) { - dialog.cancel(); - } - }); + (dialog, whichButton) -> TelecomAdapter.getInstance().postDialContinue(callId, true)); + builder.setNegativeButton(R.string.pause_prompt_no, (dialog, whichButton) -> dialog.cancel()); final AlertDialog dialog = builder.create(); return dialog; diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java index b0547240d7..3f924538d0 100644 --- a/java/com/android/incallui/VideoCallPresenter.java +++ b/java/com/android/incallui/VideoCallPresenter.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,24 +130,20 @@ public class VideoCallPresenter * enter fullscreen mode if the dialpad is visible (doing so would make it impossible to exit the * dialpad). */ - private Runnable autoFullscreenRunnable = - new Runnable() { - @Override - public void run() { - if (autoFullScreenPending - && !InCallPresenter.getInstance().isDialpadVisible() - && isVideoMode) { - - LogUtil.v("VideoCallPresenter.mAutoFullScreenRunnable", "entering fullscreen mode"); - InCallPresenter.getInstance().setFullScreen(true); - autoFullScreenPending = false; - } else { - LogUtil.v( - "VideoCallPresenter.mAutoFullScreenRunnable", - "skipping scheduled fullscreen mode."); - } - } - }; + private final Runnable autoFullscreenRunnable = () -> { + if (autoFullScreenPending + && !InCallPresenter.getInstance().isDialpadVisible() + && isVideoMode) { + + LogUtil.v("VideoCallPresenter.mAutoFullScreenRunnable", "entering fullscreen mode"); + InCallPresenter.getInstance().setFullScreen(true); + autoFullScreenPending = false; + } else { + LogUtil.v( + "VideoCallPresenter.mAutoFullScreenRunnable", + "skipping scheduled fullscreen mode."); + } + }; private boolean isVideoCallScreenUiReady; diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java index a171b22c56..5f13ba72af 100644 --- a/java/com/android/incallui/answer/impl/AnswerFragment.java +++ b/java/com/android/incallui/answer/impl/AnswerFragment.java @@ -230,14 +230,10 @@ public class AnswerFragment extends Fragment answerAndReleaseButton .animate() .alpha(0) - .withEndAction( - new Runnable() { - @Override - public void run() { - affordanceHolderLayout.reset(false); - secondaryButton.animate().alpha(1); - } - }); + .withEndAction(() -> { + affordanceHolderLayout.reset(false); + secondaryButton.animate().alpha(1); + }); } private final AccessibilityDelegate accessibilityDelegate = @@ -410,13 +406,7 @@ public class AnswerFragment extends Fragment : SecondaryBehavior.REJECT_WITH_SMS; secondaryBehavior.applyToView(secondaryButton); - secondaryButton.setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - performSecondaryButtonAction(); - } - }); + secondaryButton.setOnClickListener(v -> performSecondaryButtonAction()); secondaryButton.setClickable(AccessibilityUtil.isAccessibilityEnabled(getContext())); secondaryButton.setFocusable(AccessibilityUtil.isAccessibilityEnabled(getContext())); secondaryButton.setAccessibilityDelegate(accessibilityDelegate); @@ -441,13 +431,7 @@ public class AnswerFragment extends Fragment answerAndReleaseButton.setVisibility(View.INVISIBLE); answerScreenDelegate.onAnswerAndReleaseButtonDisabled(); } - answerAndReleaseButton.setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - performAnswerAndReleaseButtonAction(); - } - }); + answerAndReleaseButton.setOnClickListener(v -> performAnswerAndReleaseButtonAction()); } /** Initialize chip buttons */ @@ -684,18 +668,14 @@ public class AnswerFragment extends Fragment importanceBadge = view.findViewById(R.id.incall_important_call_badge); importanceBadge .getViewTreeObserver() - .addOnGlobalLayoutListener( - new OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - int leftRightPadding = importanceBadge.getHeight() / 2; - importanceBadge.setPadding( - leftRightPadding, - importanceBadge.getPaddingTop(), - leftRightPadding, - importanceBadge.getPaddingBottom()); - } - }); + .addOnGlobalLayoutListener(() -> { + int leftRightPadding = importanceBadge.getHeight() / 2; + importanceBadge.setPadding( + leftRightPadding, + importanceBadge.getPaddingTop(), + leftRightPadding, + importanceBadge.getPaddingBottom()); + }); updateImportanceBadgeVisibility(); contactGridManager = new ContactGridManager(view, null, 0, false /* showAnonymousAvatar */); @@ -988,14 +968,10 @@ public class AnswerFragment extends Fragment secondaryButton .animate() .alpha(0) - .withEndAction( - new Runnable() { - @Override - public void run() { - affordanceHolderLayout.reset(false); - secondaryButton.animate().alpha(1); - } - }); + .withEndAction(() -> { + affordanceHolderLayout.reset(false); + secondaryButton.animate().alpha(1); + }); TelecomUtil.silenceRinger(getContext()); } diff --git a/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java b/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java index b6a192be2d..d14d59ff9c 100644 --- a/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java +++ b/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java @@ -20,7 +20,6 @@ package com.android.incallui.answer.impl; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnShowListener; import android.os.Bundle; import android.text.Editable; @@ -69,43 +68,21 @@ public class CreateCustomSmsDialogFragment extends AppCompatDialogFragment { builder .setCancelable(true) .setView(view) - .setPositiveButton( - R.string.call_incoming_custom_message_send, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - FragmentUtils.getParentUnsafe( - CreateCustomSmsDialogFragment.this, CreateCustomSmsHolder.class) + .setPositiveButton(R.string.call_incoming_custom_message_send, (dialogInterface, i) -> { + FragmentUtils.getParentUnsafe( + CreateCustomSmsDialogFragment.this, CreateCustomSmsHolder.class) .customSmsCreated(editText.getText().toString().trim()); - dismiss(); - } - }) - .setNegativeButton( - R.string.call_incoming_custom_message_cancel, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - dismiss(); - } - }) - .setOnCancelListener( - new OnCancelListener() { - @Override - public void onCancel(DialogInterface dialogInterface) { - dismiss(); - } - }) + dismiss(); + }) + .setNegativeButton(R.string.call_incoming_custom_message_cancel, + (dialogInterface, i) -> dismiss()) + .setOnCancelListener(dialogInterface -> dismiss()) .setTitle(R.string.call_incoming_respond_via_sms_custom_message); final AlertDialog customMessagePopup = builder.create(); customMessagePopup.setOnShowListener( - new OnShowListener() { - @Override - public void onShow(DialogInterface dialogInterface) { - ((AlertDialog) dialogInterface) - .getButton(AlertDialog.BUTTON_POSITIVE) - .setEnabled(false); - } - }); + dialogInterface -> ((AlertDialog) dialogInterface) + .getButton(AlertDialog.BUTTON_POSITIVE) + .setEnabled(false)); editText.addTextChangedListener( new TextWatcher() { diff --git a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java index d3f0ca124c..d8b5ba4883 100644 --- a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java +++ b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java @@ -26,7 +26,6 @@ import android.os.Bundle; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; -import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; @@ -116,14 +115,11 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment { textView.setLayoutParams(params); textView.setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - FragmentUtils.getParentUnsafe(SmsBottomSheetFragment.this, SmsSheetHolder.class) - .smsSelected(text); - dismiss(); - } - }); + v -> { + FragmentUtils.getParentUnsafe(SmsBottomSheetFragment.this, SmsSheetHolder.class) + .smsSelected(text); + dismiss(); + }); return textView; } diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java index 32711622d0..5895f9c815 100644 --- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java +++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java @@ -340,16 +340,13 @@ public class SwipeButtonHelper { } ValueAnimator animator = ValueAnimator.ofFloat(targetView.getCircleRadius(), radius); animator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - float newRadius = (float) animation.getAnimatedValue(); - targetView.setCircleRadiusWithoutAnimation(newRadius); - float translation = getTranslationFromRadius(newRadius); - SwipeButtonHelper.this.translation = right ? -translation : translation; - updateIconsFromTranslation(targetView); - } - }); + animation -> { + float newRadius = (float) animation.getAnimatedValue(); + targetView.setCircleRadiusWithoutAnimation(newRadius); + float translation = getTranslationFromRadius(newRadius); + SwipeButtonHelper.this.translation = right ? -translation : translation; + updateIconsFromTranslation(targetView); + }); return animator; } @@ -388,13 +385,7 @@ public class SwipeButtonHelper { ValueAnimator animator = ValueAnimator.ofFloat(translation, target); flingAnimationUtils.apply(animator, translation, target, vel); - animator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - translation = (float) animation.getAnimatedValue(); - } - }); + animator.addUpdateListener(animation -> translation = (float) animation.getAnimatedValue()); animator.addListener(flingEndListener); if (!snapBack) { startFinishingCircleAnimation(vel * 0.375f, new AnimationEndRunnable(right), right); diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java index a875723849..133e7148d6 100644 --- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java +++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java @@ -336,15 +336,11 @@ public class SwipeButtonView extends ImageView { circleAnimator = animator; circleStartValue = this.circleRadius; circleWillBeHidden = circleRadius == 0.0f; - animator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - SwipeButtonView.this.circleRadius = (float) animation.getAnimatedValue(); - updateIconColor(); - invalidate(); - } - }); + animator.addUpdateListener(animation -> { + SwipeButtonView.this.circleRadius = (float) animation.getAnimatedValue(); + updateIconColor(); + invalidate(); + }); animator.addListener(circleEndListener); return animator; } @@ -377,14 +373,10 @@ public class SwipeButtonView extends ImageView { } else { ValueAnimator animator = ValueAnimator.ofFloat(tmageScale, imageScale); scaleAnimator = animator; - animator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - tmageScale = (float) animation.getAnimatedValue(); - invalidate(); - } - }); + animator.addUpdateListener(animation -> { + tmageScale = (float) animation.getAnimatedValue(); + invalidate(); + }); animator.addListener(scaleEndListener); if (interpolator == null) { interpolator = @@ -446,17 +438,13 @@ public class SwipeButtonView extends ImageView { int currentAlpha = getImageAlpha(); ValueAnimator animator = ValueAnimator.ofInt(currentAlpha, endAlpha); alphaAnimator = animator; - animator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - int alpha = (int) animation.getAnimatedValue(); - if (background != null) { - background.mutate().setAlpha(alpha); - } - setImageAlpha(alpha); - } - }); + animator.addUpdateListener(animation -> { + int alpha1 = (int) animation.getAnimatedValue(); + if (background != null) { + background.mutate().setAlpha(alpha1); + } + setImageAlpha(alpha1); + }); animator.addListener(alphaEndListener); if (interpolator == null) { interpolator = diff --git a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java index f42e6bdf6c..afaf799118 100644 --- a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java +++ b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java @@ -425,13 +425,8 @@ class FlingUpDownTouchHandler implements OnTouchListener { private ValueAnimator createProgressAnimator(float targetProgress) { ValueAnimator animator = ValueAnimator.ofFloat(currentProgress, targetProgress); - animator.addUpdateListener( - new AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - setCurrentProgress((Float) animation.getAnimatedValue()); - } - }); + animator.addUpdateListener(animation -> + setCurrentProgress((Float) animation.getAnimatedValue())); return animator; } diff --git a/java/com/android/incallui/incall/impl/MappedButtonConfig.java b/java/com/android/incallui/incall/impl/MappedButtonConfig.java index 0d7e273cd1..f313b00daa 100644 --- a/java/com/android/incallui/incall/impl/MappedButtonConfig.java +++ b/java/com/android/incallui/incall/impl/MappedButtonConfig.java @@ -112,16 +112,13 @@ final class MappedButtonConfig { */ @NonNull public Comparator getSlotComparator() { - return new Comparator() { - @Override - public int compare(Integer lhs, Integer rhs) { - MappingInfo lhsInfo = lookupMappingInfo(lhs); - MappingInfo rhsInfo = lookupMappingInfo(rhs); - if (lhsInfo.getSlot() != rhsInfo.getSlot()) { - throw new IllegalArgumentException("lhs and rhs don't go in the same slot"); - } - return lhsInfo.getSlotOrder() - rhsInfo.getSlotOrder(); + return (lhs, rhs) -> { + MappingInfo lhsInfo = lookupMappingInfo(lhs); + MappingInfo rhsInfo = lookupMappingInfo(rhs); + if (lhsInfo.getSlot() != rhsInfo.getSlot()) { + throw new IllegalArgumentException("lhs and rhs don't go in the same slot"); } + return lhsInfo.getSlotOrder() - rhsInfo.getSlotOrder(); }; } @@ -136,13 +133,10 @@ final class MappedButtonConfig { */ @NonNull public Comparator getConflictComparator() { - return new Comparator() { - @Override - public int compare(Integer lhs, Integer rhs) { - MappingInfo lhsInfo = lookupMappingInfo(lhs); - MappingInfo rhsInfo = lookupMappingInfo(rhs); - return lhsInfo.getConflictOrder() - rhsInfo.getConflictOrder(); - } + return (lhs, rhs) -> { + MappingInfo lhsInfo = lookupMappingInfo(lhs); + MappingInfo rhsInfo = lookupMappingInfo(rhs); + return lhsInfo.getConflictOrder() - rhsInfo.getConflictOrder(); }; } diff --git a/java/com/android/incallui/ringtone/InCallTonePlayer.java b/java/com/android/incallui/ringtone/InCallTonePlayer.java index 7261d1ef7d..3f7d81a025 100644 --- a/java/com/android/incallui/ringtone/InCallTonePlayer.java +++ b/java/com/android/incallui/ringtone/InCallTonePlayer.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +25,7 @@ import androidx.annotation.Nullable; import com.android.incallui.Log; import com.android.incallui.async.PausableExecutor; + import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -76,13 +78,7 @@ public class InCallTonePlayer { } final ToneGeneratorInfo info = getToneGeneratorInfo(tone); numPlayingTones = new CountDownLatch(1); - executor.execute( - new Runnable() { - @Override - public void run() { - playOnBackgroundThread(info); - } - }); + executor.execute(() -> playOnBackgroundThread(info)); } private ToneGeneratorInfo getToneGeneratorInfo(int tone) { diff --git a/java/com/android/incallui/rtt/impl/AudioSelectMenu.java b/java/com/android/incallui/rtt/impl/AudioSelectMenu.java index 1c83637ea3..b9cd358f81 100644 --- a/java/com/android/incallui/rtt/impl/AudioSelectMenu.java +++ b/java/com/android/incallui/rtt/impl/AudioSelectMenu.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,10 +72,7 @@ public class AudioSelectMenu extends PopupWindow { } else if (audioState.getRoute() == itemRoute) { item.setChecked(true); } - item.setOnClickListener( - (v) -> { - inCallButtonUiDelegate.setAudioRoute(itemRoute); - }); + item.setOnClickListener(v -> inCallButtonUiDelegate.setAudioRoute(itemRoute)); } void setAudioState(CallAudioState audioState) { diff --git a/java/com/android/incallui/spam/SpamCallListListener.java b/java/com/android/incallui/spam/SpamCallListListener.java index 96eac1ba39..cc05509cb0 100644 --- a/java/com/android/incallui/spam/SpamCallListListener.java +++ b/java/com/android/incallui/spam/SpamCallListListener.java @@ -27,7 +27,6 @@ import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.android.dialer.R; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutor.Worker; @@ -117,7 +116,7 @@ public class SpamCallListListener implements CallList.Listener { new NumberInCallHistoryWorker(context, number, call.getCountryIso()); dialerExecutorFactory .createNonUiTaskBuilder(historyTask) - .onSuccess((result) -> call.setCallHistoryStatus(result)) + .onSuccess(call::setCallHistoryStatus) .build() .executeParallel(null); } diff --git a/java/com/android/incallui/spam/SpamNotificationActivity.java b/java/com/android/incallui/spam/SpamNotificationActivity.java index ca561e2667..63b0235981 100644 --- a/java/com/android/incallui/spam/SpamNotificationActivity.java +++ b/java/com/android/incallui/spam/SpamNotificationActivity.java @@ -297,32 +297,22 @@ public class SpamNotificationActivity extends FragmentActivity { .setTitle(getString(R.string.spam_notification_title, getFormattedNumber(number, applicationContext))) .setNeutralButton(getString(R.string.spam_notification_action_dismiss), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismiss(); - } - }) + (dialog, which) -> dismiss()) .setPositiveButton(getString(R.string.spam_notification_block_spam_action_text), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismissed = true; - dismiss(); - spamNotificationActivity.maybeShowBlockReportSpamDialog( - number, contactLookupResultType); - spamNotificationActivity.maybeShowSpamBlockingPromoAndFinish(); - } - }) + (dialog, which) -> { + dismissed = true; + dismiss(); + spamNotificationActivity.maybeShowBlockReportSpamDialog( + number, contactLookupResultType); + spamNotificationActivity.maybeShowSpamBlockingPromoAndFinish(); + }) .setNegativeButton(getString(R.string.spam_notification_was_not_spam_action_text), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismissed = true; - dismiss(); - spamNotificationActivity.maybeShowNotSpamDialog(number, contactLookupResultType); - } - }) + (dialog, which) -> { + dismissed = true; + dismiss(); + spamNotificationActivity.maybeShowNotSpamDialog(number, + contactLookupResultType); + }) .create(); } } @@ -379,34 +369,23 @@ public class SpamNotificationActivity extends FragmentActivity { .setMessage(getString(R.string.spam_notification_non_spam_call_expanded_text)) .setNeutralButton( getString(R.string.spam_notification_action_dismiss), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismiss(); - } - }) + (dialog, which) -> dismiss()) .setPositiveButton( getString(R.string.spam_notification_dialog_add_contact_action_text), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismissed = true; - dismiss(); - startActivity(createInsertContactsIntent(number)); - } - }) + (dialog, which) -> { + dismissed = true; + dismiss(); + startActivity(createInsertContactsIntent(number)); + }) .setNegativeButton( getString(R.string.spam_notification_dialog_block_report_spam_action_text), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismissed = true; - dismiss(); - spamNotificationActivity.maybeShowBlockReportSpamDialog( - number, contactLookupResultType); - spamNotificationActivity.maybeShowSpamBlockingPromoAndFinish(); - } - }) + (dialog, which) -> { + dismissed = true; + dismiss(); + spamNotificationActivity.maybeShowBlockReportSpamDialog( + number, contactLookupResultType); + spamNotificationActivity.maybeShowSpamBlockingPromoAndFinish(); + }) .create(); } } diff --git a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java index d554a5823a..0b12594d77 100644 --- a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java +++ b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java @@ -209,13 +209,7 @@ public class SurfaceViewVideoCallFragment extends Fragment endCallButton.setOnClickListener(this); previewSurfaceView = (SurfaceView) view.findViewById(R.id.videocall_video_preview); previewSurfaceView.setZOrderMediaOverlay(true); - previewOffOverlay.setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - checkCameraPermission(); - } - }); + previewOffOverlay.setOnClickListener(v -> checkCameraPermission()); remoteSurfaceView = (SurfaceView) view.findViewById(R.id.videocall_video_remote); remoteSurfaceView.setOnClickListener( surfaceView -> { @@ -369,13 +363,7 @@ public class SurfaceViewVideoCallFragment extends Fragment .translationY(0) .setInterpolator(linearOutSlowInInterpolator) .alpha(1) - .withStartAction( - new Runnable() { - @Override - public void run() { - switchOnHoldCallController.setOnScreen(); - } - }); + .withStartAction(() -> switchOnHoldCallController.setOnScreen()); View contactGridView = contactGridManager.getContainerView(); // Animate contact grid to the shown state. @@ -385,13 +373,7 @@ public class SurfaceViewVideoCallFragment extends Fragment .translationY(0) .setInterpolator(linearOutSlowInInterpolator) .alpha(1) - .withStartAction( - new Runnable() { - @Override - public void run() { - contactGridManager.show(); - } - }); + .withStartAction(() -> contactGridManager.show()); endCallButton .animate() @@ -399,13 +381,7 @@ public class SurfaceViewVideoCallFragment extends Fragment .translationY(0) .setInterpolator(linearOutSlowInInterpolator) .alpha(1) - .withStartAction( - new Runnable() { - @Override - public void run() { - endCallButton.setVisibility(View.VISIBLE); - } - }) + .withStartAction(() -> endCallButton.setVisibility(View.VISIBLE)) .start(); // Animate all the preview controls up to make room for the navigation bar. @@ -564,13 +540,7 @@ public class SurfaceViewVideoCallFragment extends Fragment .translationY(offset.y) .setInterpolator(fastOutLinearInInterpolator) .alpha(0) - .withEndAction( - new Runnable() { - @Override - public void run() { - endCallButton.setVisibility(View.INVISIBLE); - } - }) + .withEndAction(() -> endCallButton.setVisibility(View.INVISIBLE)) .setInterpolator(new FastOutLinearInInterpolator()) .start(); @@ -971,13 +941,7 @@ public class SurfaceViewVideoCallFragment extends Fragment wasRemoteVideoOff ? R.string.videocall_remote_video_on : R.string.videocall_remotely_resumed); - remoteVideoOff.postDelayed( - new Runnable() { - @Override - public void run() { - remoteVideoOff.setVisibility(View.GONE); - } - }, + remoteVideoOff.postDelayed(() -> remoteVideoOff.setVisibility(View.GONE), VIDEO_OFF_VIEW_FADE_OUT_DELAY_IN_MILLIS); } else { remoteVideoOff.setText( @@ -1033,13 +997,7 @@ public class SurfaceViewVideoCallFragment extends Fragment view.setVisibility(View.VISIBLE); view.animate() .alpha(endAlpha) - .withEndAction( - new Runnable() { - @Override - public void run() { - view.setVisibility(visibility); - } - }) + .withEndAction(() -> view.setVisibility(visibility)) .start(); } diff --git a/java/com/android/incallui/video/impl/VideoCallFragment.java b/java/com/android/incallui/video/impl/VideoCallFragment.java index efb98e0bf8..5408af2433 100644 --- a/java/com/android/incallui/video/impl/VideoCallFragment.java +++ b/java/com/android/incallui/video/impl/VideoCallFragment.java @@ -260,54 +260,24 @@ public class VideoCallFragment extends Fragment endCallButton.setOnClickListener(this); previewTextureView = (TextureView) view.findViewById(R.id.videocall_video_preview); previewTextureView.setClipToOutline(true); - previewOffOverlay.setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - checkCameraPermission(); - } - }); + previewOffOverlay.setOnClickListener(v -> checkCameraPermission()); remoteTextureView = (TextureView) view.findViewById(R.id.videocall_video_remote); greenScreenBackgroundView = view.findViewById(R.id.videocall_green_screen_background); fullscreenBackgroundView = view.findViewById(R.id.videocall_fullscreen_background); remoteTextureView.addOnLayoutChangeListener( - new OnLayoutChangeListener() { - @Override - public void onLayoutChange( - View v, - int left, - int top, - int right, - int bottom, - int oldLeft, - int oldTop, - int oldRight, - int oldBottom) { - LogUtil.i("VideoCallFragment.onLayoutChange", "remoteTextureView layout changed"); - updateRemoteVideoScaling(); - updateRemoteOffView(); - } - }); + (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { + LogUtil.i("VideoCallFragment.onLayoutChange", "remoteTextureView layout changed"); + updateRemoteVideoScaling(); + updateRemoteOffView(); + }); previewTextureView.addOnLayoutChangeListener( - new OnLayoutChangeListener() { - @Override - public void onLayoutChange( - View v, - int left, - int top, - int right, - int bottom, - int oldLeft, - int oldTop, - int oldRight, - int oldBottom) { - LogUtil.i("VideoCallFragment.onLayoutChange", "previewTextureView layout changed"); - updatePreviewVideoScaling(); - updatePreviewOffView(); - } - }); + (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { + LogUtil.i("VideoCallFragment.onLayoutChange", "previewTextureView layout changed"); + updatePreviewVideoScaling(); + updatePreviewOffView(); + }); controls.addOnLayoutChangeListener( new OnLayoutChangeListener() { @@ -452,13 +422,7 @@ public class VideoCallFragment extends Fragment .translationY(0) .setInterpolator(linearOutSlowInInterpolator) .alpha(1) - .withStartAction( - new Runnable() { - @Override - public void run() { - controls.setVisibility(View.VISIBLE); - } - }) + .withStartAction(() -> controls.setVisibility(View.VISIBLE)) .start(); // Animate onHold to the shown state. @@ -468,13 +432,7 @@ public class VideoCallFragment extends Fragment .translationY(0) .setInterpolator(linearOutSlowInInterpolator) .alpha(1) - .withStartAction( - new Runnable() { - @Override - public void run() { - switchOnHoldCallController.setOnScreen(); - } - }); + .withStartAction(() -> switchOnHoldCallController.setOnScreen()); View contactGridView = contactGridManager.getContainerView(); // Animate contact grid to the shown state. @@ -484,13 +442,7 @@ public class VideoCallFragment extends Fragment .translationY(0) .setInterpolator(linearOutSlowInInterpolator) .alpha(1) - .withStartAction( - new Runnable() { - @Override - public void run() { - contactGridManager.show(); - } - }); + .withStartAction(() -> contactGridManager.show()); endCallButton .animate() @@ -498,13 +450,7 @@ public class VideoCallFragment extends Fragment .translationY(0) .setInterpolator(linearOutSlowInInterpolator) .alpha(1) - .withStartAction( - new Runnable() { - @Override - public void run() { - endCallButton.setVisibility(View.VISIBLE); - } - }) + .withStartAction(() -> endCallButton.setVisibility(View.VISIBLE)) .start(); // Animate all the preview controls up to make room for the navigation bar. @@ -665,13 +611,7 @@ public class VideoCallFragment extends Fragment .translationY(offset.y) .setInterpolator(fastOutLinearInInterpolator) .alpha(0) - .withEndAction( - new Runnable() { - @Override - public void run() { - endCallButton.setVisibility(View.INVISIBLE); - } - }) + .withEndAction(() -> endCallButton.setVisibility(View.INVISIBLE)) .setInterpolator(new FastOutLinearInInterpolator()) .start(); @@ -1180,13 +1120,7 @@ public class VideoCallFragment extends Fragment wasRemoteVideoOff ? R.string.videocall_remote_video_on : R.string.videocall_remotely_resumed); - remoteVideoOff.postDelayed( - new Runnable() { - @Override - public void run() { - remoteVideoOff.setVisibility(View.GONE); - } - }, + remoteVideoOff.postDelayed(() -> remoteVideoOff.setVisibility(View.GONE), VIDEO_OFF_VIEW_FADE_OUT_DELAY_IN_MILLIS); } else { remoteVideoOff.setText( @@ -1304,13 +1238,7 @@ public class VideoCallFragment extends Fragment view.setVisibility(View.VISIBLE); view.animate() .alpha(endAlpha) - .withEndAction( - new Runnable() { - @Override - public void run() { - view.setVisibility(visibility); - } - }) + .withEndAction(() -> view.setVisibility(visibility)) .start(); } diff --git a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java index b456f54537..4b8f7628fd 100644 --- a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java +++ b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -193,38 +194,34 @@ public class FetchVoicemailReceiver extends BroadcastReceiver { private void fetchVoicemail(final Network network, final VoicemailStatus.Editor status) { Executor executor = Executors.newCachedThreadPool(); - executor.execute( - new Runnable() { - @Override - public void run() { - if (networkCallback != null) { - networkCallback.waitForIpv4(); - } - try { - while (retryCount > 0) { - VvmLog.i(TAG, "fetching voicemail, retry count=" + retryCount); - try (ImapHelper imapHelper = - new ImapHelper(context, phoneAccount, network, status)) { - boolean success = - imapHelper.fetchVoicemailPayload( - new VoicemailFetchedCallback(context, uri, phoneAccount), uid); - if (!success && retryCount > 0) { - VvmLog.i(TAG, "fetch voicemail failed, retrying"); - retryCount--; - } else { - return; - } - } catch (InitializingException e) { - VvmLog.w(TAG, "Can't retrieve Imap credentials ", e); - return; - } - } - } finally { - if (networkCallback != null) { - networkCallback.releaseNetwork(); - } + executor.execute(() -> { + if (networkCallback != null) { + networkCallback.waitForIpv4(); + } + try { + while (retryCount > 0) { + VvmLog.i(TAG, "fetching voicemail, retry count=" + retryCount); + try (ImapHelper imapHelper = + new ImapHelper(context, phoneAccount, network, status)) { + boolean success = + imapHelper.fetchVoicemailPayload( + new VoicemailFetchedCallback(context, uri, phoneAccount), uid); + if (!success && retryCount > 0) { + VvmLog.i(TAG, "fetch voicemail failed, retrying"); + retryCount--; + } else { + return; } + } catch (InitializingException e) { + VvmLog.w(TAG, "Can't retrieve Imap credentials ", e); + return; } - }); + } + } finally { + if (networkCallback != null) { + networkCallback.releaseNetwork(); + } + } + }); } } diff --git a/java/com/android/voicemail/impl/scheduling/TaskExecutor.java b/java/com/android/voicemail/impl/scheduling/TaskExecutor.java index 396852556b..e7b383397b 100644 --- a/java/com/android/voicemail/impl/scheduling/TaskExecutor.java +++ b/java/com/android/voicemail/impl/scheduling/TaskExecutor.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -131,19 +132,14 @@ final class TaskExecutor { private Job job; - private final Runnable stopServiceWithDelay = - new Runnable() { - @MainThread - @Override - public void run() { - VvmLog.i(TAG, "Stopping service"); - if (!isJobRunning() || isTerminating()) { - VvmLog.e(TAG, "Service already stopped"); - return; - } - scheduleJobAndTerminate(0, true); - } - }; + private final Runnable stopServiceWithDelay = () -> { + VvmLog.i(TAG, "Stopping service"); + if (!isJobRunning() || isTerminating()) { + VvmLog.e(TAG, "Service already stopped"); + return; + } + scheduleJobAndTerminate(0, true); + }; /** * Reschedule the {@link TaskSchedulerJobService} and terminate the executor when the {@link Job} @@ -179,7 +175,7 @@ final class TaskExecutor { VvmLog.w("JobFinishedPoller.run", "Job still running"); mainThreadHandler.postDelayed(this, TERMINATE_POLLING_INTERVAL_MILLISECONDS); } - }; + } /** Handles execution of the background task in teh worker thread. */ final class WorkerThreadHandler extends Handler { @@ -317,14 +313,7 @@ final class TaskExecutor { private void sleep(long timeMillis) { VvmLog.i(TAG, "sleep for " + timeMillis + " millis"); if (timeMillis < SHORT_SLEEP_THRESHOLD_MILLISECONDS) { - mainThreadHandler.postDelayed( - new Runnable() { - @Override - public void run() { - maybeRunNextTask(); - } - }, - timeMillis); + mainThreadHandler.postDelayed(() -> maybeRunNextTask(), timeMillis); return; } scheduleJobAndTerminate(timeMillis, false); diff --git a/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java b/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java index 1fdf917b09..b57da66527 100644 --- a/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java +++ b/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java @@ -164,15 +164,11 @@ public abstract class VvmNetworkRequestCallback extends ConnectivityManager.Netw */ Handler handler = new Handler(Looper.getMainLooper()); handler.postDelayed( - new Runnable() { - @Override - public void run() { - if (resultReceived == false) { - onFailed(NETWORK_REQUEST_FAILED_TIMEOUT); - } - } - }, - NETWORK_REQUEST_TIMEOUT_MILLIS); + () -> { + if (!resultReceived) { + onFailed(NETWORK_REQUEST_FAILED_TIMEOUT); + }}, + NETWORK_REQUEST_TIMEOUT_MILLIS); } public void releaseNetwork() { -- GitLab From b8c1d4b576a40dd81c853132a81b3a5fe00a42e9 Mon Sep 17 00:00:00 2001 From: Michael W Date: Sat, 21 Oct 2023 22:48:52 +0200 Subject: [PATCH 07/36] Dialer: Replace deprecated stuff * getParcelable[...](String) is deprecated in favor of getParcelable[...](String, Class) * resolveActivity(), getPackageInfo(), resolveContentProvider() and getApplicationInfo() all now have a new prototype to pass flags * Handler() is deprecated in favor of Handler(Looper) * KeyguardManager.inKeyguardRestrictedInputMode() -> KeyguardManager.isKeyguardLocked() * MediaRecorder() -> MediaRecorder(Context) * getPhoneCount() -> getActiveModemCount() * Airplane mode flag has been moved to Settings.Global * Imei and Meid have functions to read, getDeviceId() is deprecated * LocationManager.requestSingleUpdate() should be getCurrentLocation() * Html.fromHtml(String) should provide the mode * Cursors shouldn't requery or deactivate * AVAILABLE_PHONE_ACCOUNTS -> EXTRA_SUGGESTED_PHONE_ACCOUNTS Change-Id: Ie089e9e25a3930af43435515a85ac1d241a01b01 --- .../common/dialog/CallSubjectDialog.java | 7 +- .../common/model/AccountTypeManager.java | 4 +- .../contacts/common/model/RawContact.java | 7 +- .../model/account/ExternalAccountType.java | 40 ++++++------ .../SelectPhoneAccountDialogFragment.java | 5 +- .../SelectPhoneAccountDialogOptionsUtil.java | 3 +- .../dialer/app/AccountSelectionActivity.java | 3 +- .../dialer/app/calllog/CallLogFragment.java | 2 +- .../calllog/CallLogNotificationsService.java | 4 +- .../app/calllog/GroupingListAdapter.java | 3 +- .../app/calllog/LegacyVoicemailNotifier.java | 2 +- .../VisualVoicemailCallLogFragment.java | 2 +- .../app/contactinfo/ContactInfoCache.java | 3 + .../app/settings/SoundSettingsFragment.java | 2 +- .../LegacyVoicemailNotificationReceiver.java | 9 ++- .../app/voicemail/VoicemailErrorManager.java | 4 +- .../android/dialer/callintent/CallIntent.java | 5 +- .../dialer/callintent/CallIntentBuilder.java | 5 +- .../callrecord/impl/CallRecorderService.java | 2 +- .../callstats/CallStatsDetailActivity.java | 4 +- .../dialer/callstats/CallStatsFragment.java | 4 +- .../android/dialer/common/PackageUtils.java | 6 +- .../telephony/TelephonyManagerCompat.java | 2 +- .../contactphoto/ContactPhotoManagerImpl.java | 3 +- .../dialer/dialpadview/DialpadFragment.java | 9 ++- .../dialpadview/PseudoEmergencyAnimator.java | 3 +- .../dialpadview/SpecialCharSequenceMgr.java | 12 ++-- .../interactions/PhoneNumberInteraction.java | 2 +- .../dialer/location/CountryDetector.java | 2 +- .../android/dialer/lookup/LookupProvider.java | 42 ++---------- .../android/dialer/lookup/LookupUtils.java | 3 +- .../dialer/lookup/ReverseLookupService.java | 4 +- .../dialer/main/impl/OldMainActivityPeer.java | 3 +- .../notification/VoicemailChannelUtils.java | 2 +- .../dialer/oem/CequintPackageUtils.java | 9 ++- .../oem/MotorolaHiddenMenuKeySequence.java | 4 +- .../cequint/CequintPhoneLookup.java | 2 +- .../dialer/postcall/PostCallActivity.java | 2 +- .../LaunchPreCallActivity.java | 9 ++- .../precall/impl/CallingAccountSelector.java | 11 ++-- .../precall/impl/PermissionCheckAction.java | 5 +- .../precall/impl/PreCallCoordinatorImpl.java | 8 ++- .../impl/PreferredAccountWorkerImpl.java | 8 +-- .../cp2/ContactFilterCursor.java | 4 +- .../dialer/shortcuts/CallContactActivity.java | 2 +- .../simulator/impl/SimulatorConnection.java | 3 +- .../simulator/impl/SimulatorRemoteVideo.java | 4 +- .../android/dialer/telecom/TelecomUtil.java | 56 +++++----------- java/com/android/dialer/util/DialerUtils.java | 8 ++- .../android/dialer/util/PermissionsUtil.java | 4 ++ .../settings/VoicemailChangePinActivity.java | 5 +- .../incallui/AccelerometerListener.java | 46 ++++++------- .../android/incallui/CallCardPresenter.java | 8 ++- .../incallui/ExternalCallNotifier.java | 6 +- java/com/android/incallui/InCallActivity.java | 14 +++- .../com/android/incallui/InCallPresenter.java | 65 +++++++++---------- .../incallui/InCallVibrationHandler.java | 9 ++- .../android/incallui/StatusBarNotifier.java | 10 +-- .../android/incallui/VideoCallPresenter.java | 5 +- .../SystemProximityWakeLock.java | 3 +- .../AudioRouteSelectorDialogFragment.java | 2 +- java/com/android/incallui/call/CallList.java | 31 ++++----- .../com/android/incallui/call/DialerCall.java | 8 ++- .../callpending/CallPendingActivity.java | 2 +- .../android/incallui/hold/OnHoldFragment.java | 5 +- .../incallui/incall/impl/InCallFragment.java | 10 ++- .../sessiondata/MultimediaFragment.java | 4 +- .../video/impl/VideoCallFragment.java | 11 ++-- .../videotech/ims/ImsVideoCallCallback.java | 4 +- .../incallui/videotech/ims/ImsVideoTech.java | 5 +- .../voicemail/impl/ActivationTask.java | 2 +- .../impl/DeviceProvisionedJobService.java | 3 +- .../impl/OmtpVvmCarrierConfigHelper.java | 4 +- .../voicemail/impl/imap/ImapHelper.java | 8 +-- .../voicemail/impl/scheduling/BaseTask.java | 3 +- .../impl/sms/OmtpMessageReceiver.java | 6 +- .../voicemail/impl/sync/SyncOneTask.java | 5 +- .../android/voicemail/impl/sync/SyncTask.java | 3 +- 78 files changed, 341 insertions(+), 298 deletions(-) diff --git a/java/com/android/contacts/common/dialog/CallSubjectDialog.java b/java/com/android/contacts/common/dialog/CallSubjectDialog.java index 1e1ee0d56b..3ddf4da0d2 100644 --- a/java/com/android/contacts/common/dialog/CallSubjectDialog.java +++ b/java/com/android/contacts/common/dialog/CallSubjectDialog.java @@ -329,14 +329,15 @@ public class CallSubjectDialog extends AppCompatActivity { return; } mPhotoID = arguments.getLong(ARG_PHOTO_ID); - mPhotoUri = arguments.getParcelable(ARG_PHOTO_URI); - mContactUri = arguments.getParcelable(ARG_CONTACT_URI); + mPhotoUri = arguments.getParcelable(ARG_PHOTO_URI, Uri.class); + mContactUri = arguments.getParcelable(ARG_CONTACT_URI, Uri.class); mNameOrNumber = arguments.getString(ARG_NAME_OR_NUMBER); mNumber = arguments.getString(ARG_NUMBER); mDisplayNumber = arguments.getString(ARG_DISPLAY_NUMBER); mNumberLabel = arguments.getString(ARG_NUMBER_LABEL); mContactType = arguments.getInt(ARG_CONTACT_TYPE, LetterTileDrawable.TYPE_DEFAULT); - mPhoneAccountHandle = arguments.getParcelable(ARG_PHONE_ACCOUNT_HANDLE); + mPhoneAccountHandle = arguments.getParcelable(ARG_PHONE_ACCOUNT_HANDLE, + PhoneAccountHandle.class); } /** diff --git a/java/com/android/contacts/common/model/AccountTypeManager.java b/java/com/android/contacts/common/model/AccountTypeManager.java index 070c9a7e37..283863eede 100644 --- a/java/com/android/contacts/common/model/AccountTypeManager.java +++ b/java/com/android/contacts/common/model/AccountTypeManager.java @@ -696,8 +696,8 @@ class AccountTypeManagerImpl extends AccountTypeManager result.remove(accountTypeWithDataSet); continue; } - ResolveInfo resolveInfo = - packageManager.resolveActivity(invitableIntent, PackageManager.MATCH_DEFAULT_ONLY); + ResolveInfo resolveInfo = packageManager.resolveActivity(invitableIntent, + PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY)); if (resolveInfo == null) { // If we can't find an activity to start for this intent, then there's no point in // showing this option to the user. diff --git a/java/com/android/contacts/common/model/RawContact.java b/java/com/android/contacts/common/model/RawContact.java index 9efc8a8785..37c5634b22 100644 --- a/java/com/android/contacts/common/model/RawContact.java +++ b/java/com/android/contacts/common/model/RawContact.java @@ -78,7 +78,7 @@ public final class RawContact implements Parcelable { * @param parcel The parcel to de-serialize from. */ private RawContact(Parcel parcel) { - mValues = parcel.readParcelable(ContentValues.class.getClassLoader()); + mValues = parcel.readParcelable(ContentValues.class.getClassLoader(), ContentValues.class); mDataItems = new ArrayList<>(); parcel.readTypedList(mDataItems, NamedDataItem.CREATOR); } @@ -314,8 +314,9 @@ public final class RawContact implements Parcelable { } public NamedDataItem(Parcel parcel) { - this.mUri = parcel.readParcelable(Uri.class.getClassLoader()); - this.mContentValues = parcel.readParcelable(ContentValues.class.getClassLoader()); + this.mUri = parcel.readParcelable(Uri.class.getClassLoader(), Uri.class); + this.mContentValues = parcel.readParcelable(ContentValues.class.getClassLoader(), + ContentValues.class); } @Override diff --git a/java/com/android/contacts/common/model/account/ExternalAccountType.java b/java/com/android/contacts/common/model/account/ExternalAccountType.java index a38f8f2f84..24cd6ed86d 100644 --- a/java/com/android/contacts/common/model/account/ExternalAccountType.java +++ b/java/com/android/contacts/common/model/account/ExternalAccountType.java @@ -30,9 +30,11 @@ import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Xml; + import com.android.contacts.common.model.dataitem.DataKind; +import com.android.dialer.R; import com.android.dialer.common.LogUtil; -import com.android.dialer.contacts.resources.R; + import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -189,25 +191,23 @@ public class ExternalAccountType extends BaseAccountType { public static XmlResourceParser loadContactsXml(Context context, String resPackageName) { final PackageManager pm = context.getPackageManager(); final Intent intent = new Intent(SYNC_META_DATA).setPackage(resPackageName); - final List intentServices = - pm.queryIntentServices(intent, PackageManager.GET_SERVICES | PackageManager.GET_META_DATA); - - if (intentServices != null) { - for (final ResolveInfo resolveInfo : intentServices) { - final ServiceInfo serviceInfo = resolveInfo.serviceInfo; - if (serviceInfo == null) { - continue; - } - for (String metadataName : METADATA_CONTACTS_NAMES) { - final XmlResourceParser parser = serviceInfo.loadXmlMetaData(pm, metadataName); - if (parser != null) { - LogUtil.d( - TAG, - String.format( - "Metadata loaded from: %s, %s, %s", - serviceInfo.packageName, serviceInfo.name, metadataName)); - return parser; - } + final List intentServices = pm.queryIntentServices(intent, + PackageManager.ResolveInfoFlags.of(PackageManager.GET_META_DATA)); + + for (final ResolveInfo resolveInfo : intentServices) { + final ServiceInfo serviceInfo = resolveInfo.serviceInfo; + if (serviceInfo == null) { + continue; + } + for (String metadataName : METADATA_CONTACTS_NAMES) { + final XmlResourceParser parser = serviceInfo.loadXmlMetaData(pm, metadataName); + if (parser != null) { + LogUtil.d( + TAG, + String.format( + "Metadata loaded from: %s, %s, %s", + serviceInfo.packageName, serviceInfo.name, metadataName)); + return parser; } } } diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java index 0b3575bd91..2bb5f6a120 100644 --- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java +++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java @@ -23,6 +23,7 @@ import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.os.ResultReceiver; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; @@ -184,14 +185,14 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { static final String EXTRA_CALL_ID = "extra_call_id"; protected SelectPhoneAccountListener() { - super(new Handler()); + super(new Handler(Looper.getMainLooper())); } @Override protected void onReceiveResult(int resultCode, Bundle resultData) { if (resultCode == RESULT_SELECTED) { onPhoneAccountSelected( - resultData.getParcelable(EXTRA_SELECTED_ACCOUNT_HANDLE), + resultData.getParcelable(EXTRA_SELECTED_ACCOUNT_HANDLE, PhoneAccountHandle.class), resultData.getBoolean(EXTRA_SET_DEFAULT), resultData.getString(EXTRA_CALL_ID)); } else if (resultCode == RESULT_DISMISSED) { diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java index 1880d65387..6106bc3cbd 100644 --- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java +++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +40,7 @@ public final class SelectPhoneAccountDialogOptionsUtil { byte[] marshalledUserHandle = entry.getUserHandle().toByteArray(); parcel.unmarshall(marshalledUserHandle, 0, marshalledUserHandle.length); parcel.setDataPosition(0); - userHandle = parcel.readParcelable(UserHandle.class.getClassLoader()); + userHandle = parcel.readParcelable(UserHandle.class.getClassLoader(), UserHandle.class); } catch (NullPointerException e) { userHandle = null; } diff --git a/java/com/android/dialer/app/AccountSelectionActivity.java b/java/com/android/dialer/app/AccountSelectionActivity.java index 3f037a8eda..b6ab6b7942 100644 --- a/java/com/android/dialer/app/AccountSelectionActivity.java +++ b/java/com/android/dialer/app/AccountSelectionActivity.java @@ -88,7 +88,8 @@ public class AccountSelectionActivity extends AppCompatActivity { initiationType = CallInitiationType.Type.values()[getIntent().getIntExtra("type", 0)]; if (getSupportFragmentManager().findFragmentByTag("dialog") == null) { - List handles = getIntent().getParcelableArrayListExtra("accountHandles"); + List handles = getIntent().getParcelableArrayListExtra("accountHandles", + PhoneAccountHandle.class); SelectPhoneAccountDialogOptions options = SelectPhoneAccountDialogOptionsUtil .builderWithAccounts(handles) .setTitle(R.string.call_via_dialog_title) diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index 3442d73d61..04adc6c2ce 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -98,7 +98,7 @@ public class CallLogFragment extends Fragment private static final int EVENT_UPDATE_DISPLAY = 1; private static final long MILLIS_IN_MINUTE = 60 * 1000; - private final Handler handler = new Handler(); + private final Handler handler = new Handler(Looper.getMainLooper()); // See issue 6363009 private final ContentObserver callLogObserver = new CustomContentObserver(); private final ContentObserver contactsObserver = new CustomContentObserver(); diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsService.java b/java/com/android/dialer/app/calllog/CallLogNotificationsService.java index 947dd0213a..a9ab8c265f 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsService.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsService.java @@ -159,7 +159,9 @@ public class CallLogNotificationsService extends IntentService { break; case ACTION_LEGACY_VOICEMAIL_DISMISSED: LegacyVoicemailNotificationReceiver.setDismissed( - this, intent.getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE), true); + this, + intent.getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE, PhoneAccountHandle.class), + true); break; case ACTION_CANCEL_ALL_MISSED_CALLS: cancelAllMissedCalls(this); diff --git a/java/com/android/dialer/app/calllog/GroupingListAdapter.java b/java/com/android/dialer/app/calllog/GroupingListAdapter.java index e1a395e8dc..01250abdf9 100644 --- a/java/com/android/dialer/app/calllog/GroupingListAdapter.java +++ b/java/com/android/dialer/app/calllog/GroupingListAdapter.java @@ -21,6 +21,7 @@ import android.database.ContentObserver; import android.database.Cursor; import android.database.DataSetObserver; import android.os.Handler; +import android.os.Looper; import android.util.SparseIntArray; import androidx.recyclerview.widget.RecyclerView; @@ -35,7 +36,7 @@ import androidx.recyclerview.widget.RecyclerView; abstract class GroupingListAdapter extends RecyclerView.Adapter { protected final ContentObserver changeObserver = - new ContentObserver(new Handler()) { + new ContentObserver(new Handler(Looper.getMainLooper())) { @Override public boolean deliverSelfNotifications() { return true; diff --git a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java index c92177ee7f..47d97aa16d 100644 --- a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java @@ -174,7 +174,7 @@ public final class LegacyVoicemailNotifier { @NonNull private static String getNotificationTag( @NonNull Context context, @NonNull PhoneAccountHandle phoneAccountHandle) { - if (context.getSystemService(TelephonyManager.class).getPhoneCount() <= 1) { + if (context.getSystemService(TelephonyManager.class).getActiveModemCount() <= 1) { return NOTIFICATION_TAG; } diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index 0e75aeecc4..d9c848a35c 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -210,7 +210,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { if (getActivity() != null) { getActivity().setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE); // onNotVisible will be called in the lock screen when the call ends - if (!getActivity().getSystemService(KeyguardManager.class).inKeyguardRestrictedInputMode()) { + if (!getActivity().getSystemService(KeyguardManager.class).isKeyguardLocked()) { LogUtil.i("VisualVoicemailCallLogFragment.onNotVisible", "clearing all new voicemails"); CallLogNotificationsService.markAllNewVoicemailsAsOld(getActivity()); } diff --git a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java index 702bacb509..0121eeb58b 100644 --- a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java +++ b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +18,7 @@ package com.android.dialer.app.contactinfo; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.text.TextUtils; @@ -66,6 +68,7 @@ public class ContactInfoCache { private final WeakReference contactInfoCacheWeakReference; public InnerHandler(WeakReference contactInfoCacheWeakReference) { + super(Looper.getMainLooper()); this.contactInfoCacheWeakReference = contactInfoCacheWeakReference; } diff --git a/java/com/android/dialer/app/settings/SoundSettingsFragment.java b/java/com/android/dialer/app/settings/SoundSettingsFragment.java index b2743391f0..8e1214955e 100644 --- a/java/com/android/dialer/app/settings/SoundSettingsFragment.java +++ b/java/com/android/dialer/app/settings/SoundSettingsFragment.java @@ -56,7 +56,7 @@ public class SoundSettingsFragment extends DialerPreferenceFragment private Preference ringtonePreference; private final Handler ringtoneLookupComplete = - new Handler() { + new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { switch (msg.what) { diff --git a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java index 9f7c18590c..fb75ef16e9 100644 --- a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java +++ b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java @@ -55,7 +55,8 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { LogUtil.i( "LegacyVoicemailNotificationReceiver.onReceive", "received legacy voicemail notification"); PhoneAccountHandle phoneAccountHandle = - Assert.isNotNull(intent.getParcelableExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE)); + Assert.isNotNull(intent.getParcelableExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE, + PhoneAccountHandle.class)); int count = intent.getIntExtra(TelephonyManager.EXTRA_NOTIFICATION_COUNT, -1); boolean isRefresh = intent.getBooleanExtra(TelephonyManagerCompat.EXTRA_IS_REFRESH, false); @@ -98,9 +99,11 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { String voicemailNumber = intent.getStringExtra(TelephonyManager.EXTRA_VOICEMAIL_NUMBER); PendingIntent callVoicemailIntent = - intent.getParcelableExtra(TelephonyManager.EXTRA_CALL_VOICEMAIL_INTENT); + intent.getParcelableExtra(TelephonyManager.EXTRA_CALL_VOICEMAIL_INTENT, + PendingIntent.class); PendingIntent voicemailSettingIntent = - intent.getParcelableExtra(TelephonyManager.EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT); + intent.getParcelableExtra(TelephonyManager.EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT, + PendingIntent.class); LogUtil.i("LegacyVoicemailNotificationReceiver.onReceive", "sending notification"); LegacyVoicemailNotifier.showNotification( diff --git a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java index c469d3c49f..40d9e7b501 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java +++ b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +21,7 @@ import android.content.Context; import android.database.ContentObserver; import android.database.Cursor; import android.os.Handler; +import android.os.Looper; import android.telecom.PhoneAccountHandle; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; @@ -55,7 +57,7 @@ public class VoicemailErrorManager implements CallLogQueryHandler.Listener, Voic private final Map listeners = new ArrayMap<>(); private final ContentObserver statusObserver = - new ContentObserver(new Handler()) { + new ContentObserver(new Handler(Looper.getMainLooper())) { @Override public void onChange(boolean selfChange) { super.onChange(selfChange); diff --git a/java/com/android/dialer/callintent/CallIntent.java b/java/com/android/dialer/callintent/CallIntent.java index ac722b37a1..dc875cc75d 100644 --- a/java/com/android/dialer/callintent/CallIntent.java +++ b/java/com/android/dialer/callintent/CallIntent.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -210,7 +211,7 @@ public abstract class CallIntent implements Parcelable { public CallIntent createFromParcel(Parcel source) { CallIntent.Builder callIntentBuilder = builder(); ClassLoader classLoader = CallIntent.class.getClassLoader(); - callIntentBuilder.setNumber(source.readParcelable(classLoader)); + callIntentBuilder.setNumber(source.readParcelable(classLoader, Uri.class)); CallSpecificAppData data; try { data = CallSpecificAppData.parseFrom(source.createByteArray()); @@ -219,7 +220,7 @@ public abstract class CallIntent implements Parcelable { } callIntentBuilder .setCallSpecificAppData(data) - .setPhoneAccountHandle(source.readParcelable(classLoader)) + .setPhoneAccountHandle(source.readParcelable(classLoader, PhoneAccountHandle.class)) .setIsVideoCall(source.readInt() != 0) .setCallSubject(source.readString()) .setAllowAssistedDial(source.readInt() != 0); diff --git a/java/com/android/dialer/callintent/CallIntentBuilder.java b/java/com/android/dialer/callintent/CallIntentBuilder.java index 4e93e304ad..8567cc372a 100644 --- a/java/com/android/dialer/callintent/CallIntentBuilder.java +++ b/java/com/android/dialer/callintent/CallIntentBuilder.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +76,7 @@ public class CallIntentBuilder implements Parcelable { public CallIntentBuilder(@NonNull Parcel parcel) { ClassLoader classLoader = CallIntentBuilder.class.getClassLoader(); - uri = parcel.readParcelable(classLoader); + uri = parcel.readParcelable(classLoader, Uri.class); CallSpecificAppData data; try { data = CallSpecificAppData.parseFrom(parcel.createByteArray()); @@ -83,7 +84,7 @@ public class CallIntentBuilder implements Parcelable { data = createCallSpecificAppData(Type.UNKNOWN_INITIATION); } callSpecificAppData = data; - phoneAccountHandle = parcel.readParcelable(classLoader); + phoneAccountHandle = parcel.readParcelable(classLoader, PhoneAccountHandle.class); isVideoCall = parcel.readInt() != 0; callSubject = parcel.readString(); allowAssistedDial = parcel.readInt() != 0; diff --git a/java/com/android/dialer/callrecord/impl/CallRecorderService.java b/java/com/android/dialer/callrecord/impl/CallRecorderService.java index 5681925fee..9940956035 100644 --- a/java/com/android/dialer/callrecord/impl/CallRecorderService.java +++ b/java/com/android/dialer/callrecord/impl/CallRecorderService.java @@ -123,7 +123,7 @@ public class CallRecorderService extends Service { if (DBG) Log.d(TAG, "Starting recording"); - mMediaRecorder = new MediaRecorder(); + mMediaRecorder = new MediaRecorder(getApplicationContext()); try { int audioSource = getAudioSource(); int formatChoice = getAudioFormatChoice(); diff --git a/java/com/android/dialer/callstats/CallStatsDetailActivity.java b/java/com/android/dialer/callstats/CallStatsDetailActivity.java index 4c36e81e33..5d18de8262 100644 --- a/java/com/android/dialer/callstats/CallStatsDetailActivity.java +++ b/java/com/android/dialer/callstats/CallStatsDetailActivity.java @@ -167,8 +167,8 @@ public class CallStatsDetailActivity extends AppCompatActivity implements R.string.call_stats_outgoing, Calls.OUTGOING_TYPE); Intent launchIntent = getIntent(); - mData = (CallStatsDetails) launchIntent.getParcelableExtra(EXTRA_DETAILS); - mTotalData = (CallStatsDetails) launchIntent.getParcelableExtra(EXTRA_TOTAL); + mData = launchIntent.getParcelableExtra(EXTRA_DETAILS, CallStatsDetails.class); + mTotalData = launchIntent.getParcelableExtra(EXTRA_TOTAL, CallStatsDetails.class); updateData(); TextView dateFilterView = (TextView) findViewById(R.id.date_filter); diff --git a/java/com/android/dialer/callstats/CallStatsFragment.java b/java/com/android/dialer/callstats/CallStatsFragment.java index 4ce5f8fe91..95f7df4f86 100644 --- a/java/com/android/dialer/callstats/CallStatsFragment.java +++ b/java/com/android/dialer/callstats/CallStatsFragment.java @@ -26,6 +26,7 @@ import android.content.pm.PackageManager; import android.database.ContentObserver; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.provider.CallLog; import android.provider.ContactsContract; import android.telecom.PhoneAccountHandle; @@ -81,7 +82,8 @@ public class CallStatsFragment extends Fragment implements private boolean mHasReadCallLogPermission = false; private boolean mRefreshDataRequired = true; - private final ContentObserver mObserver = new ContentObserver(new Handler()) { + private final ContentObserver mObserver = new ContentObserver( + new Handler(Looper.getMainLooper())) { @Override public void onChange(boolean selfChange) { mRefreshDataRequired = true; diff --git a/java/com/android/dialer/common/PackageUtils.java b/java/com/android/dialer/common/PackageUtils.java index 1944a851a4..fe32d36f78 100644 --- a/java/com/android/dialer/common/PackageUtils.java +++ b/java/com/android/dialer/common/PackageUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,8 +30,9 @@ public class PackageUtils { Assert.isNotNull(packageName); Assert.isNotNull(context); try { - PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0); - if (info != null && info.packageName != null) { + PackageInfo info = context.getPackageManager().getPackageInfo(packageName, + PackageManager.PackageInfoFlags.of(0)); + if (info.packageName != null) { LogUtil.d("PackageUtils.isPackageInstalled", packageName + " is found"); return true; } diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java index 4519ba1ce5..d50febfec5 100644 --- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java +++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java @@ -94,7 +94,7 @@ public class TelephonyManagerCompat { if (telephonyManager == null) { return 1; } - return telephonyManager.getPhoneCount(); + return telephonyManager.getActiveModemCount(); } /** diff --git a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java index eaf197d7f3..7f2905eabc 100644 --- a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java +++ b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java @@ -38,6 +38,7 @@ import android.net.Uri; import android.os.Handler; import android.os.Handler.Callback; import android.os.HandlerThread; +import android.os.Looper; import android.os.Message; import android.provider.ContactsContract; import android.provider.ContactsContract.Contacts; @@ -133,7 +134,7 @@ class ContactPhotoManagerImpl extends ContactPhotoManager implements Callback { private final ConcurrentHashMap pendingRequests = new ConcurrentHashMap(); /** Handler for messages sent to the UI thread. */ - private final Handler mainThreadHandler = new Handler(this); + private final Handler mainThreadHandler = new Handler(Looper.getMainLooper(), this); /** For debug: How many times we had to reload cached photo for a stale entry */ private final AtomicInteger staleCacheOverwrite = new AtomicInteger(); /** For debug: How many times we had to reload cached photo for a fresh entry. Should be 0. */ diff --git a/java/com/android/dialer/dialpadview/DialpadFragment.java b/java/com/android/dialer/dialpadview/DialpadFragment.java index 6fdbbdc388..c3bd2bce0c 100644 --- a/java/com/android/dialer/dialpadview/DialpadFragment.java +++ b/java/com/android/dialer/dialpadview/DialpadFragment.java @@ -1071,10 +1071,8 @@ public class DialpadFragment extends Fragment } else if (getActivity() != null) { // Voicemail is unavailable maybe because Airplane mode is turned on. // Check the current status and show the most appropriate error message. - final boolean isAirplaneModeOn = - Settings.System.getInt( - getActivity().getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) - != 0; + final boolean isAirplaneModeOn = Settings.Global.getInt( + getActivity().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0) != 0; if (isAirplaneModeOn) { DialogFragment dialogFragment = ErrorDialogFragment.newInstance(R.string.dialog_voicemail_airplane_mode_message); @@ -1389,7 +1387,8 @@ public class DialpadFragment extends Fragment public boolean onMenuItemClick(MenuItem item) { if (item.getGroupId() == Menu.FIRST) { Intent intent = item.getIntent(); - selectedAccount = intent.getParcelableExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE); + selectedAccount = intent.getParcelableExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, + PhoneAccountHandle.class); return true; } int resId = item.getItemId(); diff --git a/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java b/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java index f3442e6e33..aaa65d0151 100644 --- a/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java +++ b/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java @@ -25,6 +25,7 @@ import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.LightingColorFilter; import android.os.Handler; +import android.os.Looper; import android.os.Vibrator; import android.view.View; @@ -92,7 +93,7 @@ public class PseudoEmergencyAnimator { viewProvider.getFab().getBackground().clearColorFilter(); } - new Handler() + new Handler(Looper.getMainLooper()) .postDelayed( () -> { try { diff --git a/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java b/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java index 157b1cf5f6..616df5aa99 100644 --- a/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java +++ b/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java @@ -178,7 +178,7 @@ public class SpecialCharSequenceMgr { // accessed from the emergency dialer. KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); - if (keyguardManager.inKeyguardRestrictedInputMode()) { + if (keyguardManager.isKeyguardLocked()) { return false; } @@ -321,14 +321,18 @@ public class SpecialCharSequenceMgr { ViewGroup holder = customView.findViewById(R.id.deviceids_holder); if (TelephonyManagerCompat.getPhoneCount(telephonyManager) > 1) { - for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) { - String deviceId = telephonyManager.getDeviceId(slot); + for (int slot = 0; slot < telephonyManager.getActiveModemCount(); slot++) { + String deviceId = telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM + ? telephonyManager.getImei(slot) + : telephonyManager.getMeid(slot); if (!TextUtils.isEmpty(deviceId)) { addDeviceIdRow(holder, deviceId); } } } else { - addDeviceIdRow(holder, telephonyManager.getDeviceId()); + addDeviceIdRow(holder, telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM + ? telephonyManager.getImei() + : telephonyManager.getMeid()); } new AlertDialog.Builder(context) diff --git a/java/com/android/dialer/interactions/PhoneNumberInteraction.java b/java/com/android/dialer/interactions/PhoneNumberInteraction.java index a38ba29fcb..98c6864956 100644 --- a/java/com/android/dialer/interactions/PhoneNumberInteraction.java +++ b/java/com/android/dialer/interactions/PhoneNumberInteraction.java @@ -523,7 +523,7 @@ public class PhoneNumberInteraction implements Loader.OnLoadCompleteListener {}); return locationManager.getLastKnownLocation(LocationManager.FUSED_PROVIDER); } catch (IllegalArgumentException e) { diff --git a/java/com/android/dialer/lookup/LookupUtils.java b/java/com/android/dialer/lookup/LookupUtils.java index b6e453392b..47271c6bff 100644 --- a/java/com/android/dialer/lookup/LookupUtils.java +++ b/java/com/android/dialer/lookup/LookupUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The CyanogenMod Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -163,6 +164,6 @@ public class LookupUtils { if (input == null) { return null; } - return Html.fromHtml(input).toString().trim(); + return Html.fromHtml(input, Html.FROM_HTML_MODE_LEGACY).toString().trim(); } } diff --git a/java/com/android/dialer/lookup/ReverseLookupService.java b/java/com/android/dialer/lookup/ReverseLookupService.java index 02e873b340..647ca5b8dd 100644 --- a/java/com/android/dialer/lookup/ReverseLookupService.java +++ b/java/com/android/dialer/lookup/ReverseLookupService.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 Xiao-Long Chen + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +22,7 @@ import android.graphics.Bitmap; import android.net.Uri; import android.os.Handler; import android.os.HandlerThread; +import android.os.Looper; import android.os.Message; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; @@ -51,7 +53,7 @@ public class ReverseLookupService implements PhoneNumberService, Handler.Callbac backgroundThread.start(); backgroundHandler = new Handler(backgroundThread.getLooper(), this); - handler = new Handler(this); + handler = new Handler(Looper.getMainLooper(), this); } @Override diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index fc068d1e73..d27c4eb7f3 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -27,6 +27,7 @@ import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.provider.CallLog.Calls; import android.provider.ContactsContract.QuickContact; import android.provider.VoicemailContract; @@ -733,7 +734,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen private boolean activityIsAlive; private final ContentObserver voicemailStatusObserver = - new ContentObserver(new Handler()) { + new ContentObserver(new Handler(Looper.getMainLooper())) { @Override public void onChange(boolean selfChange) { LogUtil.i( diff --git a/java/com/android/dialer/notification/VoicemailChannelUtils.java b/java/com/android/dialer/notification/VoicemailChannelUtils.java index 763da0c2a8..ac41cf60a9 100644 --- a/java/com/android/dialer/notification/VoicemailChannelUtils.java +++ b/java/com/android/dialer/notification/VoicemailChannelUtils.java @@ -225,7 +225,7 @@ import java.util.Set; if (!PermissionsUtil.hasReadPhoneStatePermissions(context)) { return true; } - return context.getSystemService(TelephonyManager.class).getPhoneCount() <= 1; + return context.getSystemService(TelephonyManager.class).getActiveModemCount() <= 1; } private VoicemailChannelUtils() {} diff --git a/java/com/android/dialer/oem/CequintPackageUtils.java b/java/com/android/dialer/oem/CequintPackageUtils.java index 5ff501d4c2..010d54d96c 100644 --- a/java/com/android/dialer/oem/CequintPackageUtils.java +++ b/java/com/android/dialer/oem/CequintPackageUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -241,7 +242,8 @@ final class CequintPackageUtils { } ProviderInfo providerInfo = - packageManager.resolveContentProvider(authority, PackageManager.GET_META_DATA); + packageManager.resolveContentProvider(authority, + PackageManager.ComponentInfoFlags.of(PackageManager.GET_META_DATA)); if (providerInfo == null) { LogUtil.d( "CequintPackageUtils.isCallerIdInstalled", @@ -262,9 +264,10 @@ final class CequintPackageUtils { try { PackageInfo packageInfo = - packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES); + packageManager.getPackageInfo(packageName, + PackageManager.PackageInfoFlags.of(PackageManager.GET_SIGNING_CERTIFICATES)); - Signature[] signatures = packageInfo.signatures; + Signature[] signatures = packageInfo.signingInfo.getSigningCertificateHistory(); if (signatures.length > 1) { LogUtil.w( "CequintPackageUtils.isCallerIdInstalled", "package has more than one signature."); diff --git a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java index 508ad3dbef..2453a76da0 100644 --- a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java +++ b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java @@ -21,6 +21,7 @@ package com.android.dialer.oem; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import com.android.dialer.common.LogUtil; import java.util.ArrayList; @@ -157,7 +158,8 @@ public class MotorolaHiddenMenuKeySequence { intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(EXTRA_HIDDEN_MENU_CODE, input); - ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent, 0); + ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent, + PackageManager.ResolveInfoFlags.of(0)); if (resolveInfo != null && resolveInfo.activityInfo != null diff --git a/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java b/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java index b045d0396c..4426eb8eda 100644 --- a/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java @@ -70,7 +70,7 @@ public class CequintPhoneLookup implements PhoneLookup { TelecomCallUtil.getNumber(call), GeoUtil.getCurrentCountryIso(appContext)); }); String callerDisplayName = call.getDetails().getCallerDisplayName(); - boolean isIncomingCall = (call.getState() == Call.STATE_RINGING); + boolean isIncomingCall = (call.getDetails().getState() == Call.STATE_RINGING); return Futures.transformAsync( dialerPhoneNumberFuture, diff --git a/java/com/android/dialer/postcall/PostCallActivity.java b/java/com/android/dialer/postcall/PostCallActivity.java index 0b76caf1a6..000ee54f83 100644 --- a/java/com/android/dialer/postcall/PostCallActivity.java +++ b/java/com/android/dialer/postcall/PostCallActivity.java @@ -97,7 +97,7 @@ public class PostCallActivity extends AppCompatActivity implements MessageFragme finish(); } else if (PermissionsUtil.hasPermission(this, permission.SEND_SMS)) { LogUtil.i("PostCallActivity.sendMessage", "Sending post call SMS."); - SmsManager smsManager = SmsManager.getDefault(); + SmsManager smsManager = getSystemService(SmsManager.class); smsManager.sendMultipartTextMessage( number, null, smsManager.divideMessage(message), null, null); PostCall.onMessageSent(this, number); diff --git a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java index 359bd819bd..4aed1a59e3 100644 --- a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java +++ b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java @@ -69,9 +69,11 @@ public class LaunchPreCallActivity extends AppCompatActivity { Intent intent = getIntent(); CallIntentBuilder builder = new CallIntentBuilder(intent.getData(), Type.EXTERNAL_INITIATION); - PhoneAccountHandle phoneAccountHandle = intent.getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE); + PhoneAccountHandle phoneAccountHandle = intent.getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE, + PhoneAccountHandle.class); if (phoneAccountHandle == null) { - phoneAccountHandle = intent.getParcelableExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE); + phoneAccountHandle = intent.getParcelableExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, + PhoneAccountHandle.class); } builder @@ -125,7 +127,8 @@ public class LaunchPreCallActivity extends AppCompatActivity { if (intentExtras.containsKey(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE)) { builder.setPhoneAccountHandle( - intentExtras.getParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE)); + intentExtras.getParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, + PhoneAccountHandle.class)); } if (intentExtras.containsKey(TelecomManager.EXTRA_CALL_SUBJECT)) { diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java index 4fd8f33517..46cac7fe09 100644 --- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java +++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java @@ -22,7 +22,7 @@ import android.content.Context; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; -import android.telephony.PhoneNumberUtils; +import android.telephony.TelephonyManager; import androidx.annotation.MainThread; import androidx.annotation.NonNull; @@ -69,16 +69,15 @@ public class CallingAccountSelector implements PreCallAction { if (builder.getPhoneAccountHandle() != null) { return false; } - if (PhoneNumberUtils.isEmergencyNumber(builder.getUri().getSchemeSpecificPart())) { + + TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class); + if (telephonyManager.isEmergencyNumber(builder.getUri().getSchemeSpecificPart())) { return false; } TelecomManager telecomManager = context.getSystemService(TelecomManager.class); List accounts = telecomManager.getCallCapablePhoneAccounts(); - if (accounts.size() <= 1) { - return false; - } - return true; + return accounts.size() > 1; } @Override diff --git a/java/com/android/dialer/precall/impl/PermissionCheckAction.java b/java/com/android/dialer/precall/impl/PermissionCheckAction.java index 85e9ceb9ca..9377c25a49 100644 --- a/java/com/android/dialer/precall/impl/PermissionCheckAction.java +++ b/java/com/android/dialer/precall/impl/PermissionCheckAction.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +22,14 @@ import android.widget.Toast; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.precall.PreCallAction; import com.android.dialer.precall.PreCallCoordinator; -import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.util.PermissionsUtil; /** Aborts call and show a toast if phone permissions are missing. */ public class PermissionCheckAction implements PreCallAction { @Override public boolean requiresUi(Context context, CallIntentBuilder builder) { - return !TelecomUtil.hasCallPhonePermission(context); + return !PermissionsUtil.hasPhonePermissions(context); } @Override diff --git a/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java b/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java index 18ac29c9bc..476202b46b 100644 --- a/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java +++ b/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java @@ -69,9 +69,11 @@ public class PreCallCoordinatorImpl implements PreCallCoordinator { LogUtil.enterBlock("PreCallCoordinatorImpl.onCreate"); if (savedInstanceState != null) { currentActionIndex = savedInstanceState.getInt(SAVED_STATE_CURRENT_ACTION); - builder = Assert.isNotNull(savedInstanceState.getParcelable(EXTRA_CALL_INTENT_BUILDER)); + builder = Assert.isNotNull(savedInstanceState.getParcelable(EXTRA_CALL_INTENT_BUILDER, + CallIntentBuilder.class)); } else { - builder = Assert.isNotNull(intent.getParcelableExtra(EXTRA_CALL_INTENT_BUILDER)); + builder = Assert.isNotNull(intent.getParcelableExtra(EXTRA_CALL_INTENT_BUILDER, + CallIntentBuilder.class)); } uiListener = DialerExecutorComponent.get(activity) @@ -81,7 +83,7 @@ public class PreCallCoordinatorImpl implements PreCallCoordinator { void onRestoreInstanceState(Bundle savedInstanceState) { currentActionIndex = savedInstanceState.getInt(SAVED_STATE_CURRENT_ACTION); - builder = savedInstanceState.getParcelable(EXTRA_CALL_INTENT_BUILDER); + builder = savedInstanceState.getParcelable(EXTRA_CALL_INTENT_BUILDER, CallIntentBuilder.class); } void onResume() { diff --git a/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java b/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java index 527baa4f3d..030223286a 100644 --- a/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java +++ b/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -334,10 +335,9 @@ public class PreferredAccountWorkerImpl implements PreferredAccountWorker { Assert.isWorkerThread(); Intent quickContactIntent = getQuickContactIntent(); - ResolveInfo resolveInfo = - context - .getPackageManager() - .resolveActivity(quickContactIntent, PackageManager.GET_META_DATA); + ResolveInfo resolveInfo = context.getPackageManager().resolveActivity( + quickContactIntent, + PackageManager.ResolveInfoFlags.of(PackageManager.GET_META_DATA)); if (resolveInfo == null || resolveInfo.activityInfo == null || resolveInfo.activityInfo.applicationInfo == null diff --git a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java index 6cc57b9005..3a6c7025e4 100644 --- a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java +++ b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java @@ -480,12 +480,12 @@ final class ContactFilterCursor implements Cursor { @Override public void deactivate() { - cursor.deactivate(); + } @Override public boolean requery() { - return cursor.requery(); + return false; } @Override diff --git a/java/com/android/dialer/shortcuts/CallContactActivity.java b/java/com/android/dialer/shortcuts/CallContactActivity.java index 087475291f..87fe5e6d76 100644 --- a/java/com/android/dialer/shortcuts/CallContactActivity.java +++ b/java/com/android/dialer/shortcuts/CallContactActivity.java @@ -120,7 +120,7 @@ public class CallContactActivity extends TransactionSafeActivity if (savedInstanceState == null) { return; } - contactUri = savedInstanceState.getParcelable(CONTACT_URI_KEY); + contactUri = savedInstanceState.getParcelable(CONTACT_URI_KEY, Uri.class); } @Override diff --git a/java/com/android/dialer/simulator/impl/SimulatorConnection.java b/java/com/android/dialer/simulator/impl/SimulatorConnection.java index 6c73447a4f..d813373fd7 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorConnection.java +++ b/java/com/android/dialer/simulator/impl/SimulatorConnection.java @@ -50,7 +50,8 @@ public final class SimulatorConnection extends Connection { CAPABILITY_MUTE | CAPABILITY_SUPPORT_HOLD | CAPABILITY_HOLD - | CAPABILITY_CAN_UPGRADE_TO_VIDEO + | CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL + | CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL | CAPABILITY_DISCONNECT_FROM_CONFERENCE); if (request.getExtras() != null) { diff --git a/java/com/android/dialer/simulator/impl/SimulatorRemoteVideo.java b/java/com/android/dialer/simulator/impl/SimulatorRemoteVideo.java index 060e629581..96a2826e28 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorRemoteVideo.java +++ b/java/com/android/dialer/simulator/impl/SimulatorRemoteVideo.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +22,7 @@ import android.graphics.Color; import android.graphics.Paint; import android.os.Handler; import android.os.HandlerThread; +import android.os.Looper; import android.view.Surface; import androidx.annotation.NonNull; @@ -78,7 +80,7 @@ final class SimulatorRemoteVideo { @WorkerThread void schedule() { Assert.isWorkerThread(); - new Handler().postDelayed(this, FRAME_DELAY_MILLIS); + new Handler(Looper.getMainLooper()).postDelayed(this, FRAME_DELAY_MILLIS); } @WorkerThread diff --git a/java/com/android/dialer/telecom/TelecomUtil.java b/java/com/android/dialer/telecom/TelecomUtil.java index cb769b9fd4..6e218604d2 100644 --- a/java/com/android/dialer/telecom/TelecomUtil.java +++ b/java/com/android/dialer/telecom/TelecomUtil.java @@ -18,7 +18,6 @@ package com.android.dialer.telecom; import android.app.role.RoleManager; -import android.Manifest; import android.Manifest.permission; import android.content.ComponentName; import android.content.Context; @@ -41,6 +40,7 @@ import androidx.annotation.RequiresPermission; import androidx.core.content.ContextCompat; import com.android.dialer.common.LogUtil; +import com.android.dialer.util.PermissionsUtil; import com.google.common.base.Optional; import java.util.ArrayList; @@ -70,7 +70,7 @@ public abstract class TelecomUtil { new ConcurrentHashMap<>(); public static void showInCallScreen(Context context, boolean showDialpad) { - if (hasReadPhoneStatePermission(context)) { + if (PermissionsUtil.hasReadPhoneStatePermissions(context)) { try { getTelecomManager(context).showInCallScreen(showDialpad); } catch (SecurityException e) { @@ -81,7 +81,7 @@ public abstract class TelecomUtil { } public static void silenceRinger(Context context) { - if (hasModifyPhoneStatePermission(context)) { + if (PermissionsUtil.hasModifyPhoneStatePermissions(context)) { try { getTelecomManager(context).silenceRinger(); } catch (SecurityException e) { @@ -92,7 +92,7 @@ public abstract class TelecomUtil { } public static void cancelMissedCallsNotification(Context context) { - if (hasModifyPhoneStatePermission(context)) { + if (PermissionsUtil.hasModifyPhoneStatePermissions(context)) { try { getTelecomManager(context).cancelMissedCallsNotification(); } catch (SecurityException e) { @@ -102,7 +102,7 @@ public abstract class TelecomUtil { } public static Uri getAdnUriForPhoneAccount(Context context, PhoneAccountHandle handle) { - if (hasModifyPhoneStatePermission(context)) { + if (PermissionsUtil.hasModifyPhoneStatePermissions(context)) { try { return getTelecomManager(context).getAdnUriForPhoneAccount(handle); } catch (SecurityException e) { @@ -114,7 +114,7 @@ public abstract class TelecomUtil { public static boolean handleMmi( Context context, String dialString, @Nullable PhoneAccountHandle handle) { - if (hasModifyPhoneStatePermission(context)) { + if (PermissionsUtil.hasModifyPhoneStatePermissions(context)) { try { if (handle == null) { return getTelecomManager(context).handleMmi(dialString); @@ -131,7 +131,7 @@ public abstract class TelecomUtil { @Nullable public static PhoneAccountHandle getDefaultOutgoingPhoneAccount( Context context, String uriScheme) { - if (hasReadPhoneStatePermission(context)) { + if (PermissionsUtil.hasReadPhoneStatePermissions(context)) { return getTelecomManager(context).getDefaultOutgoingPhoneAccount(uriScheme); } return null; @@ -142,7 +142,7 @@ public abstract class TelecomUtil { } public static List getCallCapablePhoneAccounts(Context context) { - if (hasReadPhoneStatePermission(context)) { + if (PermissionsUtil.hasReadPhoneStatePermissions(context)) { return Optional.fromNullable(getTelecomManager(context).getCallCapablePhoneAccounts()) .or(new ArrayList<>()); } @@ -198,7 +198,7 @@ public abstract class TelecomUtil { if (TextUtils.isEmpty(phoneAccountHandle.getId())) { return Optional.absent(); } - if (!hasPermission(context, permission.READ_PHONE_STATE)) { + if (!PermissionsUtil.hasReadPhoneStatePermissions(context)) { return Optional.absent(); } SubscriptionManager subscriptionManager = context.getSystemService(SubscriptionManager.class); @@ -242,7 +242,7 @@ public abstract class TelecomUtil { return isVoicemailNumberCache.get(cacheKey); } boolean result = false; - if (hasReadPhoneStatePermission(context)) { + if (PermissionsUtil.hasReadPhoneStatePermissions(context)) { result = getTelecomManager(context).isVoiceMailNumber(accountHandle, number); } isVoicemailNumberCache.put(cacheKey, result); @@ -251,7 +251,7 @@ public abstract class TelecomUtil { @Nullable public static String getVoicemailNumber(Context context, PhoneAccountHandle accountHandle) { - if (hasReadPhoneStatePermission(context)) { + if (PermissionsUtil.hasReadPhoneStatePermissions(context)) { return getTelecomManager(context).getVoiceMailNumber(accountHandle); } return null; @@ -266,7 +266,7 @@ public abstract class TelecomUtil { * due to a permission check. */ public static boolean placeCall(Context context, Intent intent) { - if (hasCallPhonePermission(context)) { + if (PermissionsUtil.hasPhonePermissions(context)) { getTelecomManager(context).placeCall(intent.getData(), intent.getExtras()); return true; } @@ -281,31 +281,8 @@ public abstract class TelecomUtil { public static boolean hasReadWriteVoicemailPermissions(Context context) { return isDefaultDialer(context) - || (hasPermission(context, Manifest.permission.READ_VOICEMAIL) - && hasPermission(context, Manifest.permission.WRITE_VOICEMAIL)); - } - - /** @deprecated use {@link com.android.dialer.util.PermissionsUtil} */ - @Deprecated - public static boolean hasModifyPhoneStatePermission(Context context) { - return isDefaultDialer(context) - || hasPermission(context, Manifest.permission.MODIFY_PHONE_STATE); - } - - /** @deprecated use {@link com.android.dialer.util.PermissionsUtil} */ - @Deprecated - public static boolean hasReadPhoneStatePermission(Context context) { - return isDefaultDialer(context) || hasPermission(context, Manifest.permission.READ_PHONE_STATE); - } - - /** @deprecated use {@link com.android.dialer.util.PermissionsUtil} */ - @Deprecated - public static boolean hasCallPhonePermission(Context context) { - return isDefaultDialer(context) || hasPermission(context, Manifest.permission.CALL_PHONE); - } - - private static boolean hasPermission(Context context, String permission) { - return instance.hasPermission(context, permission); + || (PermissionsUtil.hasReadVoicemailPermissions(context) + && PermissionsUtil.hasWriteVoicemailPermissions(context)); } private static TelecomManager getTelecomManager(Context context) { @@ -343,7 +320,7 @@ public abstract class TelecomUtil { private static class TelecomUtilImpl { public boolean isInManagedCall(Context context) { - if (hasReadPhoneStatePermission(context)) { + if (PermissionsUtil.hasReadPhoneStatePermissions(context)) { // The TelecomManager#isInCall method returns true anytime the user is in a call. // Starting in O, the APIs include support for self-managed ConnectionServices so that other // apps like Duo can tell Telecom about its calls. So, if the user is in a Duo call, @@ -358,7 +335,8 @@ public abstract class TelecomUtil { } public boolean isInCall(Context context) { - return hasReadPhoneStatePermission(context) && getTelecomManager(context).isInCall(); + return PermissionsUtil.hasReadPhoneStatePermissions(context) && + getTelecomManager(context).isInCall(); } public boolean hasPermission(Context context, String permission) { diff --git a/java/com/android/dialer/util/DialerUtils.java b/java/com/android/dialer/util/DialerUtils.java index ff0ba4f11e..b877619b54 100644 --- a/java/com/android/dialer/util/DialerUtils.java +++ b/java/com/android/dialer/util/DialerUtils.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +81,8 @@ public class DialerUtils { Bundle extras; // Make sure to not accidentally clobber any existing extras if (intent.hasExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS)) { - extras = intent.getParcelableExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS); + extras = intent.getParcelableExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, + Bundle.class); } else { extras = new Bundle(); } @@ -127,11 +129,11 @@ public class DialerUtils { @SuppressLint("MissingPermission") private static boolean shouldWarnForOutgoingWps(Context context, String number) { if (number != null && number.startsWith(WPS_PREFIX)) { + TelecomManager telecomManager = context.getSystemService(TelecomManager.class); TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class); boolean isOnVolte = telephonyManager.getVoiceNetworkType() == TelephonyManager.NETWORK_TYPE_LTE; - boolean hasCurrentActiveCall = - telephonyManager.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK; + boolean hasCurrentActiveCall = telecomManager.isInCall(); return isOnVolte && hasCurrentActiveCall; } return false; diff --git a/java/com/android/dialer/util/PermissionsUtil.java b/java/com/android/dialer/util/PermissionsUtil.java index c526b6afd8..13fdbdd3dc 100644 --- a/java/com/android/dialer/util/PermissionsUtil.java +++ b/java/com/android/dialer/util/PermissionsUtil.java @@ -90,6 +90,10 @@ public class PermissionsUtil { return hasPermission(context, permission.READ_PHONE_STATE); } + public static boolean hasModifyPhoneStatePermissions(Context context) { + return hasPermission(context, MODIFY_PHONE_STATE); + } + public static boolean hasContactsReadPermissions(Context context) { return hasPermission(context, permission.READ_CONTACTS); } diff --git a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java index 45c5cc04db..43b65e6ea3 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java @@ -24,6 +24,7 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnDismissListener; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.telecom.PhoneAccountHandle; import android.text.Editable; @@ -321,7 +322,8 @@ public class VoicemailChangePinActivity extends AppCompatActivity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - phoneAccountHandle = getIntent().getParcelableExtra(VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE); + phoneAccountHandle = getIntent().getParcelableExtra(VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE, + PhoneAccountHandle.class); pinChanger = VoicemailComponent.get(this) .getVoicemailClient() @@ -561,6 +563,7 @@ public class VoicemailChangePinActivity extends AppCompatActivity private final WeakReference activityWeakReference; private ChangePinHandler(WeakReference activityWeakReference) { + super(Looper.getMainLooper()); this.activityWeakReference = activityWeakReference; } diff --git a/java/com/android/incallui/AccelerometerListener.java b/java/com/android/incallui/AccelerometerListener.java index 378971a5f7..8bd1515c0a 100644 --- a/java/com/android/incallui/AccelerometerListener.java +++ b/java/com/android/incallui/AccelerometerListener.java @@ -23,6 +23,7 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Handler; +import android.os.Looper; import android.os.Message; import com.android.dialer.common.LogUtil; @@ -52,30 +53,29 @@ public class AccelerometerListener { // mOrientation. private int pendingOrientation; private OrientationListener listener; - Handler handler = - new Handler() { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case ORIENTATION_CHANGED: - synchronized (this) { - orientation = pendingOrientation; - if (DEBUG) { - LogUtil.d( - TAG, - "orientation: " - + (orientation == ORIENTATION_HORIZONTAL - ? "horizontal" - : (orientation == ORIENTATION_VERTICAL ? "vertical" : "unknown"))); - } - if (listener != null) { - listener.orientationChanged(orientation); - } - } - break; + final Handler handler = new Handler(Looper.getMainLooper()) { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case ORIENTATION_CHANGED: + synchronized (this) { + orientation = pendingOrientation; + if (DEBUG) { + LogUtil.d( + TAG, + "orientation: " + + (orientation == ORIENTATION_HORIZONTAL + ? "horizontal" + : (orientation == ORIENTATION_VERTICAL ? "vertical" : "unknown"))); + } + if (listener != null) { + listener.orientationChanged(orientation); + } } - } - }; + break; + } + } + }; final SensorEventListener sensorListener = new SensorEventListener() { @Override diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index 2cd111a787..efcca39f5e 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -27,6 +27,7 @@ import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.hardware.display.DisplayManager; import android.os.Handler; +import android.os.Looper; import android.os.Trace; import android.telecom.Call.Details; import android.telecom.StatusHints; @@ -103,7 +104,7 @@ public class CallCardPresenter private static final long CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT = 10; private final Context context; - private final Handler handler = new Handler(); + private final Handler handler = new Handler(Looper.getMainLooper()); private DialerCall primary; private String primaryNumber; @@ -783,8 +784,9 @@ public class CallCardPresenter // Return the label for the gateway app on outgoing calls. final PackageManager pm = context.getPackageManager(); try { - ApplicationInfo info = - pm.getApplicationInfo(primary.getGatewayInfo().getGatewayProviderPackageName(), 0); + ApplicationInfo info = pm.getApplicationInfo( + primary.getGatewayInfo().getGatewayProviderPackageName(), + PackageManager.ApplicationInfoFlags.of(0)); return pm.getApplicationLabel(info).toString(); } catch (PackageManager.NameNotFoundException e) { LogUtil.e("CallCardPresenter.getConnectionLabel", "gateway Application Not Found.", e); diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java index 3be820db3d..62b1957cb1 100644 --- a/java/com/android/incallui/ExternalCallNotifier.java +++ b/java/com/android/incallui/ExternalCallNotifier.java @@ -19,6 +19,7 @@ package com.android.incallui; import android.app.Notification; import android.app.PendingIntent; +import android.app.Person; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; @@ -219,7 +220,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen /** Rebuild an existing or show a new notification given {@link NotificationInfo}. */ private void postNotification(NotificationInfo info) { - Notification.Builder builder = new Notification.Builder(context); + Notification.Builder builder = new Notification.Builder(context, NotificationChannelId.DEFAULT); // Set notification as ongoing since calls are long-running versus a point-in-time notice. builder.setOngoing(true); // Make the notification prioritized over the other normal notifications. @@ -237,8 +238,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen builder.setContentTitle(info.getContentTitle()); builder.setLargeIcon(info.getLargeIcon()); builder.setColor(ThemeComponent.get(context).theme().getColorCallNotificationBackground()); - builder.addPerson(info.getPersonReference()); - builder.setChannelId(NotificationChannelId.DEFAULT); + builder.addPerson(new Person.Builder().setUri(info.getPersonReference()).build()); // Where the external call supports being transferred to the local device, add an action // to the notification to initiate the call pull process. diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java index 99e109cbe4..8213678fb2 100644 --- a/java/com/android/incallui/InCallActivity.java +++ b/java/com/android/incallui/InCallActivity.java @@ -33,6 +33,7 @@ import android.os.Trace; import android.telecom.Call; import android.telecom.CallAudioState; import android.telecom.PhoneAccountHandle; +import android.telecom.PhoneAccountSuggestion; import android.telephony.TelephonyManager; import android.view.KeyEvent; import android.view.MenuItem; @@ -342,10 +343,17 @@ public class InCallActivity extends TransactionSafeFragmentActivity PreferredSimComponent.get(this).preferredAccountWorker(); Bundle extras = waitingForAccountCall.getIntentExtras(); - List phoneAccountHandles = + List phoneAccountSuggestions = extras == null ? new ArrayList<>() - : extras.getParcelableArrayList(Call.AVAILABLE_PHONE_ACCOUNTS); + : extras.getParcelableArrayList(Call.EXTRA_SUGGESTED_PHONE_ACCOUNTS, + PhoneAccountSuggestion.class); + List phoneAccountHandles = new ArrayList<>(); + if (phoneAccountSuggestions != null) { + for (PhoneAccountSuggestion suggestion : phoneAccountSuggestions) { + phoneAccountHandles.add(suggestion.getPhoneAccountHandle()); + } + } ListenableFuture preferredAccountFuture = preferredAccountWorker.selectAccount( @@ -1028,7 +1036,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity List tasks = getSystemService(ActivityManager.class).getAppTasks(); for (AppTask task : tasks) { try { - if (task.getTaskInfo().id == taskId) { + if (task.getTaskInfo().taskId == taskId) { task.setExcludeFromRecents(exclude); } } catch (RuntimeException e) { diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index ada3935f12..77bf56286b 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -23,14 +23,16 @@ import android.graphics.Point; import android.os.Bundle; import android.os.Trace; import android.provider.BlockedNumberContract; +import android.telecom.Call; import android.telecom.Call.Details; import android.telecom.CallAudioState; import android.telecom.DisconnectCause; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; +import android.telecom.PhoneAccountSuggestion; import android.telecom.TelecomManager; import android.telecom.VideoProfile; -import android.telephony.PhoneStateListener; +import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.util.ArraySet; import android.view.Window; @@ -183,23 +185,6 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud private boolean screenTimeoutEnabled = true; - private PhoneStateListener phoneStateListener = - new PhoneStateListener() { - @Override - public void onCallStateChanged(int state, String incomingNumber) { - if (state == TelephonyManager.CALL_STATE_RINGING) { - if (EmergencyCallUtil.hasRecentEmergencyCall(context)) { - return; - } - // Check if the number is blocked, to silence the ringer. - if (BlockedNumberContract.canCurrentUserBlockNumbers(context) && - BlockedNumberContract.isBlocked(context, incomingNumber)) { - TelecomUtil.silenceRinger(context); - } - } - } - }; - /** Whether or not InCallService is bound to Telecom. */ private boolean serviceBound = false; @@ -275,8 +260,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud extras = EMPTY_EXTRAS; } - final List phoneAccountHandles = - extras.getParcelableArrayList(android.telecom.Call.AVAILABLE_PHONE_ACCOUNTS); + final List phoneAccountHandles = + extras.getParcelableArrayList(android.telecom.Call.EXTRA_SUGGESTED_PHONE_ACCOUNTS, + PhoneAccountSuggestion.class); if ((call.getAccountHandle() == null && (phoneAccountHandles == null || phoneAccountHandles.isEmpty()))) { @@ -357,9 +343,6 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud this.callList.addListener(activeCallsListener); VideoPauseController.getInstance().setUp(this); - this.context - .getSystemService(TelephonyManager.class) - .listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); AudioModeProvider.getInstance().addListener(this); @@ -387,10 +370,6 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud serviceConnected = false; - context - .getSystemService(TelephonyManager.class) - .listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); - attemptCleanup(); VideoPauseController.getInstance().tearDown(); AudioModeProvider.getInstance().removeListener(this); @@ -524,6 +503,24 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud callList.onCallAdded(context, call); } + if (call.getDetails().getState() == Call.STATE_RINGING) { + if (EmergencyCallUtil.hasRecentEmergencyCall(context)) { + return; + } + + TelephonyManager tm = context.getSystemService(TelephonyManager.class); + String countryIso = tm.getSimCountryIso().toUpperCase(); + String incomingNumber = call.getDetails().getHandle().getSchemeSpecificPart(); + + incomingNumber = PhoneNumberUtils.formatNumberToE164(incomingNumber, countryIso); + + // Check if the number is blocked, to silence the ringer. + if (BlockedNumberContract.canCurrentUserBlockNumbers(context) && + BlockedNumberContract.isBlocked(context, incomingNumber)) { + TelecomUtil.silenceRinger(context); + } + } + // Since a call has been added we are no longer waiting for Telecom to send us a call. setBoundAndWaitingForOutgoingCall(false, null); call.registerCallback(callCallback); @@ -1360,10 +1357,11 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud extras = new Bundle(); } - final List phoneAccountHandles = - extras.getParcelableArrayList(android.telecom.Call.AVAILABLE_PHONE_ACCOUNTS); + final List phoneAccountSuggestions = + extras.getParcelableArrayList(Call.EXTRA_SUGGESTED_PHONE_ACCOUNTS, + PhoneAccountSuggestion.class); - if (phoneAccountHandles == null || phoneAccountHandles.isEmpty()) { + if (phoneAccountSuggestions == null || phoneAccountSuggestions.isEmpty()) { String scheme = call.getHandle().getScheme(); final String errorMsg = PhoneAccount.SCHEME_TEL.equals(scheme) @@ -1481,14 +1479,15 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud return; } - if (extras.containsKey(android.telecom.Call.AVAILABLE_PHONE_ACCOUNTS)) { + if (extras.containsKey(Call.EXTRA_SUGGESTED_PHONE_ACCOUNTS)) { // Account selection dialog will show up so don't show the animation. return; } final PhoneAccountHandle accountHandle = - intent.getParcelableExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE); - final Point touchPoint = extras.getParcelable(TouchPointManager.TOUCH_POINT); + intent.getParcelableExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, + PhoneAccountHandle.class); + final Point touchPoint = extras.getParcelable(TouchPointManager.TOUCH_POINT, Point.class); setBoundAndWaitingForOutgoingCall(true, accountHandle); diff --git a/java/com/android/incallui/InCallVibrationHandler.java b/java/com/android/incallui/InCallVibrationHandler.java index 8ce8d0bfe2..cde882a503 100644 --- a/java/com/android/incallui/InCallVibrationHandler.java +++ b/java/com/android/incallui/InCallVibrationHandler.java @@ -20,8 +20,11 @@ package com.android.incallui; import android.content.Context; import android.content.SharedPreferences; import android.os.Handler; +import android.os.Looper; import android.os.Message; +import android.os.VibrationEffect; import android.os.Vibrator; +import android.os.VibratorManager; import android.telecom.DisconnectCause; import androidx.preference.PreferenceManager; @@ -46,10 +49,11 @@ public class InCallVibrationHandler extends Handler implements private DialerCall activeCall; public InCallVibrationHandler(Context context) { + super(Looper.getMainLooper()); String name = context.getPackageName() + "_preferences"; prefs = context.createDeviceProtectedStorageContext() .getSharedPreferences(name, Context.MODE_PRIVATE); - vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); + vibrator = context.getSystemService(VibratorManager.class).getDefaultVibrator(); } @Override @@ -142,6 +146,7 @@ public class InCallVibrationHandler extends Handler implements long[] pattern = new long[] { 0, v1, p1, v2 }; - vibrator.vibrate(pattern, -1); + VibrationEffect effect = VibrationEffect.createWaveform(pattern, -1); + vibrator.vibrate(effect); } } diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 423e401978..2a94cd4eb0 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -336,8 +336,6 @@ public class StatusBarNotifier configureFullScreenIntent(builder, createLaunchPendingIntent(true /* isFullScreen */)); // Set the notification category and bump the priority for incoming calls builder.setCategory(Notification.CATEGORY_CALL); - // This will be ignored on O+ and handled by the channel - builder.setPriority(Notification.PRIORITY_MAX); if (currentNotification != NOTIFICATION_INCOMING_CALL) { LogUtil.i( "StatusBarNotifier.buildAndSendNotification", @@ -549,10 +547,14 @@ public class StatusBarNotifier // Query {@link Contacts#CONTENT_LOOKUP_URI} directly with work lookup key is not allowed. // So, do not pass {@link Contacts#CONTENT_LOOKUP_URI} to NotificationManager to avoid // NotificationManager using it. + String uri = null; if (contactInfo.lookupUri != null && contactInfo.userType != ContactsUtils.USER_TYPE_WORK) { - builder.addPerson(contactInfo.lookupUri.toString()); + uri = contactInfo.lookupUri.toString(); } else if (!TextUtils.isEmpty(call.getNumber())) { - builder.addPerson(Uri.fromParts(PhoneAccount.SCHEME_TEL, call.getNumber(), null).toString()); + uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, call.getNumber(), null).toString(); + } + if (uri != null) { + builder.addPerson(new Person.Builder().setUri(uri).build()); } } diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java index 3f924538d0..2402394ea8 100644 --- a/java/com/android/incallui/VideoCallPresenter.java +++ b/java/com/android/incallui/VideoCallPresenter.java @@ -21,6 +21,7 @@ import android.app.Activity; import android.content.Context; import android.graphics.Point; import android.os.Handler; +import android.os.Looper; import android.telecom.InCallService.VideoCall; import android.telecom.VideoProfile; import android.telecom.VideoProfile.CameraCapabilities; @@ -88,7 +89,7 @@ public class VideoCallPresenter private static boolean isVideoMode = false; - private final Handler handler = new Handler(); + private final Handler handler = new Handler(Looper.getMainLooper()); private VideoCallScreen videoCallScreen; /** The current context. */ @@ -1115,7 +1116,7 @@ public class VideoCallPresenter Activity activity = videoCallScreen.getVideoCallScreenFragment().getActivity(); if (activity != null) { Point screenSize = new Point(); - activity.getWindowManager().getDefaultDisplay().getSize(screenSize); + activity.getDisplay().getSize(screenSize); getRemoteVideoSurfaceTexture().setSurfaceDimensions(screenSize); } } diff --git a/java/com/android/incallui/answerproximitysensor/SystemProximityWakeLock.java b/java/com/android/incallui/answerproximitysensor/SystemProximityWakeLock.java index da3917f94f..c30ffb5757 100644 --- a/java/com/android/incallui/answerproximitysensor/SystemProximityWakeLock.java +++ b/java/com/android/incallui/answerproximitysensor/SystemProximityWakeLock.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +30,7 @@ import com.android.dialer.common.LogUtil; /** The normal PROXIMITY_SCREEN_OFF_WAKE_LOCK provided by the OS. */ public class SystemProximityWakeLock implements AnswerProximityWakeLock, DisplayListener { - private static final String TAG = "SystemProximityWakeLock"; + private static final String TAG = "SystemProximity:WakeLock"; private final Context context; private final PowerManager.WakeLock wakeLock; diff --git a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java index ef28c64b37..c5836e39ea 100644 --- a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java +++ b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java @@ -95,7 +95,7 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment public View onCreateView( LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) { View view = layoutInflater.inflate(R.layout.audioroute_selector, viewGroup, false); - CallAudioState audioState = getArguments().getParcelable(ARG_AUDIO_STATE); + CallAudioState audioState = getArguments().getParcelable(ARG_AUDIO_STATE, CallAudioState.class); // Create items for all connected Bluetooth devices Collection bluetoothDeviceSet = audioState.getSupportedBluetoothDevices(); diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java index fb03a485eb..1ff6c475cd 100644 --- a/java/com/android/incallui/call/CallList.java +++ b/java/com/android/incallui/call/CallList.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +19,7 @@ package com.android.incallui.call; import android.content.Context; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.os.Trace; import android.provider.BlockedNumberContract; @@ -75,21 +77,20 @@ public class CallList implements DialerCallDelegate { private UiListener uiListeners; /** Handles the timeout for destroying disconnected calls. */ - private final Handler handler = - new Handler() { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case EVENT_DISCONNECTED_TIMEOUT: - LogUtil.d("CallList.handleMessage", "EVENT_DISCONNECTED_TIMEOUT ", msg.obj); - finishDisconnectedCall((DialerCall) msg.obj); - break; - default: - LogUtil.e("CallList.handleMessage", "Message not expected: " + msg.what); - break; - } - } - }; + private final Handler handler = new Handler(Looper.getMainLooper()) { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case EVENT_DISCONNECTED_TIMEOUT: + LogUtil.d("CallList.handleMessage", "EVENT_DISCONNECTED_TIMEOUT ", msg.obj); + finishDisconnectedCall((DialerCall) msg.obj); + break; + default: + LogUtil.e("CallList.handleMessage", "Message not expected: " + msg.what); + break; + } + } + }; /** * USED ONLY FOR TESTING Testing-only constructor. Instance should only be acquired through diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 87aa087616..485a6c7ecd 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -543,9 +543,10 @@ public class DialerCall implements VideoTechListener { Trace.beginSection("DialerCall.updateFromTelecomCall"); LogUtil.v("DialerCall.updateFromTelecomCall", telecomCall.toString()); - videoTechManager.dispatchCallStateChanged(telecomCall.getState(), getAccountHandle()); + videoTechManager.dispatchCallStateChanged(telecomCall.getDetails().getState(), + getAccountHandle()); - final int translatedState = translateState(telecomCall.getState()); + final int translatedState = translateState(telecomCall.getDetails().getState()); if (state != DialerCallState.BLOCKED) { setState(translatedState); setDisconnectCause(telecomCall.getDetails().getDisconnectCause()); @@ -1097,7 +1098,8 @@ public class DialerCall implements VideoTechListener { * repeated calls to isEmergencyNumber. */ private void updateEmergencyCallState() { - isEmergencyCall = TelecomCallUtil.isEmergencyCall(telecomCall); + TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class); + isEmergencyCall = TelecomCallUtil.isEmergencyCall(telephonyManager, telecomCall); } public LogState getLogState() { diff --git a/java/com/android/incallui/callpending/CallPendingActivity.java b/java/com/android/incallui/callpending/CallPendingActivity.java index 38e0eeb9c6..eb140a919f 100644 --- a/java/com/android/incallui/callpending/CallPendingActivity.java +++ b/java/com/android/incallui/callpending/CallPendingActivity.java @@ -344,6 +344,6 @@ public class CallPendingActivity extends FragmentActivity } private Uri getPhotoUri() { - return getIntent().getParcelableExtra(EXTRA_PHOTO_URI); + return getIntent().getParcelableExtra(EXTRA_PHOTO_URI, Uri.class); } } diff --git a/java/com/android/incallui/hold/OnHoldFragment.java b/java/com/android/incallui/hold/OnHoldFragment.java index a94517acc8..03041857c5 100644 --- a/java/com/android/incallui/hold/OnHoldFragment.java +++ b/java/com/android/incallui/hold/OnHoldFragment.java @@ -26,6 +26,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.ViewGroup; +import android.view.WindowInsets; import android.widget.ImageView; import android.widget.TextView; @@ -58,7 +59,7 @@ public class OnHoldFragment extends Fragment { LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) { final View view = layoutInflater.inflate(R.layout.incall_on_hold_banner, viewGroup, false); - SecondaryInfo secondaryInfo = getArguments().getParcelable(ARG_INFO); + SecondaryInfo secondaryInfo = getArguments().getParcelable(ARG_INFO, SecondaryInfo.class); secondaryInfo = Assert.isNotNull(secondaryInfo); ((TextView) view.findViewById(R.id.hold_contact_name)) @@ -77,7 +78,7 @@ public class OnHoldFragment extends Fragment { new OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { - topInset = v.getRootWindowInsets().getSystemWindowInsetTop(); + topInset = v.getRootWindowInsets().getInsets(WindowInsets.Type.systemBars()).top; applyInset(); } diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index 12e1927c27..9ffb934dfe 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -22,8 +22,10 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; +import android.graphics.Insets; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.telecom.CallAudioState; import android.telephony.TelephonyManager; import android.transition.TransitionManager; @@ -33,6 +35,7 @@ import android.view.View.OnAttachStateChangeListener; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; +import android.view.WindowInsets; import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; import android.widget.Toast; @@ -101,7 +104,7 @@ public class InCallFragment extends Fragment // Add animation to educate users. If a call has enriched calling attachments then we'll // initially show the attachment page. After a delay seconds we'll animate to the button grid. - private final Handler handler = new Handler(); + private final Handler handler = new Handler(Looper.getMainLooper()); private final Runnable pagerRunnable = new Runnable() { @Override @@ -192,8 +195,9 @@ public class InCallFragment extends Fragment @Override public void onViewAttachedToWindow(View v) { View container = v.findViewById(R.id.incall_ui_container); - int topInset = v.getRootWindowInsets().getSystemWindowInsetTop(); - int bottomInset = v.getRootWindowInsets().getSystemWindowInsetBottom(); + Insets insets = v.getRootWindowInsets().getInsets(WindowInsets.Type.systemBars()); + int topInset = insets.top; + int bottomInset = insets.bottom; if (topInset != container.getPaddingTop()) { TransitionManager.beginDelayedTransition(((ViewGroup) container.getParent())); container.setPadding(0, topInset, 0, bottomInset); diff --git a/java/com/android/incallui/sessiondata/MultimediaFragment.java b/java/com/android/incallui/sessiondata/MultimediaFragment.java index f3747138c4..8e7ab8fd67 100644 --- a/java/com/android/incallui/sessiondata/MultimediaFragment.java +++ b/java/com/android/incallui/sessiondata/MultimediaFragment.java @@ -227,12 +227,12 @@ public class MultimediaFragment extends Fragment implements AvatarPresenter { @Nullable public Uri getImageUri() { - return getArguments().getParcelable(ARG_IMAGE); + return getArguments().getParcelable(ARG_IMAGE, Uri.class); } @Nullable public Location getLocation() { - return getArguments().getParcelable(ARG_LOCATION); + return getArguments().getParcelable(ARG_LOCATION, Location.class); } /** Interface for notifying the fragment parent of changes. */ diff --git a/java/com/android/incallui/video/impl/VideoCallFragment.java b/java/com/android/incallui/video/impl/VideoCallFragment.java index 5408af2433..1d8037f0e9 100644 --- a/java/com/android/incallui/video/impl/VideoCallFragment.java +++ b/java/com/android/incallui/video/impl/VideoCallFragment.java @@ -22,6 +22,7 @@ import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.Insets; import android.graphics.Outline; import android.graphics.Point; import android.graphics.drawable.Animatable; @@ -43,6 +44,7 @@ import android.view.View.OnSystemUiVisibilityChangeListener; import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; import android.view.ViewOutlineProvider; +import android.view.WindowInsets; import android.view.accessibility.AccessibilityEvent; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; @@ -524,14 +526,15 @@ public class VideoCallFragment extends Fragment if (getActivity().isInMultiWindowMode()) { return new Point(); } + Insets insets = getView().getRootWindowInsets().getInsets(WindowInsets.Type.systemBars()); if (isLandscape()) { int systemWindowInsetEnd = getView().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL - ? getView().getRootWindowInsets().getSystemWindowInsetLeft() - : -getView().getRootWindowInsets().getSystemWindowInsetRight(); + ? insets.left + : -insets.right; return new Point(systemWindowInsetEnd, 0); } else { - return new Point(0, -getView().getRootWindowInsets().getSystemWindowInsetBottom()); + return new Point(0, -insets.bottom); } } @@ -1041,7 +1044,7 @@ public class VideoCallFragment extends Fragment private boolean isLandscape() { // Choose orientation based on display orientation, not window orientation - int rotation = getActivity().getWindowManager().getDefaultDisplay().getRotation(); + int rotation = getActivity().getDisplay().getRotation(); return rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270; } diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java index d41d497bbc..9baef64797 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +19,7 @@ package com.android.incallui.videotech.ims; import android.content.Context; import android.os.Handler; +import android.os.Looper; import android.telecom.Call; import android.telecom.Connection; import android.telecom.Connection.VideoProvider; @@ -31,7 +33,7 @@ import com.android.incallui.videotech.utils.SessionModificationState; /** Receives IMS video call state updates. */ public class ImsVideoCallCallback extends VideoCall.Callback { private static final int CLEAR_FAILED_REQUEST_TIMEOUT_MILLIS = 4000; - private final Handler handler = new Handler(); + private final Handler handler = new Handler(Looper.getMainLooper()); private final Call call; private final ImsVideoTech videoTech; private final VideoTechListener listener; diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index 142f1e6434..f71f2fd698 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -238,7 +239,7 @@ public class ImsVideoTech implements VideoTech { @Override public void pause() { - if (call.getState() != Call.STATE_ACTIVE) { + if (call.getDetails().getState() != Call.STATE_ACTIVE) { LogUtil.i("ImsVideoTech.pause", "not pausing because call is not active"); return; } @@ -272,7 +273,7 @@ public class ImsVideoTech implements VideoTech { @Override public void unpause() { - if (call.getState() != Call.STATE_ACTIVE) { + if (call.getDetails().getState() != Call.STATE_ACTIVE) { LogUtil.i("ImsVideoTech.unpause", "not unpausing because call is not active"); return; } diff --git a/java/com/android/voicemail/impl/ActivationTask.java b/java/com/android/voicemail/impl/ActivationTask.java index 87970062bb..895f406032 100644 --- a/java/com/android/voicemail/impl/ActivationTask.java +++ b/java/com/android/voicemail/impl/ActivationTask.java @@ -102,7 +102,7 @@ public class ActivationTask extends BaseTask { @Override public void onCreate(Context context, Bundle extras) { super.onCreate(context, extras); - messageData = extras.getParcelable(EXTRA_MESSAGE_DATA_BUNDLE); + messageData = extras.getParcelable(EXTRA_MESSAGE_DATA_BUNDLE, Bundle.class); } @Override diff --git a/java/com/android/voicemail/impl/DeviceProvisionedJobService.java b/java/com/android/voicemail/impl/DeviceProvisionedJobService.java index 379ee507cb..80b8b6c8ca 100644 --- a/java/com/android/voicemail/impl/DeviceProvisionedJobService.java +++ b/java/com/android/voicemail/impl/DeviceProvisionedJobService.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +59,7 @@ public class DeviceProvisionedJobService extends JobService { VvmLog.i("DeviceProvisionedJobService.onStartJob", "device provisioned"); for (JobWorkItem item = params.dequeueWork(); item != null; item = params.dequeueWork()) { PhoneAccountHandle phoneAccountHandle = - item.getIntent().getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE); + item.getIntent().getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE, PhoneAccountHandle.class); VvmLog.i( "DeviceProvisionedJobService.onStartJob", "restarting activation for " + phoneAccountHandle); diff --git a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java index 9178bbe39d..c6110c9c8f 100644 --- a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java +++ b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java @@ -19,6 +19,7 @@ package com.android.voicemail.impl; import android.app.PendingIntent; import android.content.Context; import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.os.PersistableBundle; @@ -483,7 +484,8 @@ public class OmtpVvmCarrierConfigHelper { } for (String packageName : carrierPackages) { try { - ApplicationInfo info = getContext().getPackageManager().getApplicationInfo(packageName, 0); + ApplicationInfo info = getContext().getPackageManager().getApplicationInfo(packageName, + PackageManager.ApplicationInfoFlags.of(0)); if (!info.enabled) { continue; } diff --git a/java/com/android/voicemail/impl/imap/ImapHelper.java b/java/com/android/voicemail/impl/imap/ImapHelper.java index f2c2e5f26d..4ebba33d01 100644 --- a/java/com/android/voicemail/impl/imap/ImapHelper.java +++ b/java/com/android/voicemail/impl/imap/ImapHelper.java @@ -19,7 +19,7 @@ package com.android.voicemail.impl.imap; import android.content.Context; import android.net.ConnectivityManager; import android.net.Network; -import android.net.NetworkInfo; +import android.net.NetworkCapabilities; import android.telecom.PhoneAccountHandle; import android.util.Base64; @@ -145,11 +145,11 @@ public class ImapHelper implements Closeable { public boolean isRoaming() { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo info = connectivityManager.getNetworkInfo(network); - if (info == null) { + NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(network); + if (capabilities == null) { return false; } - return info.isRoaming(); + return !capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING); } public OmtpVvmCarrierConfigHelper getConfig() { diff --git a/java/com/android/voicemail/impl/scheduling/BaseTask.java b/java/com/android/voicemail/impl/scheduling/BaseTask.java index aaceefb4bd..96ebc8435f 100644 --- a/java/com/android/voicemail/impl/scheduling/BaseTask.java +++ b/java/com/android/voicemail/impl/scheduling/BaseTask.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -159,7 +160,7 @@ public abstract class BaseTask implements Task { public void onCreate(Context context, Bundle extras) { this.context = context; this.extras = extras; - phoneAccountHandle = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE); + phoneAccountHandle = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE, PhoneAccountHandle.class); for (Policy policy : policies) { policy.onCreate(this, extras); } diff --git a/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java b/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java index e71dca0db0..0bab169394 100644 --- a/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java +++ b/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,8 +50,9 @@ public class OmtpMessageReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { this.context = context; - VisualVoicemailSms sms = intent.getExtras().getParcelable(OmtpService.EXTRA_VOICEMAIL_SMS); - PhoneAccountHandle phone = sms.getPhoneAccountHandle(); + VisualVoicemailSms sms = intent.getExtras().getParcelable(OmtpService.EXTRA_VOICEMAIL_SMS, + VisualVoicemailSms.class); + PhoneAccountHandle phone = sms != null ? sms.getPhoneAccountHandle() : null; if (phone == null) { // This should never happen diff --git a/java/com/android/voicemail/impl/sync/SyncOneTask.java b/java/com/android/voicemail/impl/sync/SyncOneTask.java index a11a3c1bcf..95f4ceb238 100644 --- a/java/com/android/voicemail/impl/sync/SyncOneTask.java +++ b/java/com/android/voicemail/impl/sync/SyncOneTask.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,8 +58,8 @@ public class SyncOneTask extends BaseTask { @Override public void onCreate(Context context, Bundle extras) { super.onCreate(context, extras); - phone = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE); - voicemail = extras.getParcelable(EXTRA_VOICEMAIL); + phone = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE, PhoneAccountHandle.class); + voicemail = extras.getParcelable(EXTRA_VOICEMAIL, Voicemail.class); } @Override diff --git a/java/com/android/voicemail/impl/sync/SyncTask.java b/java/com/android/voicemail/impl/sync/SyncTask.java index 89d3c0b3c3..b04c43433e 100644 --- a/java/com/android/voicemail/impl/sync/SyncTask.java +++ b/java/com/android/voicemail/impl/sync/SyncTask.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +57,7 @@ public class SyncTask extends BaseTask { @Override public void onCreate(Context context, Bundle extras) { super.onCreate(context, extras); - phone = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE); + phone = extras.getParcelable(EXTRA_PHONE_ACCOUNT_HANDLE, PhoneAccountHandle.class); } @Override -- GitLab From 723f3edbaf45c3e4eb501846f5c255212853d20b Mon Sep 17 00:00:00 2001 From: Michael W Date: Sat, 21 Oct 2023 22:55:37 +0200 Subject: [PATCH 08/36] Dialer: Replace widgets with their AppCompat variants Change-Id: I83253cf2bb691ae57ca0851bd3e6ac5535feb232 --- .../common/widget/LayoutSuppressingImageView.java | 10 +++++++--- .../dialer/voicemail/settings/RecordButton.java | 4 ++-- java/com/android/dialer/widget/BidiTextView.java | 7 ++++--- .../android/dialer/widget/ResizingTextEditText.java | 7 +++++-- .../answer/impl/affordance/SwipeButtonView.java | 10 +++------- .../incallui/autoresizetext/AutoResizeTextView.java | 11 +++-------- .../incallui/rtt/impl/RttCheckableButton.java | 13 +++++-------- .../incallui/video/impl/CheckableImageButton.java | 6 ++++-- 8 files changed, 33 insertions(+), 35 deletions(-) diff --git a/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java b/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java index d84d8f7573..423881541b 100644 --- a/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java +++ b/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,22 +17,25 @@ package com.android.contacts.common.widget; +import android.annotation.SuppressLint; import android.content.Context; import android.util.AttributeSet; -import android.widget.ImageView; + +import androidx.appcompat.widget.AppCompatImageView; /** - * Custom {@link ImageView} that improves layouting performance. + * Custom {@link AppCompatImageView} that improves layouting performance. * *

This improves the performance by not passing requestLayout() to its parent, taking advantage * of knowing that image size won't change once set. */ -public class LayoutSuppressingImageView extends ImageView { +public class LayoutSuppressingImageView extends AppCompatImageView { public LayoutSuppressingImageView(Context context, AttributeSet attrs) { super(context, attrs); } + @SuppressLint("MissingSuperCall") @Override public void requestLayout() { forceLayout(); diff --git a/java/com/android/dialer/voicemail/settings/RecordButton.java b/java/com/android/dialer/voicemail/settings/RecordButton.java index 6c9a954201..6409dd4c88 100644 --- a/java/com/android/dialer/voicemail/settings/RecordButton.java +++ b/java/com/android/dialer/voicemail/settings/RecordButton.java @@ -26,15 +26,15 @@ import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; -import android.widget.Button; +import androidx.appcompat.widget.AppCompatButton; import androidx.core.content.ContextCompat; import com.android.dialer.R; import com.android.dialer.voicemail.settings.RecordVoicemailGreetingActivity.ButtonState; /** Custom Button View for Dialer voicemail greeting recording */ -public class RecordButton extends Button { +public class RecordButton extends AppCompatButton { private final float trackWidth = getResources().getDimensionPixelSize(R.dimen.track_width); private final int centerIconRadius = diff --git a/java/com/android/dialer/widget/BidiTextView.java b/java/com/android/dialer/widget/BidiTextView.java index ab1cdff3dd..4d4a99079c 100644 --- a/java/com/android/dialer/widget/BidiTextView.java +++ b/java/com/android/dialer/widget/BidiTextView.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +19,14 @@ package com.android.dialer.widget; import android.content.Context; import android.util.AttributeSet; -import android.widget.TextView; import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatTextView; import com.android.dialer.i18n.DialerBidiFormatter; -/** A {@link TextView} that applies bidirectional formatting to its text. */ -public final class BidiTextView extends TextView { +/** An {@link AppCompatTextView} that applies bidirectional formatting to its text. */ +public final class BidiTextView extends AppCompatTextView { public BidiTextView(Context context) { super(context); diff --git a/java/com/android/dialer/widget/ResizingTextEditText.java b/java/com/android/dialer/widget/ResizingTextEditText.java index 16b755241e..a00638d7bc 100644 --- a/java/com/android/dialer/widget/ResizingTextEditText.java +++ b/java/com/android/dialer/widget/ResizingTextEditText.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +20,13 @@ package com.android.dialer.widget; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; -import android.widget.EditText; + +import androidx.appcompat.widget.AppCompatEditText; + import com.android.dialer.util.ViewUtil; /** EditText which resizes dynamically with respect to text length. */ -public class ResizingTextEditText extends EditText { +public class ResizingTextEditText extends AppCompatEditText { private final int originalTextSize; private final int minTextSize; diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java index 133e7148d6..c6a5b712c0 100644 --- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java +++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java @@ -32,16 +32,16 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewAnimationUtils; import android.view.animation.Interpolator; -import android.widget.ImageView; import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatImageView; import com.android.dialer.R; import com.android.incallui.answer.impl.utils.FlingAnimationUtils; import com.android.incallui.answer.impl.utils.Interpolators; /** Button that allows swiping to trigger */ -public class SwipeButtonView extends ImageView { +public class SwipeButtonView extends AppCompatImageView { private static final long CIRCLE_APPEAR_DURATION = 80; private static final long CIRCLE_DISAPPEAR_MAX_DURATION = 200; @@ -112,11 +112,7 @@ public class SwipeButtonView extends ImageView { } public SwipeButtonView(Context context, AttributeSet attrs, int defStyleAttr) { - this(context, attrs, defStyleAttr, 0); - } - - public SwipeButtonView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); + super(context, attrs, defStyleAttr); circlePaint = new Paint(); circlePaint.setAntiAlias(true); circleColor = 0xffffffff; diff --git a/java/com/android/incallui/autoresizetext/AutoResizeTextView.java b/java/com/android/incallui/autoresizetext/AutoResizeTextView.java index 17091037c0..7784ce61e9 100644 --- a/java/com/android/incallui/autoresizetext/AutoResizeTextView.java +++ b/java/com/android/incallui/autoresizetext/AutoResizeTextView.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +27,9 @@ import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.SparseIntArray; import android.util.TypedValue; -import android.widget.TextView; import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatTextView; import com.android.dialer.R; @@ -40,7 +41,7 @@ import com.android.dialer.R; * found yet. A known workaround is the solution provided on StackOverflow: * http://stackoverflow.com/a/5535672 */ -public class AutoResizeTextView extends TextView { +public class AutoResizeTextView extends AppCompatTextView { private static final int NO_LINE_LIMIT = -1; private static final float DEFAULT_MIN_TEXT_SIZE = 16.0f; private static final int DEFAULT_RESIZE_STEP_UNIT = TypedValue.COMPLEX_UNIT_PX; @@ -69,12 +70,6 @@ public class AutoResizeTextView extends TextView { initialize(context, attrs, defStyleAttr, 0); } - public AutoResizeTextView( - Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - initialize(context, attrs, defStyleAttr, defStyleRes); - } - private void initialize( Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { TypedArray typedArray = context.getTheme().obtainStyledAttributes( diff --git a/java/com/android/incallui/rtt/impl/RttCheckableButton.java b/java/com/android/incallui/rtt/impl/RttCheckableButton.java index c0c8599a4a..5bb86001a4 100644 --- a/java/com/android/incallui/rtt/impl/RttCheckableButton.java +++ b/java/com/android/incallui/rtt/impl/RttCheckableButton.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,11 +23,12 @@ import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; import android.view.SoundEffectConstants; -import android.widget.Button; import android.widget.Checkable; +import androidx.appcompat.widget.AppCompatButton; + /** Image button that maintains a checked state. */ -public class RttCheckableButton extends Button implements Checkable { +public class RttCheckableButton extends AppCompatButton implements Checkable { private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked}; @@ -51,12 +53,7 @@ public class RttCheckableButton extends Button implements Checkable { } public RttCheckableButton(Context context, AttributeSet attrs, int defStyleAttr) { - this(context, attrs, defStyleAttr, 0); - } - - public RttCheckableButton( - Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); + super(context, attrs, defStyleAttr); init(context, attrs); } diff --git a/java/com/android/incallui/video/impl/CheckableImageButton.java b/java/com/android/incallui/video/impl/CheckableImageButton.java index 320f0571a3..6be86f5c83 100644 --- a/java/com/android/incallui/video/impl/CheckableImageButton.java +++ b/java/com/android/incallui/video/impl/CheckableImageButton.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +24,11 @@ import android.os.Parcelable; import android.util.AttributeSet; import android.view.SoundEffectConstants; import android.widget.Checkable; -import android.widget.ImageButton; + +import androidx.appcompat.widget.AppCompatImageButton; /** Image button that maintains a checked state. */ -public class CheckableImageButton extends ImageButton implements Checkable { +public class CheckableImageButton extends AppCompatImageButton implements Checkable { private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked}; -- GitLab From f0606d769ca1f35aa3d43b90c40a4ea4f14d3343 Mon Sep 17 00:00:00 2001 From: Michael W Date: Sat, 21 Oct 2023 23:26:50 +0200 Subject: [PATCH 09/36] Dialer: Request permissions and launch activities the modern way We are supposed to use ActivityResultLaunchers nowadays Change-Id: I3888e53e3f1d57c1dab8d62989623b6081d75a82 --- .../dialer/app/calllog/CallLogFragment.java | 27 +++--- .../calllog/CallLogListItemViewHolder.java | 4 +- .../dialer/callstats/CallStatsFragment.java | 30 +++--- .../constants/ActivityRequestCodes.java | 37 -------- .../contactsfragment/ContactsFragment.java | 28 +++--- .../interactions/PhoneNumberInteraction.java | 26 ++---- .../android/dialer/main/MainActivityPeer.java | 2 - .../main/impl/DefaultDialerActivity.java | 25 ++--- .../dialer/main/impl/MainActivity.java | 6 -- .../main/impl/MainSearchController.java | 12 ++- .../dialer/main/impl/OldMainActivityPeer.java | 18 ---- .../dialer/postcall/PostCallActivity.java | 26 ++---- .../list/NewSearchFragment.java | 49 +++++----- .../dialer/shortcuts/CallContactActivity.java | 42 +++------ .../dialer/speeddial/SpeedDialFragment.java | 91 ++++++++++--------- .../CurrentVoicemailGreetingActivity.java | 36 +++----- .../incallui/incall/impl/InCallFragment.java | 29 +++--- .../impl/SurfaceViewVideoCallFragment.java | 37 ++++---- .../video/impl/VideoCallFragment.java | 32 +++---- 19 files changed, 221 insertions(+), 336 deletions(-) delete mode 100644 java/com/android/dialer/constants/ActivityRequestCodes.java diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index 04adc6c2ce..9aa1af630d 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -39,6 +39,8 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.CallSuper; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -93,8 +95,6 @@ public class CallLogFragment extends Fragment // No date-based filtering. private static final int NO_DATE_LIMIT = 0; - private static final int PHONE_PERMISSIONS_REQUEST_CODE = 1; - private static final int EVENT_UPDATE_DISPLAY = 1; private static final long MILLIS_IN_MINUTE = 60 * 1000; @@ -155,6 +155,15 @@ public class CallLogFragment extends Fragment protected CallLogModalAlertManager modalAlertManager; private ViewGroup modalAlertView; + private final ActivityResultLauncher permissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestMultiplePermissions(), + grantResults -> { + if (grantResults.size() >= 1 && grantResults.values().iterator().next()) { + // Force a refresh of the data since we were missing the permission before this. + refreshDataRequired = true; + } + }); + public CallLogFragment() { this(CallLogQueryHandler.CALL_TYPE_ALL, NO_LOG_LIMIT); } @@ -561,25 +570,13 @@ public class CallLogFragment extends Fragment LogUtil.i( "CallLogFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - requestPermissions(deniedPermissions, PHONE_PERMISSIONS_REQUEST_CODE); + permissionLauncher.launch(deniedPermissions); } else if (!isCallLogActivity) { LogUtil.i("CallLogFragment.onEmptyViewActionButtonClicked", "showing dialpad"); // Show dialpad if we are not in the call log activity. FragmentUtils.getParentUnsafe(this, HostInterface.class).showDialpad(); } } - //TODO: BadDaemon: Reimplement this -/* - @Override - public void onRequestPermissionsResult( - int requestCode, String[] permissions, int[] grantResults) { - if (requestCode == PHONE_PERMISSIONS_REQUEST_CODE) { - if (grantResults.length >= 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) { - // Force a refresh of the data since we were missing the permission before this. - refreshDataRequired = true; - } - } - }*/ /** Schedules an update to the relative call times (X mins ago). */ private void rescheduleDisplayUpdate() { diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 08c5b3014e..76622ca1b6 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -72,7 +72,6 @@ import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction; import com.android.dialer.clipboard.ClipboardUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.AsyncTaskExecutors; -import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.dialercontact.SimDetails; @@ -898,8 +897,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder return; } if (OldCallDetailsActivity.isLaunchIntent(intent)) { - ((Activity) context) - .startActivityForResult(intent, ActivityRequestCodes.DIALTACTS_CALL_DETAILS); + ((Activity) context).startActivity(intent); } else { if (Intent.ACTION_CALL.equals(intent.getAction()) && intent.getIntExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, -1) diff --git a/java/com/android/dialer/callstats/CallStatsFragment.java b/java/com/android/dialer/callstats/CallStatsFragment.java index 95f7df4f86..2941b0f57a 100644 --- a/java/com/android/dialer/callstats/CallStatsFragment.java +++ b/java/com/android/dialer/callstats/CallStatsFragment.java @@ -22,7 +22,6 @@ import static android.Manifest.permission.READ_CALL_LOG; import android.content.ContentResolver; import android.content.Context; -import android.content.pm.PackageManager; import android.database.ContentObserver; import android.os.Bundle; import android.os.Handler; @@ -39,6 +38,8 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; @@ -60,8 +61,6 @@ public class CallStatsFragment extends Fragment implements DoubleDatePickerDialog.OnDateSetListener { private static final String TAG = "CallStatsFragment"; - private static final int READ_CALL_LOG_PERMISSION_REQUEST_CODE = 1; - private PhoneAccountHandle mAccountFilter = null; private int mCallTypeFilter = -1; private long mFilterFrom = -1; @@ -90,6 +89,16 @@ public class CallStatsFragment extends Fragment implements } }; + private final ActivityResultLauncher permissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestPermission(), + granted -> { + if (granted) { + // Force a refresh of the data since we were missing the permission before this. + mRefreshDataRequired = true; + requireActivity().invalidateOptionsMenu(); + } + }); + @Override public void onCreate(Bundle state) { super.onCreate(state); @@ -201,20 +210,7 @@ public class CallStatsFragment extends Fragment implements @Override public void onEmptyViewActionButtonClicked() { if (!PermissionsUtil.hasPermission(getActivity(), READ_CALL_LOG)) { - requestPermissions(new String[] { READ_CALL_LOG }, - READ_CALL_LOG_PERMISSION_REQUEST_CODE); - } - } - - @Override - public void onRequestPermissionsResult(int requestCode, String[] permissions, - int[] grantResults) { - if (requestCode == READ_CALL_LOG_PERMISSION_REQUEST_CODE) { - if (grantResults.length >= 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) { - // Force a refresh of the data since we were missing the permission before this. - mRefreshDataRequired = true; - getActivity().invalidateOptionsMenu(); - } + permissionLauncher.launch(READ_CALL_LOG); } } diff --git a/java/com/android/dialer/constants/ActivityRequestCodes.java b/java/com/android/dialer/constants/ActivityRequestCodes.java deleted file mode 100644 index 12b7263fc8..0000000000 --- a/java/com/android/dialer/constants/ActivityRequestCodes.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.dialer.constants; - -/** - * Class containing {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)} - * request codes. - */ -public final class ActivityRequestCodes { - - private ActivityRequestCodes() {} - - /** Request code for {@link android.speech.RecognizerIntent#ACTION_RECOGNIZE_SPEECH} intent. */ - public static final int DIALTACTS_VOICE_SEARCH = 1; - - /** Request code for {@link com.android.dialer.calldetails.OldCallDetailsActivity} intent. */ - public static final int DIALTACTS_CALL_DETAILS = 4; - - /** - * Request code for {@link com.android.dialer.speeddial.SpeedDialFragment} contact picker intent. - */ - public static final int SPEED_DIAL_ADD_FAVORITE = 5; -} diff --git a/java/com/android/dialer/contactsfragment/ContactsFragment.java b/java/com/android/dialer/contactsfragment/ContactsFragment.java index 46d4287c08..6dbbbad5f2 100644 --- a/java/com/android/dialer/contactsfragment/ContactsFragment.java +++ b/java/com/android/dialer/contactsfragment/ContactsFragment.java @@ -22,7 +22,6 @@ import static android.Manifest.permission.READ_CONTACTS; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; @@ -33,6 +32,8 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; @@ -70,8 +71,6 @@ public class ContactsFragment extends Fragment int ADD_CONTACT = 1; } - public static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1; - private static final String EXTRA_HEADER = "extra_header"; private static final String EXTRA_HAS_PHONE_NUMBERS = "extra_has_phone_numbers"; @@ -87,6 +86,16 @@ public class ContactsFragment extends Fragment } }; + private final ActivityResultLauncher permissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestMultiplePermissions(), + grantResults -> { + if (grantResults.size() >= 1 && grantResults.values().iterator().next()) { + String key = grantResults.keySet().iterator().next(); + // Force a refresh of the data since we were missing the permission before this. + PermissionsUtil.notifyPermissionGranted(getContext(), key); + } + }); + private FastScroller fastScroller; private TextView anchoredHeader; private RecyclerView recyclerView; @@ -303,7 +312,7 @@ public class ContactsFragment extends Fragment LogUtil.i( "ContactsFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - requestPermissions(deniedPermissions, READ_CONTACTS_PERMISSION_REQUEST_CODE); + permissionLauncher.launch(deniedPermissions); } } else if (emptyContentView.getActionLabel() @@ -316,17 +325,6 @@ public class ContactsFragment extends Fragment } } - @Override - public void onRequestPermissionsResult( - int requestCode, String[] permissions, int[] grantResults) { - if (requestCode == READ_CONTACTS_PERMISSION_REQUEST_CODE) { - if (grantResults.length >= 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) { - // Force a refresh of the data since we were missing the permission before this. - PermissionsUtil.notifyPermissionGranted(getContext(), permissions[0]); - } - } - } - @Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); diff --git a/java/com/android/dialer/interactions/PhoneNumberInteraction.java b/java/com/android/dialer/interactions/PhoneNumberInteraction.java index 98c6864956..46448017a0 100644 --- a/java/com/android/dialer/interactions/PhoneNumberInteraction.java +++ b/java/com/android/dialer/interactions/PhoneNumberInteraction.java @@ -42,8 +42,8 @@ import android.widget.CheckBox; import android.widget.ListAdapter; import android.widget.TextView; +import androidx.activity.result.ActivityResultLauncher; import androidx.annotation.IntDef; -import androidx.core.app.ActivityCompat; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; @@ -84,10 +84,6 @@ import java.util.List; public class PhoneNumberInteraction implements Loader.OnLoadCompleteListener { static final String TAG = PhoneNumberInteraction.class.getSimpleName(); - /** The identifier for a permissions request if one is generated. */ - public static final int REQUEST_READ_CONTACTS = 1; - - public static final int REQUEST_CALL_PHONE = 2; private static final String[] PHONE_NUMBER_PROJECTION = new String[] { @@ -168,7 +164,6 @@ public class PhoneNumberInteraction implements Loader.OnLoadCompleteListener permissionLauncher) { new PhoneNumberInteraction( activity, ContactDisplayUtils.INTERACTION_CALL, isVideoCall, callSpecificAppData) - .startInteraction(uri); + .startInteraction(uri, permissionLauncher); } private void performAction(String phoneNumber) { @@ -221,14 +217,13 @@ public class PhoneNumberInteraction implements Loader.OnLoadCompleteListener permissionLauncher) { // It's possible for a shortcut to have been created, and then permissions revoked. To avoid a // crash when the user tries to use such a shortcut, check for this condition and ask the user // for the permission. if (!PermissionsUtil.hasPhonePermissions(context)) { LogUtil.i("PhoneNumberInteraction.startInteraction", "Need phone permission: CALL_PHONE"); - ActivityCompat.requestPermissions( - (Activity) context, new String[] {permission.CALL_PHONE}, REQUEST_CALL_PHONE); + permissionLauncher.launch(new String[] {permission.CALL_PHONE}); return; } @@ -239,8 +234,7 @@ public class PhoneNumberInteraction implements Loader.OnLoadCompleteListener mDefaultDialerLauncher = registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), result -> { + if (result.getResultCode() == RESULT_OK) { + finish(); + } + }); + @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.MainActivityTheme); @@ -53,17 +59,6 @@ public class DefaultDialerActivity extends AppCompatActivity implements Intent roleRequest = mRoleManager.createRequestRoleIntent(RoleManager.ROLE_DIALER); roleRequest.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, getPackageName()); - startActivityForResult(roleRequest, REQUEST_DEFAULT_DIALER); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - if (requestCode == REQUEST_DEFAULT_DIALER) { - if (resultCode == Activity.RESULT_OK) { - finish(); - } - } + mDefaultDialerLauncher.launch(roleRequest); } } diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java index d8cd6791ce..380995b398 100644 --- a/java/com/android/dialer/main/impl/MainActivity.java +++ b/java/com/android/dialer/main/impl/MainActivity.java @@ -105,12 +105,6 @@ public class MainActivity extends TransactionSafeActivity activePeer.onSaveInstanceState(bundle); } - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - activePeer.onActivityResult(requestCode, resultCode, data); - } - @Override public void onBackPressed() { if (activePeer.onBackPressed()) { diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java index fe5cd41314..1462368703 100644 --- a/java/com/android/dialer/main/impl/MainSearchController.java +++ b/java/com/android/dialer/main/impl/MainSearchController.java @@ -28,6 +28,8 @@ import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; import android.widget.Toast; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.AttrRes; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -40,7 +42,6 @@ import com.android.dialer.app.calllog.CallLogActivity; import com.android.dialer.app.settings.DialerSettingsActivity; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.common.LogUtil; -import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.dialpadview.DialpadFragment; import com.android.dialer.dialpadview.DialpadFragment.DialpadListener; import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListener; @@ -104,6 +105,8 @@ public class MainSearchController implements SearchBarListener { private DialpadFragment dialpadFragment; private NewSearchFragment searchFragment; + private final ActivityResultLauncher mVoiceSearchLauncher; + public MainSearchController( TransactionSafeActivity activity, BottomNavBar bottomNav, @@ -120,6 +123,11 @@ public class MainSearchController implements SearchBarListener { .findFragmentByTag(DIALPAD_FRAGMENT_TAG); searchFragment = (NewSearchFragment) activity.getSupportFragmentManager() .findFragmentByTag(SEARCH_FRAGMENT_TAG); + + mVoiceSearchLauncher = activity.registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), result -> { + onVoiceResults(result.getResultCode(), result.getData()); + }); } /** Should be called if we're showing the dialpad because of a new ACTION_DIAL intent. */ @@ -440,7 +448,7 @@ public class MainSearchController implements SearchBarListener { public void onVoiceButtonClicked(VoiceSearchResultCallback voiceSearchResultCallback) { try { Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); - activity.startActivityForResult(voiceIntent, ActivityRequestCodes.DIALTACTS_VOICE_SEARCH); + mVoiceSearchLauncher.launch(voiceIntent); } catch (ActivityNotFoundException e) { Toast.makeText(activity, R.string.voice_search_not_available, Toast.LENGTH_SHORT).show(); } diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index d27c4eb7f3..c2c1b4ad49 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -60,7 +60,6 @@ import com.android.dialer.common.FragmentUtils.FragmentUtilListener; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.SupportUiListener; -import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.contactsfragment.ContactsFragment; import com.android.dialer.contactsfragment.ContactsFragment.Header; import com.android.dialer.contactsfragment.ContactsFragment.OnContactSelectedListener; @@ -468,23 +467,6 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen searchController.onSaveInstanceState(bundle); } - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - LogUtil.i( - "OldMainActivityPeer.onActivityResult", - "requestCode:%d, resultCode:%d", - requestCode, - resultCode); - if (requestCode == ActivityRequestCodes.DIALTACTS_VOICE_SEARCH) { - searchController.onVoiceResults(resultCode, data); - } else if (requestCode == ActivityRequestCodes.DIALTACTS_CALL_DETAILS) { - // ignored - - } else { - LogUtil.e("OldMainActivityPeer.onActivityResult", "Unknown request code: " + requestCode); - } - } - @Override public boolean onBackPressed() { LogUtil.enterBlock("OldMainActivityPeer.onBackPressed"); diff --git a/java/com/android/dialer/postcall/PostCallActivity.java b/java/com/android/dialer/postcall/PostCallActivity.java index 000ee54f83..6988ad032b 100644 --- a/java/com/android/dialer/postcall/PostCallActivity.java +++ b/java/com/android/dialer/postcall/PostCallActivity.java @@ -20,12 +20,13 @@ package com.android.dialer.postcall; import android.Manifest.permission; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.provider.Settings; import android.telephony.SmsManager; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -43,7 +44,13 @@ public class PostCallActivity extends AppCompatActivity implements MessageFragme public static final String KEY_PHONE_NUMBER = "phone_number"; public static final String KEY_MESSAGE = "message"; public static final String KEY_RCS_POST_CALL = "rcs_post_call"; - private static final int REQUEST_CODE_SEND_SMS = 1; + + private final ActivityResultLauncher smsPermissionLauncher = + registerForActivityResult(new ActivityResultContracts.RequestPermission(), + grantResult -> { + PermissionsUtil.permissionRequested(this, permission.SEND_SMS); + onMessageFragmentSendMessage(getIntent().getStringExtra(KEY_MESSAGE)); + }); private boolean useRcs; @@ -105,7 +112,7 @@ public class PostCallActivity extends AppCompatActivity implements MessageFragme } else if (PermissionsUtil.isFirstRequest(this, permission.SEND_SMS) || shouldShowRequestPermissionRationale(permission.SEND_SMS)) { LogUtil.i("PostCallActivity.sendMessage", "Requesting SMS_SEND permission."); - requestPermissions(new String[] {permission.SEND_SMS}, REQUEST_CODE_SEND_SMS); + smsPermissionLauncher.launch(permission.SEND_SMS); } else { LogUtil.i( "PostCallActivity.sendMessage", "Permission permanently denied, sending to settings."); @@ -119,17 +126,4 @@ public class PostCallActivity extends AppCompatActivity implements MessageFragme @Override public void onMessageFragmentAfterTextChange(String message) {} - - @Override - public void onRequestPermissionsResult( - int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - if (permissions.length > 0 && permissions[0].equals(permission.SEND_SMS)) { - PermissionsUtil.permissionRequested(this, permissions[0]); - } - if (requestCode == REQUEST_CODE_SEND_SMS - && grantResults.length > 0 - && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - onMessageFragmentSendMessage(getIntent().getStringExtra(KEY_MESSAGE)); - } - } } diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java index fca096b2ad..8edf4e309d 100644 --- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java +++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java @@ -19,7 +19,6 @@ package com.android.dialer.searchfragment.list; import static android.Manifest.permission.ACCESS_FINE_LOCATION; -import android.content.pm.PackageManager; import android.database.Cursor; import android.os.Bundle; import android.telephony.PhoneNumberUtils; @@ -33,7 +32,8 @@ import android.view.animation.Interpolator; import android.widget.FrameLayout; import android.widget.FrameLayout.LayoutParams; -import androidx.annotation.NonNull; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.loader.app.LoaderManager; @@ -85,9 +85,6 @@ public final class NewSearchFragment extends Fragment private static final String KEY_LOCATION_PROMPT_DISMISSED = "search_location_prompt_dismissed"; - private static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1; - private static final int LOCATION_PERMISSION_REQUEST_CODE = 2; - private static final int CONTACTS_LOADER_ID = 0; private static final int NEARBY_PLACES_LOADER_ID = 1; @@ -133,6 +130,26 @@ public final class NewSearchFragment extends Fragment private Runnable updatePositionRunnable; + private final ActivityResultLauncher contactPermissionLauncher = + registerForActivityResult(new ActivityResultContracts.RequestMultiplePermissions(), + grantResults -> { + if (grantResults.size() >= 1 && grantResults.values().iterator().next()) { + // Force a refresh of the data since we were missing the permission before this. + emptyContentView.setVisibility(View.GONE); + initLoaders(); + } + }); + + private final ActivityResultLauncher locationPermissionLauncher = + registerForActivityResult(new ActivityResultContracts.RequestMultiplePermissions(), + grantResults -> { + if (grantResults.size() >= 1 && grantResults.values().iterator().next()) { + // Force a refresh of the data since we were missing the permission before this. + loadNearbyPlacesCursor(); + adapter.hideLocationPermissionRequest(); + } + }); + public static NewSearchFragment newInstance() { return new NewSearchFragment(); } @@ -329,24 +346,6 @@ public final class NewSearchFragment extends Fragment ThreadUtil.getUiThreadHandler().removeCallbacks(capabilitiesUpdatedRunnable); } - @Override - public void onRequestPermissionsResult( - int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - if (requestCode == READ_CONTACTS_PERMISSION_REQUEST_CODE) { - if (grantResults.length >= 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) { - // Force a refresh of the data since we were missing the permission before this. - emptyContentView.setVisibility(View.GONE); - initLoaders(); - } - } else if (requestCode == LOCATION_PERMISSION_REQUEST_CODE) { - if (grantResults.length >= 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) { - // Force a refresh of the data since we were missing the permission before this. - loadNearbyPlacesCursor(); - adapter.hideLocationPermissionRequest(); - } - } - } - @Override public void onEmptyViewActionButtonClicked() { String[] deniedPermissions = @@ -357,7 +356,7 @@ public final class NewSearchFragment extends Fragment "NewSearchFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); FragmentUtils.getParentUnsafe(this, SearchFragmentListener.class).requestingPermission(); - requestPermissions(deniedPermissions, READ_CONTACTS_PERMISSION_REQUEST_CODE); + contactPermissionLauncher.launch(deniedPermissions); } } @@ -420,7 +419,7 @@ public final class NewSearchFragment extends Fragment PermissionsUtil.getPermissionsCurrentlyDenied( getContext(), PermissionsUtil.allLocationGroupPermissionsUsedInDialer); FragmentUtils.getParentUnsafe(this, SearchFragmentListener.class).requestingPermission(); - requestPermissions(deniedPermissions, LOCATION_PERMISSION_REQUEST_CODE); + locationPermissionLauncher.launch(deniedPermissions); } public void dismissLocationPermission() { diff --git a/java/com/android/dialer/shortcuts/CallContactActivity.java b/java/com/android/dialer/shortcuts/CallContactActivity.java index 87fe5e6d76..585ab0cd2d 100644 --- a/java/com/android/dialer/shortcuts/CallContactActivity.java +++ b/java/com/android/dialer/shortcuts/CallContactActivity.java @@ -17,14 +17,15 @@ package com.android.dialer.shortcuts; -import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.widget.Toast; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; -import androidx.core.app.ActivityCompat; +import android.widget.Toast; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.common.LogUtil; @@ -37,11 +38,20 @@ import com.android.dialer.util.TransactionSafeActivity; */ public class CallContactActivity extends TransactionSafeActivity implements PhoneNumberInteraction.DisambigDialogDismissedListener, - PhoneNumberInteraction.InteractionErrorListener, - ActivityCompat.OnRequestPermissionsResultCallback { + PhoneNumberInteraction.InteractionErrorListener { private static final String CONTACT_URI_KEY = "uri_key"; + private final ActivityResultLauncher permissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestMultiplePermissions(), grantResults -> { + if (grantResults.values().iterator().next()) { + makeCall(); + } else { + Toast.makeText(this, R.string.dialer_shortcut_no_permissions, Toast.LENGTH_SHORT).show(); + finish(); + } + }); + private Uri contactUri; @Override @@ -73,7 +83,7 @@ public class CallContactActivity extends TransactionSafeActivity .setCallInitiationType(CallInitiationType.Type.LAUNCHER_SHORTCUT) .build(); PhoneNumberInteraction.startInteractionForPhoneCall( - this, contactUri, false /* isVideoCall */, callSpecificAppData); + this, contactUri, false /* isVideoCall */, callSpecificAppData, permissionLauncher); } @Override @@ -122,26 +132,4 @@ public class CallContactActivity extends TransactionSafeActivity } contactUri = savedInstanceState.getParcelable(CONTACT_URI_KEY, Uri.class); } - - @Override - public void onRequestPermissionsResult( - int requestCode, String[] permissions, int[] grantResults) { - switch (requestCode) { - case PhoneNumberInteraction.REQUEST_READ_CONTACTS: - case PhoneNumberInteraction.REQUEST_CALL_PHONE: - { - // If request is cancelled, the result arrays are empty. - if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - makeCall(); - } else { - Toast.makeText(this, R.string.dialer_shortcut_no_permissions, Toast.LENGTH_SHORT) - .show(); - finish(); - } - break; - } - default: - throw new IllegalStateException("Unsupported request code: " + requestCode); - } - } } diff --git a/java/com/android/dialer/speeddial/SpeedDialFragment.java b/java/com/android/dialer/speeddial/SpeedDialFragment.java index 99ae3a4a2a..462f817373 100644 --- a/java/com/android/dialer/speeddial/SpeedDialFragment.java +++ b/java/com/android/dialer/speeddial/SpeedDialFragment.java @@ -17,11 +17,12 @@ package com.android.dialer.speeddial; +import static android.app.Activity.RESULT_OK; + import android.Manifest; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageManager; import android.database.ContentObserver; import android.net.Uri; import android.os.Bundle; @@ -32,9 +33,9 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import androidx.annotation.NonNull; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; @@ -51,7 +52,6 @@ import com.android.dialer.common.concurrent.DefaultFutureCallback; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.SupportUiListener; import com.android.dialer.common.concurrent.ThreadUtil; -import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.historyitemactions.DividerModule; import com.android.dialer.historyitemactions.HistoryItemActionBottomSheet; import com.android.dialer.historyitemactions.HistoryItemActionModule; @@ -91,8 +91,6 @@ import java.util.List; */ public class SpeedDialFragment extends Fragment { - private static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1; - /** * Listen to broadcast events about permissions in order to be notified if the READ_CONTACTS * permission is granted via the UI in another fragment. @@ -130,6 +128,33 @@ public class SpeedDialFragment extends Fragment { */ private boolean updateSpeedDialItemsOnResume = true; + private final ActivityResultLauncher contactPermissionLauncher = + registerForActivityResult(new ActivityResultContracts.RequestMultiplePermissions(), + grantResults -> { + if (grantResults.size() >= 1 && grantResults.values().iterator().next()) { + PermissionsUtil.notifyPermissionGranted(getContext(), + Manifest.permission.READ_CONTACTS); + loadContacts(); + } + }); + + private final ActivityResultLauncher addFavoriteLauncher = registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), result -> { + Intent data = result.getData(); + if (result.getResultCode() == RESULT_OK && data != null && data.getData() != null) { + updateSpeedDialItemsOnResume = false; + speedDialLoaderListener.listen( + getContext(), + UiItemLoaderComponent.get(requireContext()) + .speedDialUiItemMutator() + .starContact(data.getData()), + this::onSpeedDialUiItemListLoaded, + throwable -> { + throw new RuntimeException(throwable); + }); + } + }); + public static SpeedDialFragment newInstance() { return new SpeedDialFragment(); } @@ -223,17 +248,6 @@ public class SpeedDialFragment extends Fragment { ShortcutRefresher.speedDialUiItemsToContactEntries(adapter.getSpeedDialUiItems())); } - @Override - public void onRequestPermissionsResult( - int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - if (requestCode == READ_CONTACTS_PERMISSION_REQUEST_CODE - && grantResults.length > 0 - && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - PermissionsUtil.notifyPermissionGranted(getContext(), Manifest.permission.READ_CONTACTS); - loadContacts(); - } - } - private void loadContacts() { if (!updateSpeedDialItemsOnResume) { updateSpeedDialItemsOnResume = true; @@ -253,24 +267,6 @@ public class SpeedDialFragment extends Fragment { }); } - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == ActivityRequestCodes.SPEED_DIAL_ADD_FAVORITE) { - if (resultCode == AppCompatActivity.RESULT_OK && data.getData() != null) { - updateSpeedDialItemsOnResume = false; - speedDialLoaderListener.listen( - getContext(), - UiItemLoaderComponent.get(getContext()) - .speedDialUiItemMutator() - .starContact(data.getData()), - this::onSpeedDialUiItemListLoaded, - throwable -> { - throw new RuntimeException(throwable); - }); - } - } - } - private void onSpeedDialUiItemListLoaded(ImmutableList speedDialUiItems) { LogUtil.enterBlock("SpeedDialFragment.onSpeedDialUiItemListLoaded"); // TODO(calderwoodra): Use DiffUtil to properly update and animate the change @@ -295,7 +291,8 @@ public class SpeedDialFragment extends Fragment { emptyContentView.setActionLabel(R.string.speed_dial_turn_on_contacts_permission); emptyContentView.setDescription(R.string.speed_dial_contacts_permission_description); emptyContentView.setActionClickedListener( - new SpeedDialContactPermissionEmptyViewListener(getContext(), this)); + new SpeedDialContactPermissionEmptyViewListener(getContext(), this, + contactPermissionLauncher)); return true; } @@ -308,7 +305,8 @@ public class SpeedDialFragment extends Fragment { emptyContentView.setVisibility(View.VISIBLE); emptyContentView.setActionLabel(R.string.speed_dial_no_contacts_action_text); emptyContentView.setDescription(R.string.speed_dial_no_contacts_description); - emptyContentView.setActionClickedListener(new SpeedDialNoContactsEmptyViewListener(this)); + emptyContentView.setActionClickedListener( + new SpeedDialNoContactsEmptyViewListener(addFavoriteLauncher)); } @Override @@ -336,7 +334,7 @@ public class SpeedDialFragment extends Fragment { @Override public void onAddFavoriteClicked() { Intent intent = new Intent(Intent.ACTION_PICK, Phone.CONTENT_URI); - startActivityForResult(intent, ActivityRequestCodes.SPEED_DIAL_ADD_FAVORITE); + addFavoriteLauncher.launch(intent); } } @@ -584,9 +582,14 @@ public class SpeedDialFragment extends Fragment { private final Context context; private final Fragment fragment; - private SpeedDialContactPermissionEmptyViewListener(Context context, Fragment fragment) { + private final ActivityResultLauncher contactPermissionLauncher; + + private SpeedDialContactPermissionEmptyViewListener(Context context, Fragment fragment, + ActivityResultLauncher + contactPermissionLauncher) { this.context = context; this.fragment = fragment; + this.contactPermissionLauncher = contactPermissionLauncher; } @Override @@ -598,23 +601,23 @@ public class SpeedDialFragment extends Fragment { LogUtil.i( "OldSpeedDialFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - fragment.requestPermissions(deniedPermissions, READ_CONTACTS_PERMISSION_REQUEST_CODE); + contactPermissionLauncher.launch(deniedPermissions); } } private static final class SpeedDialNoContactsEmptyViewListener implements OnEmptyViewActionButtonClickedListener { - private final Fragment fragment; + private final ActivityResultLauncher addFavoriteLauncher; - SpeedDialNoContactsEmptyViewListener(Fragment fragment) { - this.fragment = fragment; + SpeedDialNoContactsEmptyViewListener(ActivityResultLauncher addFavoriteLauncher) { + this.addFavoriteLauncher = addFavoriteLauncher; } @Override public void onEmptyViewActionButtonClicked() { Intent intent = new Intent(Intent.ACTION_PICK, Phone.CONTENT_URI); - fragment.startActivityForResult(intent, ActivityRequestCodes.SPEED_DIAL_ADD_FAVORITE); + addFavoriteLauncher.launch(intent); } } diff --git a/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java index 457e5a4cc0..d112f6300b 100644 --- a/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java +++ b/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java @@ -20,16 +20,16 @@ package com.android.dialer.voicemail.settings; import android.Manifest; import android.app.Activity; import android.content.Intent; -import android.content.pm.PackageManager; import android.media.MediaPlayer; import android.os.Bundle; -import androidx.core.app.ActivityCompat; + +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; import android.widget.TextView; -import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import com.android.dialer.R; @@ -43,9 +43,14 @@ import java.util.Locale; public class CurrentVoicemailGreetingActivity extends AppCompatActivity { public static final String VOICEMAIL_GREETING_FILEPATH_KEY = "canonVoicemailGreetingFilePathKey"; - private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200; - - private boolean permissionToRecordAccepted = false; + private final ActivityResultLauncher audioPermissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestPermission(), granted -> { + if (!granted) { + LogUtil.w( + "CurrentVoicemailGreetingActivity.onRequestPermissionsResult", + "permissionToRecordAccepted = false."); + } + }); private ImageButton changeGreetingButton; private ImageButton playButton; @@ -96,8 +101,7 @@ public class CurrentVoicemailGreetingActivity extends AppCompatActivity { @Override public void onStart() { - ActivityCompat.requestPermissions( - this, new String[] {Manifest.permission.RECORD_AUDIO}, REQUEST_RECORD_AUDIO_PERMISSION); + audioPermissionLauncher.launch(Manifest.permission.RECORD_AUDIO); if (isGreetingRecorded()) { mediaPlayer = new MediaPlayer(); @@ -122,22 +126,6 @@ public class CurrentVoicemailGreetingActivity extends AppCompatActivity { super.onPause(); } - @Override - public void onRequestPermissionsResult( - int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - - if (requestCode == REQUEST_RECORD_AUDIO_PERMISSION) { - permissionToRecordAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED; - } - if (!permissionToRecordAccepted) { - LogUtil.w( - "CurrentVoicemailGreetingActivity.onRequestPermissionsResult", - "permissionToRecordAccepted = false."); - // TODO(sabowitz): Implement error dialog logic in a child CL. - } - } - private boolean isGreetingRecorded() { Intent intent = getIntent(); if (intent.hasExtra(VOICEMAIL_GREETING_FILEPATH_KEY)) { diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index 9ffb934dfe..4e1cabebd7 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -40,6 +40,8 @@ import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; import android.widget.Toast; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; @@ -100,7 +102,14 @@ public class InCallFragment extends Fragment private int phoneType; private boolean stateRestored; - private static final int REQUEST_CODE_CALL_RECORD_PERMISSION = 1000; + private final ActivityResultLauncher permissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestMultiplePermissions(), + grantResults -> { + boolean allGranted = grantResults.values().stream().allMatch(x -> x); + if (allGranted) { + inCallButtonUiDelegate.callRecordClicked(true); + } + }); // Add animation to educate users. If a call has enriched calling attachments then we'll // initially show the attachment page. After a delay seconds we'll animate to the button grid. @@ -469,23 +478,7 @@ public class InCallFragment extends Fragment @Override public void requestCallRecordingPermissions(String[] permissions) { - requestPermissions(permissions, REQUEST_CODE_CALL_RECORD_PERMISSION); - } - - @Override - public void onRequestPermissionsResult(int requestCode, - @NonNull String[] permissions, @NonNull int[] grantResults) { - if (requestCode == REQUEST_CODE_CALL_RECORD_PERMISSION) { - boolean allGranted = grantResults.length > 0; - for (int i = 0; i < grantResults.length; i++) { - allGranted &= grantResults[i] == PackageManager.PERMISSION_GRANTED; - } - if (allGranted) { - inCallButtonUiDelegate.callRecordClicked(true); - } - } else { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - } + permissionLauncher.launch(permissions); } @Override diff --git a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java index 0b12594d77..dd42c35fc6 100644 --- a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java +++ b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java @@ -19,7 +19,6 @@ package com.android.incallui.video.impl; import android.Manifest.permission; import android.content.Context; -import android.content.pm.PackageManager; import android.graphics.Point; import android.graphics.drawable.Animatable; import android.os.Bundle; @@ -41,6 +40,8 @@ import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.TextView; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -92,7 +93,6 @@ public class SurfaceViewVideoCallFragment extends Fragment private static final String ARG_CALL_ID = "call_id"; - private static final int CAMERA_PERMISSION_REQUEST_CODE = 1; private static final long CAMERA_PERMISSION_DIALOG_DELAY_IN_MILLIS = 2000L; private static final long VIDEO_OFF_VIEW_FADE_OUT_DELAY_IN_MILLIS = 2000L; @@ -138,6 +138,19 @@ public class SurfaceViewVideoCallFragment extends Fragment } }; + private final ActivityResultLauncher cameraPermissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestPermission(), + grantResults -> { + if (grantResults) { + LogUtil.i("SurfaceViewVideoCallFragment.onRequestPermissionsResult", + "Camera permission granted."); + videoCallScreenDelegate.onCameraPermissionGranted(); + } else { + LogUtil.i("SurfaceViewVideoCallFragment.onRequestPermissionsResult", + "Camera permission denied."); + } + }); + public static SurfaceViewVideoCallFragment newInstance(String callId) { Bundle bundle = new Bundle(); bundle.putString(ARG_CALL_ID, Assert.isNotNull(callId)); @@ -160,23 +173,6 @@ public class SurfaceViewVideoCallFragment extends Fragment } } - @Override - public void onRequestPermissionsResult( - int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - if (requestCode == CAMERA_PERMISSION_REQUEST_CODE) { - if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - LogUtil.i( - "SurfaceViewVideoCallFragment.onRequestPermissionsResult", - "Camera permission granted."); - videoCallScreenDelegate.onCameraPermissionGranted(); - } else { - LogUtil.i( - "SurfaceViewVideoCallFragment.onRequestPermissionsResult", "Camera permission denied."); - } - } - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - } - @Nullable @Override public View onCreateView( @@ -1023,7 +1019,8 @@ public class SurfaceViewVideoCallFragment extends Fragment if (!VideoUtils.hasCameraPermissionAndShownPrivacyToast(getContext())) { videoCallScreenDelegate.onCameraPermissionDialogShown(); if (!VideoUtils.hasCameraPermission(getContext())) { - requestPermissions(new String[] {permission.CAMERA}, CAMERA_PERMISSION_REQUEST_CODE); + cameraPermissionLauncher.launch(permission.CAMERA); + } else { PermissionsUtil.showCameraPermissionToast(getContext()); videoCallScreenDelegate.onCameraPermissionGranted(); diff --git a/java/com/android/incallui/video/impl/VideoCallFragment.java b/java/com/android/incallui/video/impl/VideoCallFragment.java index 1d8037f0e9..cea7d33b4c 100644 --- a/java/com/android/incallui/video/impl/VideoCallFragment.java +++ b/java/com/android/incallui/video/impl/VideoCallFragment.java @@ -19,7 +19,6 @@ package com.android.incallui.video.impl; import android.Manifest.permission; import android.content.Context; -import android.content.pm.PackageManager; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Insets; @@ -53,6 +52,8 @@ import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -186,6 +187,19 @@ public class VideoCallFragment extends Fragment } }; + private final ActivityResultLauncher cameraPermissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestPermission(), + grantResult -> { + if (grantResult) { + LogUtil.i("VideoCallFragment.onRequestPermissionsResult", + "Camera permission granted."); + videoCallScreenDelegate.onCameraPermissionGranted(); + } else { + LogUtil.i("VideoCallFragment.onRequestPermissionsResult", + "Camera permission denied."); + } + }); + public static VideoCallFragment newInstance(String callId) { Bundle bundle = new Bundle(); bundle.putString(ARG_CALL_ID, Assert.isNotNull(callId)); @@ -208,20 +222,6 @@ public class VideoCallFragment extends Fragment } } - @Override - public void onRequestPermissionsResult( - int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - if (requestCode == CAMERA_PERMISSION_REQUEST_CODE) { - if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - LogUtil.i("VideoCallFragment.onRequestPermissionsResult", "Camera permission granted."); - videoCallScreenDelegate.onCameraPermissionGranted(); - } else { - LogUtil.i("VideoCallFragment.onRequestPermissionsResult", "Camera permission denied."); - } - } - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - } - @Nullable @Override public View onCreateView( @@ -1275,7 +1275,7 @@ public class VideoCallFragment extends Fragment if (!VideoUtils.hasCameraPermissionAndShownPrivacyToast(getContext())) { videoCallScreenDelegate.onCameraPermissionDialogShown(); if (!VideoUtils.hasCameraPermission(getContext())) { - requestPermissions(new String[] {permission.CAMERA}, CAMERA_PERMISSION_REQUEST_CODE); + cameraPermissionLauncher.launch(permission.CAMERA); } else { PermissionsUtil.showCameraPermissionToast(getContext()); videoCallScreenDelegate.onCameraPermissionGranted(); -- GitLab From f1b0cd9994c35ea0655914cdb23df34dcc7c486b Mon Sep 17 00:00:00 2001 From: Michael W Date: Sun, 22 Oct 2023 14:42:48 +0200 Subject: [PATCH 10/36] Dialer: Fix settings * RingtonePreference doesn't exist in androidx world - we have to make our own * We don't need to remove the dividers anymore - androidx doesn't have them in the first place * AppCompatPreferenceActivity is deprecated as well, make it an AppCompatActivity and start using fragments Change-Id: I54d22868deb8950618b69652ae3810b8e0bcdb80 --- .../app/res/layout/activity_settings.xml | 12 + .../settings/AppCompatPreferenceActivity.java | 148 ------- .../settings/DefaultRingtonePreference.java | 41 +- .../settings/DialerPreferenceFragment.java | 28 -- .../app/settings/DialerSettingsActivity.java | 412 +++++++++--------- .../DisplayOptionsSettingsFragment.java | 3 +- .../PhoneAccountSelectionFragment.java | 27 +- .../app/settings/SoundSettingsFragment.java | 37 +- .../dialer/lookup/LookupSettingsFragment.java | 4 +- .../settings/VoicemailSettingsFragment.java | 10 +- 10 files changed, 312 insertions(+), 410 deletions(-) create mode 100644 java/com/android/dialer/app/res/layout/activity_settings.xml delete mode 100644 java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java delete mode 100644 java/com/android/dialer/app/settings/DialerPreferenceFragment.java diff --git a/java/com/android/dialer/app/res/layout/activity_settings.xml b/java/com/android/dialer/app/res/layout/activity_settings.xml new file mode 100644 index 0000000000..e53ce21228 --- /dev/null +++ b/java/com/android/dialer/app/res/layout/activity_settings.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java b/java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java deleted file mode 100644 index ee8c424bf1..0000000000 --- a/java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * Copyright (C) 2023 The LineageOS 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.app.settings; - -import android.app.Activity; -import android.content.res.Configuration; -import android.os.Bundle; -import android.preference.PreferenceActivity; -import android.view.MenuInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.appcompat.app.AppCompatDelegate; - -/** - * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls - * to be used with AppCompat. - */ -public class AppCompatPreferenceActivity extends PreferenceActivity { - - private AppCompatDelegate delegate; - - private boolean isSafeToCommitTransactions; - - @Override - protected void onCreate(Bundle savedInstanceState) { - getDelegate().installViewFactory(); - getDelegate().onCreate(savedInstanceState); - super.onCreate(savedInstanceState); - isSafeToCommitTransactions = true; - } - - @Override - protected void onPostCreate(Bundle savedInstanceState) { - super.onPostCreate(savedInstanceState); - getDelegate().onPostCreate(savedInstanceState); - } - - @Override - public MenuInflater getMenuInflater() { - return getDelegate().getMenuInflater(); - } - - @Override - public void setContentView(int layoutResID) { - getDelegate().setContentView(layoutResID); - } - - @Override - public void setContentView(View view) { - getDelegate().setContentView(view); - } - - @Override - public void setContentView(View view, ViewGroup.LayoutParams params) { - getDelegate().setContentView(view, params); - } - - @Override - public void addContentView(View view, ViewGroup.LayoutParams params) { - getDelegate().addContentView(view, params); - } - - @Override - protected void onPostResume() { - super.onPostResume(); - getDelegate().onPostResume(); - } - - @Override - protected void onTitleChanged(CharSequence title, int color) { - super.onTitleChanged(title, color); - getDelegate().setTitle(title); - } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - getDelegate().onConfigurationChanged(newConfig); - } - - @Override - protected void onStop() { - super.onStop(); - getDelegate().onStop(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - getDelegate().onDestroy(); - } - - @Override - public void invalidateOptionsMenu() { - getDelegate().invalidateOptionsMenu(); - } - - private AppCompatDelegate getDelegate() { - if (delegate == null) { - delegate = AppCompatDelegate.create(this, null); - } - return delegate; - } - - @Override - protected void onStart() { - super.onStart(); - isSafeToCommitTransactions = true; - } - - @Override - protected void onResume() { - super.onResume(); - isSafeToCommitTransactions = true; - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - isSafeToCommitTransactions = false; - } - - /** - * Returns true if it is safe to commit {@link FragmentTransaction}s at this time, based on - * whether {@link Activity#onSaveInstanceState} has been called or not. - * - *

Make sure that the current activity calls into {@link super.onSaveInstanceState(Bundle - * outState)} (if that method is overridden), so the flag is properly set. - */ - public boolean isSafeToCommitTransactions() { - return isSafeToCommitTransactions; - } -} diff --git a/java/com/android/dialer/app/settings/DefaultRingtonePreference.java b/java/com/android/dialer/app/settings/DefaultRingtonePreference.java index 50989ce0e7..cbabb74d33 100644 --- a/java/com/android/dialer/app/settings/DefaultRingtonePreference.java +++ b/java/com/android/dialer/app/settings/DefaultRingtonePreference.java @@ -21,32 +21,44 @@ import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; import android.net.Uri; -import android.preference.RingtonePreference; import android.provider.Settings; import android.util.AttributeSet; +import android.util.Log; import android.widget.Toast; +import androidx.activity.result.ActivityResult; +import androidx.activity.result.ActivityResultCallback; +import androidx.activity.result.contract.ActivityResultContracts; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.preference.Preference; +import androidx.preference.PreferenceFragmentCompat; + import com.android.dialer.R; /** RingtonePreference which doesn't show default ringtone setting. */ -public class DefaultRingtonePreference extends RingtonePreference { +public class DefaultRingtonePreference extends Preference { + + private final Intent mRingtonePickerIntent; public DefaultRingtonePreference(Context context, AttributeSet attrs) { super(context, attrs); - } - @Override - protected void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) { - super.onPrepareRingtonePickerIntent(ringtonePickerIntent); + mRingtonePickerIntent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); + mRingtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, getRingtoneType()); + mRingtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, false); + mRingtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true); + mRingtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, + Settings.System.DEFAULT_NOTIFICATION_URI); + mRingtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getTitle()); + } - /* - * Since this preference is for choosing the default ringtone, it - * doesn't make sense to show a 'Default' item. - */ - ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, false); + public Intent getRingtonePickerIntent() { + mRingtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, + onRestoreRingtone()); + return mRingtonePickerIntent; } - @Override protected void onSaveRingtone(Uri ringtoneUri) { if (!Settings.System.canWrite(getContext())) { Toast.makeText( @@ -59,8 +71,11 @@ public class DefaultRingtonePreference extends RingtonePreference { RingtoneManager.setActualDefaultRingtoneUri(getContext(), getRingtoneType(), ringtoneUri); } - @Override protected Uri onRestoreRingtone() { return RingtoneManager.getActualDefaultRingtoneUri(getContext(), getRingtoneType()); } + + private int getRingtoneType() { + return RingtoneManager.TYPE_RINGTONE; + } } diff --git a/java/com/android/dialer/app/settings/DialerPreferenceFragment.java b/java/com/android/dialer/app/settings/DialerPreferenceFragment.java deleted file mode 100644 index d2af4defe3..0000000000 --- a/java/com/android/dialer/app/settings/DialerPreferenceFragment.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SPDX-FileCopyrightText: The LineageOS Project - * SPDX-License-Identifier: Apache-2.0 - */ -package com.android.dialer.app.settings; - -import android.os.Bundle; -import android.view.View; -import android.widget.ListView; - -import androidx.annotation.Nullable; -import androidx.preference.PreferenceFragmentCompat; - -public class DialerPreferenceFragment extends PreferenceFragmentCompat { - - @Override - public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { - - } - - @Override - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { - ListView lv = (ListView) view.findViewById(android.R.id.list); - if (lv != null) { - lv.setDivider(null); - } - } -} diff --git a/java/com/android/dialer/app/settings/DialerSettingsActivity.java b/java/com/android/dialer/app/settings/DialerSettingsActivity.java index 5e08ed9b0b..ec7d85e7b9 100644 --- a/java/com/android/dialer/app/settings/DialerSettingsActivity.java +++ b/java/com/android/dialer/app/settings/DialerSettingsActivity.java @@ -16,6 +16,7 @@ */ package com.android.dialer.app.settings; +import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -28,30 +29,29 @@ import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.TelephonyManager; -import android.view.MenuItem; import android.widget.Toast; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.preference.Preference; +import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceManager; -import com.android.dialer.app.R; +import com.android.dialer.R; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.lookup.LookupSettingsFragment; -import com.android.dialer.proguard.UsedByReflection; import com.android.dialer.util.PermissionsUtil; import com.android.dialer.voicemail.settings.VoicemailSettingsFragment; import com.android.voicemail.VoicemailClient; -import java.util.List; - /** Activity for dialer settings. */ -@SuppressWarnings("FragmentInjection") // Activity not exported -@UsedByReflection(value = "AndroidManifest-app.xml") -public class DialerSettingsActivity extends AppCompatPreferenceActivity { +public class DialerSettingsActivity extends AppCompatActivity implements + PreferenceFragmentCompat.OnPreferenceStartFragmentCallback { protected SharedPreferences preferences; - private List

headers; @Override protected void onCreate(Bundle savedInstanceState) { @@ -59,225 +59,241 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { super.onCreate(savedInstanceState); preferences = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()); + setContentView(R.layout.activity_settings); + Intent intent = getIntent(); Uri data = intent.getData(); + + String initialFragment = null; if (data != null) { String headerToOpen = data.getSchemeSpecificPart(); - if (headerToOpen != null && headers != null) { - for (Header header : headers) { - if (headerToOpen.equals(header.fragment)) { - LogUtil.i("DialerSettingsActivity.onCreate", "switching to header: " + headerToOpen); - switchToHeader(header); - break; - } - } + if (headerToOpen != null) { + initialFragment = headerToOpen; } } + + // If savedInstanceState is non-null, then the activity is being + // recreated and super.onCreate() has already recreated the fragment. + if (savedInstanceState == null) { + if (initialFragment == null) { + initialFragment = PrefsFragment.class.getName(); + } + Fragment fragment; + try { + fragment = getSupportFragmentManager() + .getFragmentFactory() + .instantiate(getClassLoader(), initialFragment); + } catch (Exception ignored) { + fragment = new PrefsFragment(); + } + + getSupportFragmentManager().beginTransaction() + .replace(R.id.content_frame, fragment) + .commit(); + } + + getSupportFragmentManager().addOnBackStackChangedListener(() -> { + if (getSupportFragmentManager().getBackStackEntryCount() == 0) { + setTitle(R.string.dialer_settings_label); + } + }); } @Override - protected void onResume() { - super.onResume(); + public boolean onPreferenceStartFragment(@NonNull PreferenceFragmentCompat caller, + @NonNull Preference pref) { + Fragment fragment = getSupportFragmentManager() + .getFragmentFactory() + .instantiate(getClassLoader(), pref.getFragment()); + fragment.setArguments(pref.getExtras()); + getSupportFragmentManager().beginTransaction() + .replace(R.id.content_frame, fragment, "") + .addToBackStack(null) + .commit(); + setTitle(pref.getTitle()); + return true; } - @Override - public void onBuildHeaders(List
target) { - // Keep a reference to the list of headers (since PreferenceActivity.getHeaders() is @Hide) - headers = target; - - if (showDisplayOptions()) { - Header displayOptionsHeader = new Header(); - displayOptionsHeader.titleRes = R.string.display_options_title; - displayOptionsHeader.fragment = DisplayOptionsSettingsFragment.class.getName(); - target.add(displayOptionsHeader); - } + public static class PrefsFragment extends PreferenceFragmentCompat implements + Preference.OnPreferenceClickListener { - Header soundSettingsHeader = new Header(); - soundSettingsHeader.titleRes = R.string.sounds_and_vibration_title; - soundSettingsHeader.fragment = SoundSettingsFragment.class.getName(); - soundSettingsHeader.id = R.id.settings_header_sounds_and_vibration; - target.add(soundSettingsHeader); - - Header quickResponseSettingsHeader = new Header(); - Intent quickResponseSettingsIntent = - new Intent(TelecomManager.ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS); - quickResponseSettingsHeader.titleRes = R.string.respond_via_sms_setting_title; - quickResponseSettingsHeader.intent = quickResponseSettingsIntent; - target.add(quickResponseSettingsHeader); - - final Header lookupSettingsHeader = new Header(); - lookupSettingsHeader.titleRes = R.string.lookup_settings_label; - lookupSettingsHeader.fragment = LookupSettingsFragment.class.getName(); - target.add(lookupSettingsHeader); - - TelephonyManager telephonyManager = - (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); - - // "Call Settings" (full settings) is shown if the current user is primary user and there - // is only one SIM. Otherwise, "Calling accounts" is shown. - boolean isPrimaryUser = isPrimaryUser(); - if (isPrimaryUser && TelephonyManagerCompat.getPhoneCount(telephonyManager) <= 1) { - Header callSettingsHeader = new Header(); - Intent callSettingsIntent = new Intent(TelecomManager.ACTION_SHOW_CALL_SETTINGS); - callSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - - callSettingsHeader.titleRes = R.string.call_settings_label; - callSettingsHeader.intent = callSettingsIntent; - target.add(callSettingsHeader); - } else { - Header phoneAccountSettingsHeader = new Header(); - Intent phoneAccountSettingsIntent = new Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS); - phoneAccountSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - - phoneAccountSettingsHeader.titleRes = R.string.phone_account_settings_label; - phoneAccountSettingsHeader.intent = phoneAccountSettingsIntent; - target.add(phoneAccountSettingsHeader); - } - if (BlockedNumberContract.canCurrentUserBlockNumbers(this)) { - Header blockedCallsHeader = new Header(); - blockedCallsHeader.titleRes = R.string.manage_blocked_numbers_label; - blockedCallsHeader.intent = getApplicationContext().getSystemService(TelecomManager.class) - .createManageBlockedNumbersIntent(); - target.add(blockedCallsHeader); - } + @Override + public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { + setPreferenceScreen(getPreferenceManager().createPreferenceScreen(requireContext())); - addVoicemailSettings(target, isPrimaryUser); - - if (isPrimaryUser - && (TelephonyManagerCompat.isTtyModeSupported(telephonyManager) - || TelephonyManagerCompat.isHearingAidCompatibilitySupported(telephonyManager))) { - Header accessibilitySettingsHeader = new Header(); - Intent accessibilitySettingsIntent = - new Intent(TelecomManager.ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS); - accessibilitySettingsHeader.titleRes = R.string.accessibility_settings_title; - accessibilitySettingsHeader.intent = accessibilitySettingsIntent; - target.add(accessibilitySettingsHeader); - } - } + if (showDisplayOptions()) { + Preference displayOptions = new Preference(getContext()); + displayOptions.setTitle(R.string.display_options_title); + displayOptions.setFragment(DisplayOptionsSettingsFragment.class.getName()); + getPreferenceScreen().addPreference(displayOptions); + } - private void addVoicemailSettings(List
target, boolean isPrimaryUser) { - if (!isPrimaryUser) { - LogUtil.i("DialerSettingsActivity.addVoicemailSettings", "user not primary user"); - return; - } + Preference soundSettings = new Preference(getContext()); + soundSettings.setTitle(R.string.sounds_and_vibration_title); + soundSettings.setFragment(SoundSettingsFragment.class.getName()); + soundSettings.setViewId(R.id.settings_header_sounds_and_vibration); + getPreferenceScreen().addPreference(soundSettings); - if (!PermissionsUtil.hasReadPhoneStatePermissions(this)) { - LogUtil.i("DialerSettingsActivity.addVoicemailSettings", "Missing READ_PHONE_STATE"); - return; - } + Preference quickResponseSettings = new Preference(getContext()); + Intent quickResponseSettingsIntent = + new Intent(TelecomManager.ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS); + quickResponseSettings.setTitle(R.string.respond_via_sms_setting_title); + quickResponseSettings.setIntent(quickResponseSettingsIntent); + getPreferenceScreen().addPreference(quickResponseSettings); - LogUtil.i("DialerSettingsActivity.addVoicemailSettings", "adding voicemail settings"); - Header voicemailSettings = new Header(); - voicemailSettings.titleRes = R.string.voicemail_settings_label; - PhoneAccountHandle soleAccount = getSoleSimAccount(); - if (soleAccount == null) { - LogUtil.i( - "DialerSettingsActivity.addVoicemailSettings", "showing multi-SIM voicemail settings"); - voicemailSettings.fragment = PhoneAccountSelectionFragment.class.getName(); - Bundle bundle = new Bundle(); - bundle.putString( - PhoneAccountSelectionFragment.PARAM_TARGET_FRAGMENT, - VoicemailSettingsFragment.class.getName()); - bundle.putString( - PhoneAccountSelectionFragment.PARAM_PHONE_ACCOUNT_HANDLE_KEY, - VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE); - bundle.putBundle(PhoneAccountSelectionFragment.PARAM_ARGUMENTS, new Bundle()); - bundle.putInt( - PhoneAccountSelectionFragment.PARAM_TARGET_TITLE_RES, R.string.voicemail_settings_label); - voicemailSettings.fragmentArguments = bundle; - target.add(voicemailSettings); - } else { - LogUtil.i( - "DialerSettingsActivity.addVoicemailSettings", "showing single-SIM voicemail settings"); - voicemailSettings.fragment = VoicemailSettingsFragment.class.getName(); - Bundle bundle = new Bundle(); - bundle.putParcelable(VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE, soleAccount); - voicemailSettings.fragmentArguments = bundle; - target.add(voicemailSettings); - } - } + final Preference lookupSettings = new Preference(getContext()); + lookupSettings.setTitle(R.string.lookup_settings_label); + lookupSettings.setFragment(LookupSettingsFragment.class.getName()); + getPreferenceScreen().addPreference(lookupSettings); + + TelephonyManager telephonyManager = getContext().getSystemService(TelephonyManager.class); + TelecomManager telecomManager = (TelecomManager) getContext().getSystemService( + Context.TELECOM_SERVICE); - /** - * @return the only SIM phone account, or {@code null} if there are none or more than one. Note: - * having a empty SIM slot still count as a PhoneAccountHandle that is "invalid", and - * voicemail settings should still be available for it. - */ - @Nullable - private PhoneAccountHandle getSoleSimAccount() { - TelecomManager telecomManager = getSystemService(TelecomManager.class); - PhoneAccountHandle result = null; - for (PhoneAccountHandle phoneAccountHandle : telecomManager.getCallCapablePhoneAccounts()) { - PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle); - if (phoneAccount == null) { - continue; + // "Call Settings" (full settings) is shown if the current user is primary user and there + // is only one SIM. Otherwise, "Calling accounts" is shown. + boolean isPrimaryUser = isPrimaryUser(); + if (isPrimaryUser && TelephonyManagerCompat.getPhoneCount(telephonyManager) <= 1) { + Preference callSettings = new Preference(getContext()); + Intent callSettingsIntent = new Intent(TelecomManager.ACTION_SHOW_CALL_SETTINGS); + callSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + + callSettings.setTitle(R.string.call_settings_label); + callSettings.setIntent(callSettingsIntent); + getPreferenceScreen().addPreference(callSettings); + } else { + Preference phoneAccountSettings = new Preference(getContext()); + Intent phoneAccountSettingsIntent = new Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS); + phoneAccountSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + + phoneAccountSettings.setTitle(R.string.phone_account_settings_label); + phoneAccountSettings.setIntent(phoneAccountSettingsIntent); + getPreferenceScreen().addPreference(phoneAccountSettings); } - if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) { - LogUtil.i( - "DialerSettingsActivity.getSoleSimAccount", phoneAccountHandle + " is a SIM account"); - if (result != null) { - return null; + if (BlockedNumberContract.canCurrentUserBlockNumbers(getContext())) { + Preference blockedCalls = new Preference(getContext()); + blockedCalls.setTitle(R.string.manage_blocked_numbers_label); + blockedCalls.setIntent(getContext().getSystemService(TelecomManager.class) + .createManageBlockedNumbersIntent()); + getPreferenceScreen().addPreference(blockedCalls); + } + + addVoicemailSettings(isPrimaryUser); + + if (isPrimaryUser + && (TelephonyManagerCompat.isTtyModeSupported(telecomManager) + || TelephonyManagerCompat.isHearingAidCompatibilitySupported(telephonyManager))) { + Preference accessibilitySettings = new Preference(getContext()); + Intent accessibilitySettingsIntent = + new Intent(TelecomManager.ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS); + accessibilitySettings.setTitle(R.string.accessibility_settings_title); + accessibilitySettings.setIntent(accessibilitySettingsIntent); + getPreferenceScreen().addPreference(accessibilitySettings); + } + } + + @Override + public boolean onPreferenceClick(@NonNull Preference preference) { + if (preference.getTitle().equals(getString(R.string.sounds_and_vibration_title))) { + // If we don't have the permission to write to system settings, go to system sound + // settings instead. Otherwise, perform the super implementation (which launches our + // own preference fragment. + if (!Settings.System.canWrite(getContext())) { + Toast.makeText(getContext(), + getResources().getString(R.string.toast_cannot_write_system_settings), + Toast.LENGTH_SHORT) + .show(); + startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS)); + return true; } - result = phoneAccountHandle; } + super.onPreferenceTreeClick(preference); + return false; } - return result; - } - /** - * Returns {@code true} or {@code false} based on whether the display options setting should be - * shown. For languages such as Chinese, Japanese, or Korean, display options aren't useful since - * contacts are sorted and displayed family name first by default. - * - * @return {@code true} if the display options should be shown, {@code false} otherwise. - */ - private boolean showDisplayOptions() { - return getResources().getBoolean(R.bool.config_display_order_user_changeable) - && getResources().getBoolean(R.bool.config_sort_order_user_changeable); - } + private void addVoicemailSettings(boolean isPrimaryUser) { + if (!isPrimaryUser) { + LogUtil.i("DialerSettingsActivity.addVoicemailSettings", "user not primary user"); + return; + } - @Override - public void onHeaderClick(Header header, int position) { - if (header.id == R.id.settings_header_sounds_and_vibration) { - // If we don't have the permission to write to system settings, go to system sound - // settings instead. Otherwise, perform the super implementation (which launches our - // own preference fragment. - if (!Settings.System.canWrite(this)) { - Toast.makeText( - this, - getResources().getString(R.string.toast_cannot_write_system_settings), - Toast.LENGTH_SHORT) - .show(); - startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS)); + if (!PermissionsUtil.hasReadPhoneStatePermissions(getContext())) { + LogUtil.i("DialerSettingsActivity.addVoicemailSettings", "Missing READ_PHONE_STATE"); return; } - } - super.onHeaderClick(header, position); - } - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onBackPressed(); - return true; + LogUtil.i("DialerSettingsActivity.addVoicemailSettings", "adding voicemail settings"); + Preference voicemailSettings = new Preference(getContext()); + voicemailSettings.setTitle(R.string.voicemail_settings_label); + Bundle bundle = new Bundle(); + PhoneAccountHandle soleAccount = getSoleSimAccount(); + if (soleAccount == null) { + LogUtil.i("DialerSettingsActivity.addVoicemailSettings", + "showing multi-SIM voicemail settings"); + voicemailSettings.setFragment(PhoneAccountSelectionFragment.class.getName()); + bundle.putString( + PhoneAccountSelectionFragment.PARAM_TARGET_FRAGMENT, + VoicemailSettingsFragment.class.getName()); + bundle.putString( + PhoneAccountSelectionFragment.PARAM_PHONE_ACCOUNT_HANDLE_KEY, + VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE); + bundle.putBundle(PhoneAccountSelectionFragment.PARAM_ARGUMENTS, new Bundle()); + bundle.putInt(PhoneAccountSelectionFragment.PARAM_TARGET_TITLE_RES, + R.string.voicemail_settings_label); + } else { + LogUtil.i( + "DialerSettingsActivity.addVoicemailSettings", "showing single-SIM voicemail settings"); + voicemailSettings.setFragment(VoicemailSettingsFragment.class.getName()); + bundle.putParcelable(VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE, soleAccount); + } + voicemailSettings.getExtras().putAll(bundle); + getPreferenceScreen().addPreference(voicemailSettings); } - return false; - } - @Override - public void onBackPressed() { - if (!isSafeToCommitTransactions()) { - return; + /** + * @return the only SIM phone account, or {@code null} if there are none or more than one. Note: + * having a empty SIM slot still count as a PhoneAccountHandle that is "invalid", and + * voicemail settings should still be available for it. + */ + @SuppressLint("MissingPermission") + @Nullable + private PhoneAccountHandle getSoleSimAccount() { + TelecomManager telecomManager = requireContext().getSystemService(TelecomManager.class); + PhoneAccountHandle result = null; + for (PhoneAccountHandle phoneAccountHandle : telecomManager.getCallCapablePhoneAccounts()) { + PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle); + if (phoneAccount == null) { + continue; + } + if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) { + LogUtil.i( + "DialerSettingsActivity.getSoleSimAccount", phoneAccountHandle + " is a SIM account"); + if (result != null) { + return null; + } + result = phoneAccountHandle; + } + } + return result; } - super.onBackPressed(); - } - @Override - protected boolean isValidFragment(String fragmentName) { - return true; - } + /** + * Returns {@code true} or {@code false} based on whether the display options setting should be + * shown. For languages such as Chinese, Japanese, or Korean, display options aren't useful since + * contacts are sorted and displayed family name first by default. + * + * @return {@code true} if the display options should be shown, {@code false} otherwise. + */ + private boolean showDisplayOptions() { + return getResources().getBoolean(R.bool.config_display_order_user_changeable) + && getResources().getBoolean(R.bool.config_sort_order_user_changeable); + } - /** @return Whether the current user is the primary user. */ - private boolean isPrimaryUser() { - return getSystemService(UserManager.class).isSystemUser(); + /** + * @return Whether the current user is the primary user. + */ + private boolean isPrimaryUser() { + return requireContext().getSystemService(UserManager.class).isSystemUser(); + } } } diff --git a/java/com/android/dialer/app/settings/DisplayOptionsSettingsFragment.java b/java/com/android/dialer/app/settings/DisplayOptionsSettingsFragment.java index 4a3e545f0a..93853ae3bc 100644 --- a/java/com/android/dialer/app/settings/DisplayOptionsSettingsFragment.java +++ b/java/com/android/dialer/app/settings/DisplayOptionsSettingsFragment.java @@ -20,10 +20,11 @@ package com.android.dialer.app.settings; import android.os.Bundle; import androidx.annotation.Nullable; +import androidx.preference.PreferenceFragmentCompat; import com.android.dialer.R; -public class DisplayOptionsSettingsFragment extends DialerPreferenceFragment { +public class DisplayOptionsSettingsFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { diff --git a/java/com/android/dialer/app/settings/PhoneAccountSelectionFragment.java b/java/com/android/dialer/app/settings/PhoneAccountSelectionFragment.java index 28b1bfd386..01073b336b 100644 --- a/java/com/android/dialer/app/settings/PhoneAccountSelectionFragment.java +++ b/java/com/android/dialer/app/settings/PhoneAccountSelectionFragment.java @@ -17,27 +17,29 @@ package com.android.dialer.app.settings; -import android.app.Fragment; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.drawable.Icon; import android.os.Bundle; -import android.preference.PreferenceActivity; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceScreen; +import com.android.dialer.R; + import java.util.List; /** * Preference screen that lists SIM phone accounts to select from, and forwards the selected account - * to {@link #PARAM_TARGET_FRAGMENT}. Can only be used in a {@link PreferenceActivity} + * to {@link #PARAM_TARGET_FRAGMENT}. */ -public class PhoneAccountSelectionFragment extends DialerPreferenceFragment { +public class PhoneAccountSelectionFragment extends PreferenceFragmentCompat { /** The {@link PreferenceFragmentCompat} to launch after the account is selected. */ public static final String PARAM_TARGET_FRAGMENT = "target_fragment"; @@ -45,7 +47,7 @@ public class PhoneAccountSelectionFragment extends DialerPreferenceFragment { /** * The arguments bundle to pass to the {@link #PARAM_TARGET_FRAGMENT} * - * @see Fragment#getArguments() + * @see PreferenceFragmentCompat#getArguments() */ public static final String PARAM_ARGUMENTS = "arguments"; @@ -55,8 +57,7 @@ public class PhoneAccountSelectionFragment extends DialerPreferenceFragment { public static final String PARAM_PHONE_ACCOUNT_HANDLE_KEY = "phone_account_handle_key"; /** - * The title of the {@link #PARAM_TARGET_FRAGMENT} once it is launched with {@link - * PreferenceActivity#startWithFragment(String, Bundle, Fragment, int)}, as a string resource ID. + * The title of the {@link #PARAM_TARGET_FRAGMENT} once it is launched, as a string resource ID. */ public static final String PARAM_TARGET_TITLE_RES = "target_title_res"; @@ -98,10 +99,16 @@ public class PhoneAccountSelectionFragment extends DialerPreferenceFragment { @Override protected void onClick() { super.onClick(); - // TODO BadDaemon: fix this - /*PreferenceActivity preferenceActivity = (PreferenceActivity) getActivity(); + Fragment fragment = getChildFragmentManager() + .getFragmentFactory() + .instantiate(getActivity().getClassLoader(), targetFragment); arguments.putParcelable(phoneAccountHandleKey, phoneAccountHandle); - preferenceActivity.startWithFragment(targetFragment, arguments, null, 0, titleRes, 0);*/ + fragment.setArguments(arguments); + getParentFragmentManager().beginTransaction() + .replace(R.id.content_frame, fragment) + .addToBackStack(null) + .commit(); + setTitle(titleRes); } } diff --git a/java/com/android/dialer/app/settings/SoundSettingsFragment.java b/java/com/android/dialer/app/settings/SoundSettingsFragment.java index 8e1214955e..2148f2b1f5 100644 --- a/java/com/android/dialer/app/settings/SoundSettingsFragment.java +++ b/java/com/android/dialer/app/settings/SoundSettingsFragment.java @@ -17,13 +17,18 @@ package com.android.dialer.app.settings; +import static android.app.Activity.RESULT_OK; + +import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.NotificationManager; import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.os.Vibrator; import android.provider.Settings; @@ -31,9 +36,12 @@ import android.telephony.CarrierConfigManager; import android.telephony.TelephonyManager; import android.widget.Toast; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.Nullable; import androidx.preference.ListPreference; import androidx.preference.Preference; +import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceScreen; import androidx.preference.SwitchPreferenceCompat; @@ -41,7 +49,7 @@ import com.android.dialer.R; import com.android.dialer.callrecord.impl.CallRecorderService; import com.android.dialer.util.SettingsUtil; -public class SoundSettingsFragment extends DialerPreferenceFragment +public class SoundSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener { private static final int NO_DTMF_TONE = 0; @@ -54,7 +62,7 @@ public class SoundSettingsFragment extends DialerPreferenceFragment private static final int MSG_UPDATE_RINGTONE_SUMMARY = 1; - private Preference ringtonePreference; + private DefaultRingtonePreference ringtonePreference; private final Handler ringtoneLookupComplete = new Handler(Looper.getMainLooper()) { @Override @@ -68,6 +76,18 @@ public class SoundSettingsFragment extends DialerPreferenceFragment }; private final Runnable ringtoneLookupRunnable = () -> updateRingtonePreferenceSummary(); + private final ActivityResultLauncher mRingtonePickerResult = registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), result -> { + if (result.getResultCode() == RESULT_OK) { + Intent data = result.getData(); + if (data == null || data.getExtras() == null) { + return; + } + Uri uri = (Uri) data.getExtras().get(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); + ringtonePreference.onSaveRingtone(uri); + } + }); + private SwitchPreferenceCompat vibrateWhenRinging; private SwitchPreferenceCompat playDtmfTone; private ListPreference dtmfToneLength; @@ -221,7 +241,9 @@ public class SoundSettingsFragment extends DialerPreferenceFragment .show(); return true; } - if (preference == playDtmfTone) { + if (preference == ringtonePreference) { + mRingtonePickerResult.launch(ringtonePreference.getRingtonePickerIntent()); + } else if (preference == playDtmfTone) { Settings.System.putInt( getActivity().getContentResolver(), Settings.System.DTMF_TONE_WHEN_DIALING, @@ -249,7 +271,7 @@ public class SoundSettingsFragment extends DialerPreferenceFragment private boolean shouldVibrateWhenRinging() { int vibrateWhenRingingSetting = Settings.System.getInt( - getActivity().getContentResolver(), + requireActivity().getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING, NO_VIBRATION_FOR_CALLS); return hasVibrator() && (vibrateWhenRingingSetting == DO_VIBRATION_FOR_CALLS); @@ -259,7 +281,7 @@ public class SoundSettingsFragment extends DialerPreferenceFragment private boolean shouldPlayDtmfTone() { int dtmfToneSetting = Settings.System.getInt( - getActivity().getContentResolver(), + requireActivity().getContentResolver(), Settings.System.DTMF_TONE_WHEN_DIALING, PLAY_DTMF_TONE); return dtmfToneSetting == PLAY_DTMF_TONE; @@ -267,13 +289,14 @@ public class SoundSettingsFragment extends DialerPreferenceFragment /** Whether the device hardware has a vibrator. */ private boolean hasVibrator() { - Vibrator vibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE); + Vibrator vibrator = requireActivity().getSystemService(Vibrator.class); return vibrator != null && vibrator.hasVibrator(); } + @SuppressLint("MissingPermission") private boolean shouldHideCarrierSettings() { CarrierConfigManager configManager = - (CarrierConfigManager) getActivity().getSystemService(Context.CARRIER_CONFIG_SERVICE); + (CarrierConfigManager) requireActivity().getSystemService(Context.CARRIER_CONFIG_SERVICE); return configManager .getConfig() .getBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL); diff --git a/java/com/android/dialer/lookup/LookupSettingsFragment.java b/java/com/android/dialer/lookup/LookupSettingsFragment.java index 490a5b7ace..970198e9cb 100644 --- a/java/com/android/dialer/lookup/LookupSettingsFragment.java +++ b/java/com/android/dialer/lookup/LookupSettingsFragment.java @@ -23,12 +23,12 @@ import android.os.Bundle; import androidx.annotation.Nullable; import androidx.preference.ListPreference; import androidx.preference.Preference; +import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreferenceCompat; import com.android.dialer.R; -import com.android.dialer.app.settings.DialerPreferenceFragment; -public class LookupSettingsFragment extends DialerPreferenceFragment +public class LookupSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener { private static final String KEY_ENABLE_FORWARD_LOOKUP = "enable_forward_lookup"; diff --git a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java index 942f3967f2..4c9f0badc2 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java @@ -30,12 +30,11 @@ import android.telephony.TelephonyManager; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.preference.Preference; -import androidx.preference.Preference.OnPreferenceClickListener; +import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceScreen; import androidx.preference.SwitchPreferenceCompat; import com.android.dialer.R; -import com.android.dialer.app.settings.DialerPreferenceFragment; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.notification.NotificationChannelManager; @@ -52,7 +51,7 @@ import java.lang.annotation.RetentionPolicy; * Fragment for voicemail settings. Requires {@link VoicemailClient#PARAM_PHONE_ACCOUNT_HANDLE} set * in arguments. */ -public class VoicemailSettingsFragment extends DialerPreferenceFragment +public class VoicemailSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener, ActivationStateListener { // Extras copied from com.android.phone.settings.VoicemailSettingsActivity, @@ -83,6 +82,11 @@ public class VoicemailSettingsFragment extends DialerPreferenceFragment voicemailClient = VoicemailComponent.get(getContext()).getVoicemailClient(); } + @Override + public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { + + } + @Override public void onResume() { super.onResume(); -- GitLab From ad1f31d5353800e71d6305950daa3aa35606fe00 Mon Sep 17 00:00:00 2001 From: Michael W Date: Sun, 22 Oct 2023 14:41:50 +0200 Subject: [PATCH 11/36] Dialer: Fix issues and warnings in xml files * We don't need androidx.legacy.widget.Space, just use Space * android:showAsAction should be app:showAsAction * android:tint should be app:tint * french language has translations we don't need * drawable -> drawableCompat Change-Id: I476e02db29944ca9bd3884b6e5ce3cb86fb5a5b4 --- AndroidManifest.xml | 6 ++- .../app/res/layout/call_log_fragment.xml | 2 +- .../dialer/app/res/menu/call_log_options.xml | 11 ++++-- .../dialer/app/res/values-af/strings.xml | 1 - .../dialer/app/res/values-am/strings.xml | 1 - .../dialer/app/res/values-ar/strings.xml | 1 - .../dialer/app/res/values-az/strings.xml | 1 - .../app/res/values-b+sr+Latn/strings.xml | 1 - .../dialer/app/res/values-be/strings.xml | 1 - .../dialer/app/res/values-bg/strings.xml | 1 - .../dialer/app/res/values-bn/strings.xml | 1 - .../dialer/app/res/values-bs/strings.xml | 1 - .../dialer/app/res/values-ca/strings.xml | 1 - .../dialer/app/res/values-cs/strings.xml | 1 - .../dialer/app/res/values-da/strings.xml | 1 - .../dialer/app/res/values-de/strings.xml | 1 - .../dialer/app/res/values-el/strings.xml | 1 - .../dialer/app/res/values-en-rAU/strings.xml | 1 - .../dialer/app/res/values-en-rGB/strings.xml | 1 - .../dialer/app/res/values-en-rIN/strings.xml | 1 - .../dialer/app/res/values-es-rUS/strings.xml | 1 - .../dialer/app/res/values-es/strings.xml | 1 - .../dialer/app/res/values-et/strings.xml | 1 - .../dialer/app/res/values-eu/strings.xml | 1 - .../dialer/app/res/values-fa/strings.xml | 1 - .../dialer/app/res/values-fi/strings.xml | 1 - .../dialer/app/res/values-fr-rCA/strings.xml | 1 - .../dialer/app/res/values-fr/strings.xml | 7 ---- .../dialer/app/res/values-gl/strings.xml | 1 - .../dialer/app/res/values-gu/strings.xml | 1 - .../dialer/app/res/values-hi/strings.xml | 1 - .../dialer/app/res/values-hr/strings.xml | 1 - .../dialer/app/res/values-hu/strings.xml | 1 - .../dialer/app/res/values-hy/strings.xml | 1 - .../dialer/app/res/values-in/strings.xml | 1 - .../dialer/app/res/values-is/strings.xml | 1 - .../dialer/app/res/values-it/strings.xml | 1 - .../dialer/app/res/values-iw/strings.xml | 1 - .../dialer/app/res/values-ja/strings.xml | 1 - .../dialer/app/res/values-ka/strings.xml | 1 - .../dialer/app/res/values-kk/strings.xml | 1 - .../dialer/app/res/values-km/strings.xml | 1 - .../dialer/app/res/values-kn/strings.xml | 1 - .../dialer/app/res/values-ko/strings.xml | 1 - .../dialer/app/res/values-ky/strings.xml | 1 - .../dialer/app/res/values-lo/strings.xml | 1 - .../dialer/app/res/values-lt/strings.xml | 1 - .../dialer/app/res/values-lv/strings.xml | 1 - .../dialer/app/res/values-mk/strings.xml | 1 - .../dialer/app/res/values-ml/strings.xml | 1 - .../dialer/app/res/values-mn/strings.xml | 1 - .../dialer/app/res/values-mr/strings.xml | 1 - .../dialer/app/res/values-ms/strings.xml | 1 - .../dialer/app/res/values-my/strings.xml | 1 - .../dialer/app/res/values-nb/strings.xml | 1 - .../dialer/app/res/values-ne/strings.xml | 1 - .../dialer/app/res/values-night/colors.xml | 4 +- .../dialer/app/res/values-nl/strings.xml | 1 - .../dialer/app/res/values-no/strings.xml | 1 - .../dialer/app/res/values-pa/strings.xml | 1 - .../dialer/app/res/values-pl/strings.xml | 1 - .../dialer/app/res/values-pt-rBR/strings.xml | 1 - .../dialer/app/res/values-pt-rPT/strings.xml | 1 - .../dialer/app/res/values-pt/strings.xml | 1 - .../dialer/app/res/values-ro/strings.xml | 1 - .../dialer/app/res/values-ru/strings.xml | 1 - .../dialer/app/res/values-si/strings.xml | 1 - .../dialer/app/res/values-sk/strings.xml | 1 - .../dialer/app/res/values-sl/strings.xml | 1 - .../dialer/app/res/values-sq/strings.xml | 1 - .../dialer/app/res/values-sr/strings.xml | 1 - .../dialer/app/res/values-sv/strings.xml | 1 - .../dialer/app/res/values-sw/strings.xml | 1 - .../dialer/app/res/values-ta/strings.xml | 1 - .../dialer/app/res/values-te/strings.xml | 1 - .../dialer/app/res/values-th/strings.xml | 1 - .../dialer/app/res/values-tl/strings.xml | 1 - .../dialer/app/res/values-tr/strings.xml | 1 - .../dialer/app/res/values-uk/strings.xml | 1 - .../dialer/app/res/values-ur/strings.xml | 1 - .../dialer/app/res/values-uz/strings.xml | 1 - .../dialer/app/res/values-vi/strings.xml | 1 - .../dialer/app/res/values-zh-rCN/strings.xml | 1 - .../dialer/app/res/values-zh-rHK/strings.xml | 1 - .../dialer/app/res/values-zh-rTW/strings.xml | 1 - .../dialer/app/res/values-zu/strings.xml | 1 - .../android/dialer/app/res/values/colors.xml | 5 +-- .../android/dialer/app/res/values/strings.xml | 4 -- .../android/dialer/app/res/values/styles.xml | 12 ------ .../res/layout/call_details_entry.xml | 5 ++- .../res/layout/contact_container.xml | 2 +- .../res/layout/call_stats_detail.xml | 12 +++--- .../res/layout/call_stats_detail_info.xml | 1 - .../res/layout/double_date_picker_dialog.xml | 4 +- .../callstats/res/menu/call_stats_options.xml | 20 +++++----- .../drawable/searchedittext_custom_cursor.xml | 21 ---------- .../res/layout/default_account_checkbox.xml | 5 ++- .../res/layout/dialog_call_subject.xml | 1 - .../res/layout/add_contact_row.xml | 4 +- .../res/layout/fragment_contacts.xml | 8 ++-- .../res/layout-land/dialpad_key.xml | 2 +- .../res/layout-land/dialpad_key_one.xml | 9 +++-- .../res/layout-land/dialpad_key_pound.xml | 2 +- .../res/layout-land/dialpad_key_star.xml | 2 +- .../dialer/dialpadview/res/layout/dialpad.xml | 21 +++++----- .../res/layout/dialpad_view_unthemed.xml | 29 +++++++------- .../dialpadview/res/menu/dialpad_options.xml | 16 ++++---- .../dialpadview/res/values-af/strings.xml | 1 - .../dialpadview/res/values-am/strings.xml | 1 - .../dialpadview/res/values-ar/strings.xml | 1 - .../dialpadview/res/values-az/strings.xml | 1 - .../res/values-b+sr+Latn/strings.xml | 1 - .../dialpadview/res/values-be/strings.xml | 1 - .../dialpadview/res/values-bg/strings.xml | 1 - .../dialpadview/res/values-bn/strings.xml | 1 - .../dialpadview/res/values-bs/strings.xml | 1 - .../dialpadview/res/values-ca/strings.xml | 1 - .../dialpadview/res/values-cs/strings.xml | 1 - .../dialpadview/res/values-da/strings.xml | 1 - .../dialpadview/res/values-de/strings.xml | 1 - .../dialpadview/res/values-el/strings.xml | 1 - .../dialpadview/res/values-en-rAU/strings.xml | 1 - .../dialpadview/res/values-en-rGB/strings.xml | 1 - .../dialpadview/res/values-en-rIN/strings.xml | 1 - .../dialpadview/res/values-es-rUS/strings.xml | 1 - .../dialpadview/res/values-es/strings.xml | 1 - .../dialpadview/res/values-et/strings.xml | 1 - .../dialpadview/res/values-eu/strings.xml | 1 - .../dialpadview/res/values-fa/strings.xml | 1 - .../dialpadview/res/values-fi/strings.xml | 1 - .../dialpadview/res/values-fr-rCA/strings.xml | 1 - .../dialpadview/res/values-fr/strings.xml | 1 - .../dialpadview/res/values-gl/strings.xml | 1 - .../dialpadview/res/values-gu/strings.xml | 1 - .../dialpadview/res/values-hi/strings.xml | 1 - .../dialpadview/res/values-hr/strings.xml | 1 - .../dialpadview/res/values-hu/strings.xml | 1 - .../dialpadview/res/values-hy/strings.xml | 1 - .../dialpadview/res/values-in/strings.xml | 1 - .../dialpadview/res/values-is/strings.xml | 1 - .../dialpadview/res/values-it/strings.xml | 1 - .../dialpadview/res/values-iw/strings.xml | 1 - .../dialpadview/res/values-ja/strings.xml | 1 - .../dialpadview/res/values-ka/strings.xml | 1 - .../dialpadview/res/values-kk/strings.xml | 1 - .../dialpadview/res/values-km/strings.xml | 1 - .../dialpadview/res/values-kn/strings.xml | 1 - .../dialpadview/res/values-ko/strings.xml | 1 - .../dialpadview/res/values-ky/strings.xml | 1 - .../dialpadview/res/values-lo/strings.xml | 1 - .../dialpadview/res/values-lt/strings.xml | 1 - .../dialpadview/res/values-lv/strings.xml | 1 - .../dialpadview/res/values-mk/strings.xml | 1 - .../dialpadview/res/values-ml/strings.xml | 1 - .../dialpadview/res/values-mn/strings.xml | 1 - .../dialpadview/res/values-mr/strings.xml | 1 - .../dialpadview/res/values-ms/strings.xml | 1 - .../dialpadview/res/values-my/strings.xml | 1 - .../dialpadview/res/values-nb/strings.xml | 1 - .../dialpadview/res/values-ne/strings.xml | 1 - .../dialpadview/res/values-nl/strings.xml | 1 - .../dialpadview/res/values-no/strings.xml | 1 - .../dialpadview/res/values-pa/strings.xml | 1 - .../dialpadview/res/values-pl/strings.xml | 1 - .../dialpadview/res/values-pt-rBR/strings.xml | 1 - .../dialpadview/res/values-pt-rPT/strings.xml | 1 - .../dialpadview/res/values-pt/strings.xml | 1 - .../dialpadview/res/values-ro/strings.xml | 1 - .../dialpadview/res/values-ru/strings.xml | 1 - .../dialpadview/res/values-si/strings.xml | 1 - .../dialpadview/res/values-sk/strings.xml | 1 - .../dialpadview/res/values-sl/strings.xml | 1 - .../dialpadview/res/values-sq/strings.xml | 1 - .../dialpadview/res/values-sr/strings.xml | 1 - .../dialpadview/res/values-sv/strings.xml | 1 - .../dialpadview/res/values-sw/strings.xml | 1 - .../dialpadview/res/values-ta/strings.xml | 1 - .../dialpadview/res/values-te/strings.xml | 1 - .../dialpadview/res/values-th/strings.xml | 1 - .../dialpadview/res/values-tl/strings.xml | 1 - .../dialpadview/res/values-tr/strings.xml | 1 - .../dialpadview/res/values-uk/strings.xml | 1 - .../dialpadview/res/values-ur/strings.xml | 1 - .../dialpadview/res/values-uz/strings.xml | 1 - .../dialpadview/res/values-vi/strings.xml | 1 - .../dialpadview/res/values-zh-rCN/strings.xml | 1 - .../dialpadview/res/values-zh-rHK/strings.xml | 1 - .../dialpadview/res/values-zh-rTW/strings.xml | 1 - .../dialpadview/res/values-zu/strings.xml | 1 - .../dialer/dialpadview/res/values/dimens.xml | 2 - .../dialer/dialpadview/res/values/strings.xml | 4 -- .../res/layout/dialog_helpline_details.xml | 31 ++++++++------- .../helplines/res/menu/menu_helplines.xml | 9 +++-- .../dialer/helplines/res/values/styles.xml | 39 ------------------- .../dialer/lettertile/res/values/colors.xml | 24 ++++++------ .../toolbar/res/drawable/search_shadow.xml | 25 ------------ .../res/layout/expanded_search_bar.xml | 11 ++++-- .../toolbar/res/layout/toolbar_layout.xml | 14 ++++--- .../list/res/layout/search_action_layout.xml | 2 +- .../dialer/shortcuts/res/values/colors.xml | 2 +- .../simulator/service/AndroidManifest.xml | 4 +- .../layout/favorite_remove_view_layout.xml | 3 +- .../dialer/theme/base/res/values/attr.xml | 2 - .../base/res/values/theme_dialer_dark.xml | 11 +++--- .../base/res/values/theme_dialer_light.xml | 7 ++-- .../theme/common/res/values-night/colors.xml | 2 +- .../dialer/theme/common/res/values/colors.xml | 4 +- .../dialer/theme/common/res/values/dimens.xml | 2 - .../hidden/res/values/colors_dialer_dark.xml | 1 - .../hidden/res/values/colors_dialer_light.xml | 1 - .../dialer/theme/res/values-fa/strings.xml | 2 +- .../dialer/theme/res/values-lt/strings.xml | 2 +- .../res/layout/voicemail_tos_fragment.xml | 4 +- .../listui/error/res/values-th/strings.xml | 2 +- .../listui/error/res/values/dimens.xml | 2 - .../voicemail/listui/res/values/styles.xml | 8 ---- .../settings/VoicemailChangePinActivity.java | 2 +- .../res/layout/voicemail_change_pin.xml | 2 +- .../settings/res/values-af/strings.xml | 2 - .../settings/res/values-am/strings.xml | 2 - .../settings/res/values-ar/strings.xml | 2 - .../settings/res/values-az/strings.xml | 2 - .../settings/res/values-b+sr+Latn/strings.xml | 2 - .../settings/res/values-be/strings.xml | 2 - .../settings/res/values-bg/strings.xml | 2 - .../settings/res/values-bn/strings.xml | 2 - .../settings/res/values-bs/strings.xml | 2 - .../settings/res/values-ca/strings.xml | 2 - .../settings/res/values-cs/strings.xml | 2 - .../settings/res/values-da/strings.xml | 2 - .../settings/res/values-de/strings.xml | 2 - .../settings/res/values-el/strings.xml | 2 - .../settings/res/values-en-rAU/strings.xml | 2 - .../settings/res/values-en-rGB/strings.xml | 2 - .../settings/res/values-en-rIN/strings.xml | 2 - .../settings/res/values-es-rUS/strings.xml | 2 - .../settings/res/values-es/strings.xml | 2 - .../settings/res/values-et/strings.xml | 2 - .../settings/res/values-eu/strings.xml | 2 - .../settings/res/values-fa/strings.xml | 2 - .../settings/res/values-fi/strings.xml | 2 - .../settings/res/values-fr-rCA/strings.xml | 2 - .../settings/res/values-fr/strings.xml | 2 - .../settings/res/values-gl/strings.xml | 2 - .../settings/res/values-gu/strings.xml | 2 - .../settings/res/values-hi/strings.xml | 2 - .../settings/res/values-hr/strings.xml | 2 - .../settings/res/values-hu/strings.xml | 2 - .../settings/res/values-hy/strings.xml | 2 - .../settings/res/values-in/strings.xml | 2 - .../settings/res/values-is/strings.xml | 2 - .../settings/res/values-it/strings.xml | 2 - .../settings/res/values-iw/strings.xml | 2 - .../settings/res/values-ja/strings.xml | 2 - .../settings/res/values-ka/strings.xml | 2 - .../settings/res/values-kk/strings.xml | 2 - .../settings/res/values-km/strings.xml | 2 - .../settings/res/values-kn/strings.xml | 2 - .../settings/res/values-ko/strings.xml | 2 - .../settings/res/values-ky/strings.xml | 2 - .../settings/res/values-lo/strings.xml | 2 - .../settings/res/values-lt/strings.xml | 2 - .../settings/res/values-lv/strings.xml | 2 - .../settings/res/values-mk/strings.xml | 2 - .../settings/res/values-ml/strings.xml | 2 - .../settings/res/values-mn/strings.xml | 2 - .../settings/res/values-mr/strings.xml | 2 - .../settings/res/values-ms/strings.xml | 2 - .../settings/res/values-my/strings.xml | 2 - .../settings/res/values-nb/strings.xml | 2 - .../settings/res/values-ne/strings.xml | 2 - .../settings/res/values-nl/strings.xml | 2 - .../settings/res/values-no/strings.xml | 2 - .../settings/res/values-pa/strings.xml | 2 - .../settings/res/values-pl/strings.xml | 2 - .../settings/res/values-pt-rBR/strings.xml | 2 - .../settings/res/values-pt-rPT/strings.xml | 2 - .../settings/res/values-pt/strings.xml | 2 - .../settings/res/values-ro/strings.xml | 2 - .../settings/res/values-ru/strings.xml | 2 - .../settings/res/values-si/strings.xml | 2 - .../settings/res/values-sk/strings.xml | 2 - .../settings/res/values-sl/strings.xml | 2 - .../settings/res/values-sq/strings.xml | 2 - .../settings/res/values-sr/strings.xml | 2 - .../settings/res/values-sv/strings.xml | 2 - .../settings/res/values-sw/strings.xml | 2 - .../settings/res/values-ta/strings.xml | 2 - .../settings/res/values-te/strings.xml | 2 - .../settings/res/values-th/strings.xml | 2 - .../settings/res/values-tl/strings.xml | 2 - .../settings/res/values-tr/strings.xml | 2 - .../settings/res/values-uk/strings.xml | 2 - .../settings/res/values-ur/strings.xml | 2 - .../settings/res/values-uz/strings.xml | 2 - .../settings/res/values-vi/strings.xml | 2 - .../settings/res/values-zh-rCN/strings.xml | 2 - .../settings/res/values-zh-rHK/strings.xml | 2 - .../settings/res/values-zh-rTW/strings.xml | 2 - .../settings/res/values-zu/strings.xml | 2 - .../voicemail/settings/res/values/strings.xml | 4 -- .../res/layout/swipe_up_down_method.xml | 2 + .../res/layout/fragment_incoming_call.xml | 6 ++- .../audioroute/res/layout/audioroute_item.xml | 6 ++- .../res/layout/audioroute_selector.xml | 14 ++++--- .../commontheme/res/animator/button_state.xml | 1 - .../commontheme/res/values-night/colors.xml | 2 +- .../commontheme/res/values/colors.xml | 2 +- .../res/layout/caller_in_conference.xml | 6 ++- .../res/values-mcc262-mnc02/strings.xml | 6 +-- .../incallui/spam/res/values-af/strings.xml | 4 -- .../incallui/spam/res/values-am/strings.xml | 4 -- .../incallui/spam/res/values-ar/strings.xml | 4 -- .../incallui/spam/res/values-az/strings.xml | 4 -- .../spam/res/values-b+sr+Latn/strings.xml | 4 -- .../incallui/spam/res/values-be/strings.xml | 4 -- .../incallui/spam/res/values-bg/strings.xml | 4 -- .../incallui/spam/res/values-bn/strings.xml | 4 -- .../incallui/spam/res/values-bs/strings.xml | 4 -- .../incallui/spam/res/values-ca/strings.xml | 4 -- .../incallui/spam/res/values-cs/strings.xml | 4 -- .../incallui/spam/res/values-da/strings.xml | 4 -- .../incallui/spam/res/values-de/strings.xml | 4 -- .../incallui/spam/res/values-el/strings.xml | 4 -- .../spam/res/values-en-rAU/strings.xml | 4 -- .../spam/res/values-en-rGB/strings.xml | 4 -- .../spam/res/values-en-rIN/strings.xml | 4 -- .../spam/res/values-es-rUS/strings.xml | 4 -- .../incallui/spam/res/values-es/strings.xml | 4 -- .../incallui/spam/res/values-et/strings.xml | 4 -- .../incallui/spam/res/values-eu/strings.xml | 4 -- .../incallui/spam/res/values-fa/strings.xml | 4 -- .../incallui/spam/res/values-fi/strings.xml | 4 -- .../spam/res/values-fr-rCA/strings.xml | 4 -- .../incallui/spam/res/values-fr/strings.xml | 4 -- .../incallui/spam/res/values-gl/strings.xml | 4 -- .../incallui/spam/res/values-gu/strings.xml | 4 -- .../incallui/spam/res/values-hi/strings.xml | 4 -- .../incallui/spam/res/values-hr/strings.xml | 4 -- .../incallui/spam/res/values-hu/strings.xml | 4 -- .../incallui/spam/res/values-hy/strings.xml | 4 -- .../incallui/spam/res/values-in/strings.xml | 4 -- .../incallui/spam/res/values-is/strings.xml | 4 -- .../incallui/spam/res/values-it/strings.xml | 4 -- .../incallui/spam/res/values-iw/strings.xml | 4 -- .../incallui/spam/res/values-ja/strings.xml | 4 -- .../incallui/spam/res/values-ka/strings.xml | 4 -- .../incallui/spam/res/values-kk/strings.xml | 4 -- .../incallui/spam/res/values-km/strings.xml | 4 -- .../incallui/spam/res/values-kn/strings.xml | 4 -- .../incallui/spam/res/values-ko/strings.xml | 4 -- .../incallui/spam/res/values-ky/strings.xml | 4 -- .../incallui/spam/res/values-lo/strings.xml | 4 -- .../incallui/spam/res/values-lt/strings.xml | 4 -- .../incallui/spam/res/values-lv/strings.xml | 4 -- .../incallui/spam/res/values-mk/strings.xml | 4 -- .../incallui/spam/res/values-ml/strings.xml | 4 -- .../incallui/spam/res/values-mn/strings.xml | 4 -- .../incallui/spam/res/values-mr/strings.xml | 4 -- .../incallui/spam/res/values-ms/strings.xml | 4 -- .../incallui/spam/res/values-my/strings.xml | 4 -- .../incallui/spam/res/values-nb/strings.xml | 4 -- .../incallui/spam/res/values-ne/strings.xml | 4 -- .../incallui/spam/res/values-nl/strings.xml | 4 -- .../incallui/spam/res/values-no/strings.xml | 4 -- .../incallui/spam/res/values-pa/strings.xml | 4 -- .../incallui/spam/res/values-pl/strings.xml | 4 -- .../spam/res/values-pt-rBR/strings.xml | 4 -- .../spam/res/values-pt-rPT/strings.xml | 4 -- .../incallui/spam/res/values-pt/strings.xml | 4 -- .../incallui/spam/res/values-ro/strings.xml | 4 -- .../incallui/spam/res/values-ru/strings.xml | 4 -- .../incallui/spam/res/values-si/strings.xml | 4 -- .../incallui/spam/res/values-sk/strings.xml | 4 -- .../incallui/spam/res/values-sl/strings.xml | 4 -- .../incallui/spam/res/values-sq/strings.xml | 4 -- .../incallui/spam/res/values-sr/strings.xml | 4 -- .../incallui/spam/res/values-sv/strings.xml | 4 -- .../incallui/spam/res/values-sw/strings.xml | 4 -- .../incallui/spam/res/values-ta/strings.xml | 4 -- .../incallui/spam/res/values-te/strings.xml | 4 -- .../incallui/spam/res/values-th/strings.xml | 4 -- .../incallui/spam/res/values-tl/strings.xml | 4 -- .../incallui/spam/res/values-tr/strings.xml | 4 -- .../incallui/spam/res/values-uk/strings.xml | 4 -- .../incallui/spam/res/values-ur/strings.xml | 4 -- .../incallui/spam/res/values-uz/strings.xml | 4 -- .../incallui/spam/res/values-vi/strings.xml | 4 -- .../spam/res/values-zh-rCN/strings.xml | 4 -- .../spam/res/values-zh-rHK/strings.xml | 4 -- .../spam/res/values-zh-rTW/strings.xml | 4 -- .../incallui/spam/res/values-zu/strings.xml | 4 -- .../incallui/spam/res/values/strings.xml | 8 ---- .../drawable/incall_background_gradient.xml | 23 ----------- .../incallui/theme/res/values/colors.xml | 8 ++-- .../video/impl/res/layout/frag_videocall.xml | 21 +++++----- .../impl/res/layout/frag_videocall_land.xml | 15 ++++--- .../res/layout/frag_videocall_surfaceview.xml | 10 +++-- 398 files changed, 223 insertions(+), 1005 deletions(-) delete mode 100644 java/com/android/dialer/contacts/resources/res/drawable/searchedittext_custom_cursor.xml delete mode 100755 java/com/android/dialer/helplines/res/values/styles.xml delete mode 100644 java/com/android/dialer/main/impl/toolbar/res/drawable/search_shadow.xml delete mode 100644 java/com/android/incallui/theme/res/drawable/incall_background_gradient.xml diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ba591d2e4c..d4bb822057 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -14,7 +14,8 @@ --> @@ -107,7 +108,8 @@ android:label="@string/call_stats_detail_title" android:theme="@style/Dialer.ThemeBase.NoActionBar" android:exported="true" - android:screenOrientation="portrait"> + android:screenOrientation="portrait" + tools:ignore="LockedOrientationActivity"> diff --git a/java/com/android/dialer/app/res/layout/call_log_fragment.xml b/java/com/android/dialer/app/res/layout/call_log_fragment.xml index 5555f97c4f..09780aab19 100644 --- a/java/com/android/dialer/app/res/layout/call_log_fragment.xml +++ b/java/com/android/dialer/app/res/layout/call_log_fragment.xml @@ -44,7 +44,7 @@ android:id="@+id/select_all_view_text" android:layout_width="wrap_content" android:layout_height="match_parent" - android:paddingLeft="@dimen/select_all_text_left_padding" + android:paddingStart="@dimen/select_all_text_left_padding" android:gravity="center_vertical" android:text="@string/select_all" android:textAllCaps="true" diff --git a/java/com/android/dialer/app/res/menu/call_log_options.xml b/java/com/android/dialer/app/res/menu/call_log_options.xml index e78b72e3c9..abe869b2bb 100644 --- a/java/com/android/dialer/app/res/menu/call_log_options.xml +++ b/java/com/android/dialer/app/res/menu/call_log_options.xml @@ -1,5 +1,7 @@ - - + + android:title="@string/call_log_delete_all" + app:showAsAction="never" /> diff --git a/java/com/android/dialer/app/res/values-af/strings.xml b/java/com/android/dialer/app/res/values-af/strings.xml index 36e3a16f02..f87e01ac9e 100644 --- a/java/com/android/dialer/app/res/values-af/strings.xml +++ b/java/com/android/dialer/app/res/values-af/strings.xml @@ -33,7 +33,6 @@ Soek terugspeelposisie Oproepgeskiedenis Meer opsies - sleutelblok Instellings Gaan tans grootmaathandelingmodus in Het grootmaathandelingmodus verlaat diff --git a/java/com/android/dialer/app/res/values-am/strings.xml b/java/com/android/dialer/app/res/values-am/strings.xml index f21d8ffea8..01b58aa0d7 100644 --- a/java/com/android/dialer/app/res/values-am/strings.xml +++ b/java/com/android/dialer/app/res/values-am/strings.xml @@ -33,7 +33,6 @@ የመልሶ ማጫወት ቦታ ይፈልጉ የጥሪ ታሪክ ተጨማሪ አማራጮች - ቁልፍ ሰሌዳ ቅንብሮች ወደ የጅምላ እርምጃ ሁነታ በመግባት ላይ ከጅምላ እርምጃ ሁነታ ለቀው ወጥተዋል diff --git a/java/com/android/dialer/app/res/values-ar/strings.xml b/java/com/android/dialer/app/res/values-ar/strings.xml index 072b2424cf..6bc1249f5b 100644 --- a/java/com/android/dialer/app/res/values-ar/strings.xml +++ b/java/com/android/dialer/app/res/values-ar/strings.xml @@ -37,7 +37,6 @@ طلب موضع تشغيل سجل المكالمات مزيد من الخيارات - لوحة المفاتيح الإعدادات يتم الدخول إلى وضع الإجراء المجمَّع تمت مغادرة وضع الإجراء المجمَّع diff --git a/java/com/android/dialer/app/res/values-az/strings.xml b/java/com/android/dialer/app/res/values-az/strings.xml index ea51441e05..dbfe2a51f3 100644 --- a/java/com/android/dialer/app/res/values-az/strings.xml +++ b/java/com/android/dialer/app/res/values-az/strings.xml @@ -33,7 +33,6 @@ Oxutma pozisiyası axtarın Zəng tarixçəsi Daha çox seçim - klaviatura Ayarlar Toplu əməliyyat rejiminə daxil olunur Toplu əməliyyat rejimi tərk edilir diff --git a/java/com/android/dialer/app/res/values-b+sr+Latn/strings.xml b/java/com/android/dialer/app/res/values-b+sr+Latn/strings.xml index 6fab3a2e9a..f51b5d03a4 100644 --- a/java/com/android/dialer/app/res/values-b+sr+Latn/strings.xml +++ b/java/com/android/dialer/app/res/values-b+sr+Latn/strings.xml @@ -34,7 +34,6 @@ Traženje pozicije u reprodukciji Istorija poziva Još opcija - tastatura Podešavanja Ulazite u režim grupnih radnji Izašli ste iz režima grupnih radnji diff --git a/java/com/android/dialer/app/res/values-be/strings.xml b/java/com/android/dialer/app/res/values-be/strings.xml index 2ece35b4c8..16faf48a62 100644 --- a/java/com/android/dialer/app/res/values-be/strings.xml +++ b/java/com/android/dialer/app/res/values-be/strings.xml @@ -35,7 +35,6 @@ Шукаць становішча прайгравання Гісторыя выклікаў Дадатковыя параметры - клавіятура Налады Уваход у рэжым групавога дзеяння Выхад з рэжыму групавога дзеяння diff --git a/java/com/android/dialer/app/res/values-bg/strings.xml b/java/com/android/dialer/app/res/values-bg/strings.xml index 56211c1c92..717b729ade 100644 --- a/java/com/android/dialer/app/res/values-bg/strings.xml +++ b/java/com/android/dialer/app/res/values-bg/strings.xml @@ -33,7 +33,6 @@ Търсене на позиция за възпроизвеждане История на обажданията Още опции - цифрова клавиатура Настройки Влизате в режима на групови действия Излязохте от режима на групови действия diff --git a/java/com/android/dialer/app/res/values-bn/strings.xml b/java/com/android/dialer/app/res/values-bn/strings.xml index b188a58b64..42be05892d 100644 --- a/java/com/android/dialer/app/res/values-bn/strings.xml +++ b/java/com/android/dialer/app/res/values-bn/strings.xml @@ -33,7 +33,6 @@ প্লেব্যাক লোকেশন খুঁজুন কলের ইতিহাস আরও বিকল্প - কীপ্যাড সেটিংস বাল্ক অ্যাকশন মোডে প্রবেশ করা হচ্ছে বাল্ক অ্যাকশন মোড ত্যাগ করুন diff --git a/java/com/android/dialer/app/res/values-bs/strings.xml b/java/com/android/dialer/app/res/values-bs/strings.xml index c1aaafd10e..daf71cfec0 100644 --- a/java/com/android/dialer/app/res/values-bs/strings.xml +++ b/java/com/android/dialer/app/res/values-bs/strings.xml @@ -34,7 +34,6 @@ Traženje položaja reprodukcije Historija poziva Više opcija - telefonska tastatura Postavke Ulazak u način rada za skupnu radnju Napuštanje načina rada za skupnu radnju diff --git a/java/com/android/dialer/app/res/values-ca/strings.xml b/java/com/android/dialer/app/res/values-ca/strings.xml index 31f95c20b2..0d4d73651c 100644 --- a/java/com/android/dialer/app/res/values-ca/strings.xml +++ b/java/com/android/dialer/app/res/values-ca/strings.xml @@ -33,7 +33,6 @@ Cerca la posició de la reproducció Historial de trucades Més opcions - teclat Configuració S\'està accedint al mode d\'acció massiva S\'ha sortit del mode d\'acció massiva diff --git a/java/com/android/dialer/app/res/values-cs/strings.xml b/java/com/android/dialer/app/res/values-cs/strings.xml index 66547f00e6..94d0b74430 100644 --- a/java/com/android/dialer/app/res/values-cs/strings.xml +++ b/java/com/android/dialer/app/res/values-cs/strings.xml @@ -35,7 +35,6 @@ Vyhledání pozice přehrávání Historie volání Více možností - klávesnice Nastavení Vstupování do režimu hromadných akcí Opustili jste režim hromadných akcí diff --git a/java/com/android/dialer/app/res/values-da/strings.xml b/java/com/android/dialer/app/res/values-da/strings.xml index 88f10b03e5..a18205c7f9 100644 --- a/java/com/android/dialer/app/res/values-da/strings.xml +++ b/java/com/android/dialer/app/res/values-da/strings.xml @@ -33,7 +33,6 @@ Søg efter afspilningsposition Opkaldshistorik Flere valgmuligheder - tastatur Indstillinger Massehandlingstilstanden startes Massehandlingstilstanden blev afsluttet diff --git a/java/com/android/dialer/app/res/values-de/strings.xml b/java/com/android/dialer/app/res/values-de/strings.xml index 6d39b1e2c5..112d5666d4 100644 --- a/java/com/android/dialer/app/res/values-de/strings.xml +++ b/java/com/android/dialer/app/res/values-de/strings.xml @@ -33,7 +33,6 @@ Wiedergabeposition suchen Anrufliste Mehr Optionen - Wähltasten Einstellungen Es wird in den Modus für Bulk-Aktionen gewechselt Der Modus für Bulk-Aktionen wurde verlassen diff --git a/java/com/android/dialer/app/res/values-el/strings.xml b/java/com/android/dialer/app/res/values-el/strings.xml index 3bc900b0bb..c8fb3d898f 100644 --- a/java/com/android/dialer/app/res/values-el/strings.xml +++ b/java/com/android/dialer/app/res/values-el/strings.xml @@ -33,7 +33,6 @@ Αναζήτηση θέσης αναπαραγωγής Ιστορικό κλήσεων Περισσότερες επιλογές - πληκτρολόγιο Ρυθμίσεις Εισαγωγή στη λειτουργία μαζικών ενεργειών Αποχώρηση από τη λειτουργία μαζικών ενεργειών diff --git a/java/com/android/dialer/app/res/values-en-rAU/strings.xml b/java/com/android/dialer/app/res/values-en-rAU/strings.xml index 17e4c9dbf4..3825948772 100644 --- a/java/com/android/dialer/app/res/values-en-rAU/strings.xml +++ b/java/com/android/dialer/app/res/values-en-rAU/strings.xml @@ -33,7 +33,6 @@ Seek playback position Call history More options - key pad Settings Entering bulk action mode Left bulk action mode diff --git a/java/com/android/dialer/app/res/values-en-rGB/strings.xml b/java/com/android/dialer/app/res/values-en-rGB/strings.xml index 17e4c9dbf4..3825948772 100644 --- a/java/com/android/dialer/app/res/values-en-rGB/strings.xml +++ b/java/com/android/dialer/app/res/values-en-rGB/strings.xml @@ -33,7 +33,6 @@ Seek playback position Call history More options - key pad Settings Entering bulk action mode Left bulk action mode diff --git a/java/com/android/dialer/app/res/values-en-rIN/strings.xml b/java/com/android/dialer/app/res/values-en-rIN/strings.xml index 17e4c9dbf4..3825948772 100644 --- a/java/com/android/dialer/app/res/values-en-rIN/strings.xml +++ b/java/com/android/dialer/app/res/values-en-rIN/strings.xml @@ -33,7 +33,6 @@ Seek playback position Call history More options - key pad Settings Entering bulk action mode Left bulk action mode diff --git a/java/com/android/dialer/app/res/values-es-rUS/strings.xml b/java/com/android/dialer/app/res/values-es-rUS/strings.xml index d42d667b4c..c6fafe08a3 100644 --- a/java/com/android/dialer/app/res/values-es-rUS/strings.xml +++ b/java/com/android/dialer/app/res/values-es-rUS/strings.xml @@ -33,7 +33,6 @@ Busca la posición de reproducción Historial de llamadas Más opciones - teclado Configuración Entrando al modo de acción masiva Saliendo del modo de acción masiva diff --git a/java/com/android/dialer/app/res/values-es/strings.xml b/java/com/android/dialer/app/res/values-es/strings.xml index fb7ce7fc36..e9a1b40f9d 100644 --- a/java/com/android/dialer/app/res/values-es/strings.xml +++ b/java/com/android/dialer/app/res/values-es/strings.xml @@ -33,7 +33,6 @@ Buscar posición de reproducción Historial de llamadas Más opciones - teclado Ajustes Entrando en el modo de acción en bloque Se ha salido del modo de acción en bloque diff --git a/java/com/android/dialer/app/res/values-et/strings.xml b/java/com/android/dialer/app/res/values-et/strings.xml index bb5f936515..a0a3a9b5b6 100644 --- a/java/com/android/dialer/app/res/values-et/strings.xml +++ b/java/com/android/dialer/app/res/values-et/strings.xml @@ -33,7 +33,6 @@ Taasesituse positsiooni otsimine Kõneajalugu Rohkem valikuid - klaviatuur Seaded Sisenemine hulgitoimingute režiimi Lahkumine hulgitoimingute režiimist diff --git a/java/com/android/dialer/app/res/values-eu/strings.xml b/java/com/android/dialer/app/res/values-eu/strings.xml index 54368b39ce..3cb6ca29f6 100644 --- a/java/com/android/dialer/app/res/values-eu/strings.xml +++ b/java/com/android/dialer/app/res/values-eu/strings.xml @@ -33,7 +33,6 @@ Bilatu erreprodukzioaren posizioa Deien historia Aukera gehiago - teklatua Ezarpenak Ekintzak multzoka gauzatzeko modua aktibatzen Ekintzak multzoka gauzatzeko modua desaktibatu da diff --git a/java/com/android/dialer/app/res/values-fa/strings.xml b/java/com/android/dialer/app/res/values-fa/strings.xml index f4c5b0b1ba..cdfe73718a 100644 --- a/java/com/android/dialer/app/res/values-fa/strings.xml +++ b/java/com/android/dialer/app/res/values-fa/strings.xml @@ -33,7 +33,6 @@ جستجوی موقعیت بازپخش سابقه تماس گزینه‌های بیشتر - صفحه کلید تنظیمات درحال ورود به حالت اقدام انبوه خروج از حالت اقدام انبوه diff --git a/java/com/android/dialer/app/res/values-fi/strings.xml b/java/com/android/dialer/app/res/values-fi/strings.xml index 812697d373..7a350363d6 100644 --- a/java/com/android/dialer/app/res/values-fi/strings.xml +++ b/java/com/android/dialer/app/res/values-fi/strings.xml @@ -33,7 +33,6 @@ Toisto-osoitin Soittohistoria Lisää vaihtoehtoja - näppäimistö Asetukset Siirrytään joukkotoimintotilaan. Poistuttiin joukkotoimintotilasta. diff --git a/java/com/android/dialer/app/res/values-fr-rCA/strings.xml b/java/com/android/dialer/app/res/values-fr-rCA/strings.xml index 42292a9a1a..975ba8ee0d 100644 --- a/java/com/android/dialer/app/res/values-fr-rCA/strings.xml +++ b/java/com/android/dialer/app/res/values-fr-rCA/strings.xml @@ -33,7 +33,6 @@ Rechercher une position de lecture Historique des appels Plus d\'options - clavier Paramètres Entrée du mode d\'action groupée en cours… Mode d\'action groupée quitté diff --git a/java/com/android/dialer/app/res/values-fr/strings.xml b/java/com/android/dialer/app/res/values-fr/strings.xml index 6d5cfad6ad..68e6583077 100644 --- a/java/com/android/dialer/app/res/values-fr/strings.xml +++ b/java/com/android/dialer/app/res/values-fr/strings.xml @@ -33,7 +33,6 @@ Rechercher une position de lecture Historique des appels Plus d\'options - Clavier Paramètres Activation du mode d\'action groupée Désactivation du mode d\'action groupée @@ -70,14 +69,8 @@ Ajouter à un contact Envoyer un SMS Passer un appel vidéo - Bloquer le numéro - Aucun contact pour la numérotation abrégée - Ajouter un favori - Supprimer Tout sélectionner Appel vidéo - Configurer l\'appel vidéo - Inviter à l\'appel vidéo Envoyer un message Informations sur l\'appel Envoyer à… diff --git a/java/com/android/dialer/app/res/values-gl/strings.xml b/java/com/android/dialer/app/res/values-gl/strings.xml index d0a63e1577..03456287f2 100644 --- a/java/com/android/dialer/app/res/values-gl/strings.xml +++ b/java/com/android/dialer/app/res/values-gl/strings.xml @@ -33,7 +33,6 @@ Buscar posición de reprodución Historial de chamadas Máis opcións - Teclado Configuración Entrando no modo de acción en bloque Saíu do modo de acción en bloque diff --git a/java/com/android/dialer/app/res/values-gu/strings.xml b/java/com/android/dialer/app/res/values-gu/strings.xml index 68b0e84104..7d3435c14b 100644 --- a/java/com/android/dialer/app/res/values-gu/strings.xml +++ b/java/com/android/dialer/app/res/values-gu/strings.xml @@ -33,7 +33,6 @@ પ્લેબેક સ્થિતિ શોધો કૉલ ઇતિહાસ વધુ વિકલ્પો - કી પેડ સેટિંગ્સ બલ્ક ક્રિયા મોડમાં દાખલ થઈ રહ્યાં છે બલ્ક ક્રિયા મોડ છોડી દીધો diff --git a/java/com/android/dialer/app/res/values-hi/strings.xml b/java/com/android/dialer/app/res/values-hi/strings.xml index 2db69adb60..28c9c615ff 100644 --- a/java/com/android/dialer/app/res/values-hi/strings.xml +++ b/java/com/android/dialer/app/res/values-hi/strings.xml @@ -33,7 +33,6 @@ प्लेबैक स्थिति का पता लगाएं कॉल इतिहास अधिक विकल्प - कीपैड सेटिंग बल्क कार्रवाई मोड में प्रवेश कर रहे हैं बल्क कार्रवाई मोड छोड़ा diff --git a/java/com/android/dialer/app/res/values-hr/strings.xml b/java/com/android/dialer/app/res/values-hr/strings.xml index 9afe3808f0..7ffbf3fef7 100644 --- a/java/com/android/dialer/app/res/values-hr/strings.xml +++ b/java/com/android/dialer/app/res/values-hr/strings.xml @@ -34,7 +34,6 @@ Traženje položaja reprodukcije Povijest poziva Više opcija - tipkovnica Postavke Ulazak u način skupne radnje Napuštanje načina skupne radnje diff --git a/java/com/android/dialer/app/res/values-hu/strings.xml b/java/com/android/dialer/app/res/values-hu/strings.xml index 17b238dbd6..0babfbfc4f 100644 --- a/java/com/android/dialer/app/res/values-hu/strings.xml +++ b/java/com/android/dialer/app/res/values-hu/strings.xml @@ -33,7 +33,6 @@ Lejátszási pozíció módosítása Híváslista További beállítások - billentyűzet Beállítások Belépés tömeges műveleti módba Kilépett a tömeges műveleti módból diff --git a/java/com/android/dialer/app/res/values-hy/strings.xml b/java/com/android/dialer/app/res/values-hy/strings.xml index 4c5baedde8..14f7ec249a 100644 --- a/java/com/android/dialer/app/res/values-hy/strings.xml +++ b/java/com/android/dialer/app/res/values-hy/strings.xml @@ -33,7 +33,6 @@ Փնտրել նվագարկման դիրքը Զանգերի պատմություն Այլ ընտրանքներ - ստեղնաշար Կարգավորումներ Դուք մտել եք զանգվածային գործողության ռեժիմ Դուք դուրս եկաք զանգվածային գործողությունների ռեժիմից diff --git a/java/com/android/dialer/app/res/values-in/strings.xml b/java/com/android/dialer/app/res/values-in/strings.xml index 06b50dfb4d..0d43c63e74 100644 --- a/java/com/android/dialer/app/res/values-in/strings.xml +++ b/java/com/android/dialer/app/res/values-in/strings.xml @@ -33,7 +33,6 @@ Mencari posisi pemutaran Histori panggilan Opsi lainnya - keypad Setelan Masuk ke mode tindakan massal Keluar dari mode tindakan massal diff --git a/java/com/android/dialer/app/res/values-is/strings.xml b/java/com/android/dialer/app/res/values-is/strings.xml index ff2892a34d..055337e0eb 100644 --- a/java/com/android/dialer/app/res/values-is/strings.xml +++ b/java/com/android/dialer/app/res/values-is/strings.xml @@ -33,7 +33,6 @@ Breyta spilunarstöðu Símtalaferill Fleiri valkostir - talnaborð Stillingar Opnar fjöldaaðgerðastillingu Fjöldaaðgerðastillingu lokað diff --git a/java/com/android/dialer/app/res/values-it/strings.xml b/java/com/android/dialer/app/res/values-it/strings.xml index 67b90ed0a3..9d97fcd2f9 100644 --- a/java/com/android/dialer/app/res/values-it/strings.xml +++ b/java/com/android/dialer/app/res/values-it/strings.xml @@ -33,7 +33,6 @@ Cerca posizione di riproduzione Cronologia chiamate Altre opzioni - tastierino Impostazioni Attivazione della modalità di azione collettiva Disttivazione della modalità di azione collettiva diff --git a/java/com/android/dialer/app/res/values-iw/strings.xml b/java/com/android/dialer/app/res/values-iw/strings.xml index 543a1e3a94..194ba7f9c8 100644 --- a/java/com/android/dialer/app/res/values-iw/strings.xml +++ b/java/com/android/dialer/app/res/values-iw/strings.xml @@ -35,7 +35,6 @@ חפש מיקום בהפעלה היסטוריית שיחות אפשרויות נוספות - לוח חיוג הגדרות עברת למצב של ביצוע פעולות בכמות גדולה עזבת את המצב של ביצוע פעולות בכמות גדולה diff --git a/java/com/android/dialer/app/res/values-ja/strings.xml b/java/com/android/dialer/app/res/values-ja/strings.xml index 164485d3d5..0959be90b8 100644 --- a/java/com/android/dialer/app/res/values-ja/strings.xml +++ b/java/com/android/dialer/app/res/values-ja/strings.xml @@ -33,7 +33,6 @@ 再生位置を探す 通話履歴 その他のオプション - キーパッド 設定 一括操作モードを開始します 一括操作モードを終了しました diff --git a/java/com/android/dialer/app/res/values-ka/strings.xml b/java/com/android/dialer/app/res/values-ka/strings.xml index 6f4d08c29c..4912b51474 100644 --- a/java/com/android/dialer/app/res/values-ka/strings.xml +++ b/java/com/android/dialer/app/res/values-ka/strings.xml @@ -33,7 +33,6 @@ დაკვრის პოზიციის მოძებნა ზარების ისტორია სხვა პარამეტრები - კლავიატურა პარამეტრები მიმდინარეობს ერთიანი ქმედების რეჟიმში შესვლა ერთიანი ქმედების რეჟიმიდან გამოხვედით diff --git a/java/com/android/dialer/app/res/values-kk/strings.xml b/java/com/android/dialer/app/res/values-kk/strings.xml index ffb48e7500..da8c236585 100644 --- a/java/com/android/dialer/app/res/values-kk/strings.xml +++ b/java/com/android/dialer/app/res/values-kk/strings.xml @@ -33,7 +33,6 @@ Ойнату орнын іздеу Қоңыраулар тарихы Басқа опциялар - пернетақта Параметрлер Жаппай әрекет режиміне өту Жаппай әрекет режиімінен шығу diff --git a/java/com/android/dialer/app/res/values-km/strings.xml b/java/com/android/dialer/app/res/values-km/strings.xml index 52b5d96f54..904245cf3e 100644 --- a/java/com/android/dialer/app/res/values-km/strings.xml +++ b/java/com/android/dialer/app/res/values-km/strings.xml @@ -33,7 +33,6 @@ រកមើល​ទីតាំង​ចាក់​ឡើងវិញ ប្រវត្តិហៅ ជម្រើស​បន្ថែម - បន្ទះ​​ចុច​លេខ ការកំណត់ ចូល​មុខងារ​សកម្មភាព​ច្រើន បាន​ចាកចេញ​ពី​មុខងារ​សកម្មភាព​ច្រើន diff --git a/java/com/android/dialer/app/res/values-kn/strings.xml b/java/com/android/dialer/app/res/values-kn/strings.xml index 43bdb38129..f833e070ba 100644 --- a/java/com/android/dialer/app/res/values-kn/strings.xml +++ b/java/com/android/dialer/app/res/values-kn/strings.xml @@ -33,7 +33,6 @@ ಪ್ಲೇಬ್ಯಾಕ್ ಸ್ಥಾನವನ್ನು ಪಡೆಯಿರಿ ಕರೆ ಇತಿಹಾಸ ಇನ್ನಷ್ಟು ಆಯ್ಕೆಗಳು - ಕೀ ಪ್ಯಾಡ್‌ ಸೆಟ್ಟಿಂಗ್‌ಗಳು ದೊಡ್ಡ ಪ್ರಮಾಣದ ಕ್ರಿಯೆಯ ಮೋಡ್‌ಗೆ ಪ್ರವೇಶಿಸಲಾಗುತ್ತಿದೆ ದೊಡ್ಡ ಪ್ರಮಾಣದ ಕ್ರಿಯೆಯ ಮೋಡ್ ತೊರೆಯಲಾಗಿದೆ diff --git a/java/com/android/dialer/app/res/values-ko/strings.xml b/java/com/android/dialer/app/res/values-ko/strings.xml index 1558671073..156077040d 100644 --- a/java/com/android/dialer/app/res/values-ko/strings.xml +++ b/java/com/android/dialer/app/res/values-ko/strings.xml @@ -33,7 +33,6 @@ 재생 위치 찾기 통화 기록 옵션 더보기 - 키패드 설정 일괄 작업 모드 시작 중 일괄 작업 모드 종료됨 diff --git a/java/com/android/dialer/app/res/values-ky/strings.xml b/java/com/android/dialer/app/res/values-ky/strings.xml index 160ef3946a..22b4e33d51 100644 --- a/java/com/android/dialer/app/res/values-ky/strings.xml +++ b/java/com/android/dialer/app/res/values-ky/strings.xml @@ -33,7 +33,6 @@ Ойнотуунун жайгашкан жерин издөө Чалуулар таржымалы Көбүрөөк мүмкүнчүлүктөр - номер тергич Жөндөөлөр Жапырт аракет режимине кирдиңиз Жапырт аракет режиминен чыктыңыз diff --git a/java/com/android/dialer/app/res/values-lo/strings.xml b/java/com/android/dialer/app/res/values-lo/strings.xml index 36df91acf7..f2c8cf8eb6 100644 --- a/java/com/android/dialer/app/res/values-lo/strings.xml +++ b/java/com/android/dialer/app/res/values-lo/strings.xml @@ -33,7 +33,6 @@ ​ຊອກ​ຫາ​ຕຳ​​ແໜ່ງ​ຫຼິ້ນ ປະຫວັດການໂທ ໂຕເລືອກເພີ່ມເຕີມ - ແປ້ນກົດ ການ​ຕັ້ງ​ຄ່າ ກຳລັງເຂົ້າໂໝດຄຳສັ່ງຈຳນວນຫຼາຍ ອອກຈາກໂໝດຄຳສັ່ງຈຳນວນຫຼາຍແລ້ວ diff --git a/java/com/android/dialer/app/res/values-lt/strings.xml b/java/com/android/dialer/app/res/values-lt/strings.xml index f73f793836..0078d6f2be 100644 --- a/java/com/android/dialer/app/res/values-lt/strings.xml +++ b/java/com/android/dialer/app/res/values-lt/strings.xml @@ -35,7 +35,6 @@ Ieškoti atkūrimo pozicijos Skambučių istorija Daugiau parinkčių - klaviatūra Nustatymai Įjungiamas masinių veiksmų režimas Masinių veiksmų režimas išjungtas diff --git a/java/com/android/dialer/app/res/values-lv/strings.xml b/java/com/android/dialer/app/res/values-lv/strings.xml index aca914032c..9d70b1d66b 100644 --- a/java/com/android/dialer/app/res/values-lv/strings.xml +++ b/java/com/android/dialer/app/res/values-lv/strings.xml @@ -34,7 +34,6 @@ Meklēt atskaņošanas pozīciju Zvanu vēsture Vairāk opciju - cipartastatūra Iestatījumi Tiek atvērts lielapjoma darbību režīms Tika aizvērts lielapjoma darbību režīms diff --git a/java/com/android/dialer/app/res/values-mk/strings.xml b/java/com/android/dialer/app/res/values-mk/strings.xml index 4427fe5210..1083336c49 100644 --- a/java/com/android/dialer/app/res/values-mk/strings.xml +++ b/java/com/android/dialer/app/res/values-mk/strings.xml @@ -33,7 +33,6 @@ Барајте позиција на репродукција Историја на повици Повеќе опции - тастатура за бирање Поставки Влегувате во режим на групно дејство Излеговте од режим на групно дејство diff --git a/java/com/android/dialer/app/res/values-ml/strings.xml b/java/com/android/dialer/app/res/values-ml/strings.xml index 9dcc02b6dc..1027b38b09 100644 --- a/java/com/android/dialer/app/res/values-ml/strings.xml +++ b/java/com/android/dialer/app/res/values-ml/strings.xml @@ -33,7 +33,6 @@ പ്ലേബാക്ക് സ്ഥാനം തിരയുക കോള്‍‌ ചരിത്രം കൂടുതൽ‍ ഓപ്‌ഷനുകള്‍ - കീപാഡ് ക്രമീകരണം ബൾക്ക് പ്രവർത്തന മോഡിലേക്ക് പ്രവേശിക്കുന്നു ബൾക്ക് പ്രവർത്തന മോഡ് വിട്ടു diff --git a/java/com/android/dialer/app/res/values-mn/strings.xml b/java/com/android/dialer/app/res/values-mn/strings.xml index 0237e1d37c..54266d4666 100644 --- a/java/com/android/dialer/app/res/values-mn/strings.xml +++ b/java/com/android/dialer/app/res/values-mn/strings.xml @@ -33,7 +33,6 @@ Тоглуулах байрлалыг хайх Дуудлагын түүх Нэмэлт сонголтууд - Товчлуур Тохиргоо Багц үйлдлийн горимд орж байна Багц үйлдлийн горимоос гарсан diff --git a/java/com/android/dialer/app/res/values-mr/strings.xml b/java/com/android/dialer/app/res/values-mr/strings.xml index 322f2537b2..517c2c0542 100644 --- a/java/com/android/dialer/app/res/values-mr/strings.xml +++ b/java/com/android/dialer/app/res/values-mr/strings.xml @@ -33,7 +33,6 @@ प्लेबॅक स्थान शोधतात कॉल इतिहास अधिक पर्याय - की पॅड सेटिंग्ज मोठ्या प्रमाणात क्रिया मोडमध्ये प्रवेश करत आहे मोठ्या प्रमाणात क्रिया मोड सोडत आहे diff --git a/java/com/android/dialer/app/res/values-ms/strings.xml b/java/com/android/dialer/app/res/values-ms/strings.xml index 39dfdbef9c..675766a401 100644 --- a/java/com/android/dialer/app/res/values-ms/strings.xml +++ b/java/com/android/dialer/app/res/values-ms/strings.xml @@ -33,7 +33,6 @@ Dapatkan kedudukan main balik Sejarah panggilan Lagi pilihan - pad kekunci Tetapan Memasuki mod tindakan pukal Meninggalkan mod tindakan pukal diff --git a/java/com/android/dialer/app/res/values-my/strings.xml b/java/com/android/dialer/app/res/values-my/strings.xml index 5c758e3b1c..35d711d7ca 100644 --- a/java/com/android/dialer/app/res/values-my/strings.xml +++ b/java/com/android/dialer/app/res/values-my/strings.xml @@ -33,7 +33,6 @@ အသံပြန်ဖွင့်ရေး နေရာကို ရှာရန် ခေါ်ဆိုမှုမှတ်တမ်း ပိုမိုရွေးချယ်စရာများ - ခလုတ်ခုံ ဆက်တင်များ တပြိုင်နက်တည်း စုပြုံလုပ်ဆောင်ချက်မုဒ်ကို ထည့်သွင်းခြင်း တပြိုင်နက်တည်း စုပြုံလုပ်ဆောင်ချက်မုဒ်မှ ထွက်လိုက်သည် diff --git a/java/com/android/dialer/app/res/values-nb/strings.xml b/java/com/android/dialer/app/res/values-nb/strings.xml index 6c49eb3534..2ff357928b 100644 --- a/java/com/android/dialer/app/res/values-nb/strings.xml +++ b/java/com/android/dialer/app/res/values-nb/strings.xml @@ -33,7 +33,6 @@ Søk etter avspillingsposisjon Anropslogg Flere alternativer - Tastatur Innstillinger Starter massehandlingsmodus Massehandlingsmodus er avsluttet diff --git a/java/com/android/dialer/app/res/values-ne/strings.xml b/java/com/android/dialer/app/res/values-ne/strings.xml index edd94c64f8..54587ffee9 100644 --- a/java/com/android/dialer/app/res/values-ne/strings.xml +++ b/java/com/android/dialer/app/res/values-ne/strings.xml @@ -33,7 +33,6 @@ प्लेब्याक स्थिति खोज्नुहोस् कलको इतिहास थप विकल्पहरू - किप्याड सेटिङहरू बल्क कारबाही सम्बन्धी मोडमा प्रवेश गर्दै बल्क कारबाही सम्बन्धी मोड छोडियो diff --git a/java/com/android/dialer/app/res/values-night/colors.xml b/java/com/android/dialer/app/res/values-night/colors.xml index f525d6a301..01b176cea9 100644 --- a/java/com/android/dialer/app/res/values-night/colors.xml +++ b/java/com/android/dialer/app/res/values-night/colors.xml @@ -15,7 +15,7 @@ --> - @*android:color/system_neutral1_300 - @*android:color/system_accent2_700 + @android:color/system_neutral1_300 + @android:color/system_accent2_700 #ff000000 diff --git a/java/com/android/dialer/app/res/values-nl/strings.xml b/java/com/android/dialer/app/res/values-nl/strings.xml index 4726a5eb9a..f91e2b8c46 100644 --- a/java/com/android/dialer/app/res/values-nl/strings.xml +++ b/java/com/android/dialer/app/res/values-nl/strings.xml @@ -33,7 +33,6 @@ Afspeelpositie zoeken Oproepgeschiedenis Meer opties - toetsenblok Instellingen Modus voor bulkacties openen Modus voor bulkacties verlaten diff --git a/java/com/android/dialer/app/res/values-no/strings.xml b/java/com/android/dialer/app/res/values-no/strings.xml index 6c49eb3534..2ff357928b 100644 --- a/java/com/android/dialer/app/res/values-no/strings.xml +++ b/java/com/android/dialer/app/res/values-no/strings.xml @@ -33,7 +33,6 @@ Søk etter avspillingsposisjon Anropslogg Flere alternativer - Tastatur Innstillinger Starter massehandlingsmodus Massehandlingsmodus er avsluttet diff --git a/java/com/android/dialer/app/res/values-pa/strings.xml b/java/com/android/dialer/app/res/values-pa/strings.xml index 4dbd5464b9..8f25fd0ae8 100644 --- a/java/com/android/dialer/app/res/values-pa/strings.xml +++ b/java/com/android/dialer/app/res/values-pa/strings.xml @@ -33,7 +33,6 @@ ਪਲੇਬੈਕ ਪੋਜੀਸ਼ਨ ਖੋਜੋ ਕਾਲ ਇਤਿਹਾਸ ਹੋਰ ਚੋਣਾਂ - ਕੀ-ਪੈਡ ਸੈਟਿੰਗਾਂ ਬਲਕ ਕਾਰਵਾਈ ਮੋਡ ਵਿੱਚ ਦਾਖਲ ਹੋਇਆ ਜਾ ਰਿਹਾ ਹੈ ਬਲਕ ਕਾਰਵਾਈ ਮੋਡ ਨੂੰ ਛੱਡਿਆ diff --git a/java/com/android/dialer/app/res/values-pl/strings.xml b/java/com/android/dialer/app/res/values-pl/strings.xml index d2f334dfa3..57bca616ad 100644 --- a/java/com/android/dialer/app/res/values-pl/strings.xml +++ b/java/com/android/dialer/app/res/values-pl/strings.xml @@ -35,7 +35,6 @@ Szukaj pozycji odtwarzania Historia połączeń Więcej opcji - klawiatura Ustawienia Włączono tryb działań zbiorczych Wyłączono tryb działań zbiorczych diff --git a/java/com/android/dialer/app/res/values-pt-rBR/strings.xml b/java/com/android/dialer/app/res/values-pt-rBR/strings.xml index e8564873ee..e376e89247 100644 --- a/java/com/android/dialer/app/res/values-pt-rBR/strings.xml +++ b/java/com/android/dialer/app/res/values-pt-rBR/strings.xml @@ -33,7 +33,6 @@ Procurar posição de reprodução Histórico de chamadas Mais opções - Teclado Configurações Entrando no modo de ação em massa Saindo do modo de ação em massa diff --git a/java/com/android/dialer/app/res/values-pt-rPT/strings.xml b/java/com/android/dialer/app/res/values-pt-rPT/strings.xml index 9f6b93b195..4d1c62f280 100644 --- a/java/com/android/dialer/app/res/values-pt-rPT/strings.xml +++ b/java/com/android/dialer/app/res/values-pt-rPT/strings.xml @@ -33,7 +33,6 @@ Procurar a posição da reprodução Histórico de chamadas Mais opções - teclado Definições A entrar no modo de ação em massa… Saiu do modo de ação em massa diff --git a/java/com/android/dialer/app/res/values-pt/strings.xml b/java/com/android/dialer/app/res/values-pt/strings.xml index e8564873ee..e376e89247 100644 --- a/java/com/android/dialer/app/res/values-pt/strings.xml +++ b/java/com/android/dialer/app/res/values-pt/strings.xml @@ -33,7 +33,6 @@ Procurar posição de reprodução Histórico de chamadas Mais opções - Teclado Configurações Entrando no modo de ação em massa Saindo do modo de ação em massa diff --git a/java/com/android/dialer/app/res/values-ro/strings.xml b/java/com/android/dialer/app/res/values-ro/strings.xml index 2ffc4e233a..c2ad8d336b 100644 --- a/java/com/android/dialer/app/res/values-ro/strings.xml +++ b/java/com/android/dialer/app/res/values-ro/strings.xml @@ -34,7 +34,6 @@ Căutați poziția de redare Istoricul apelurilor Mai multe opțiuni - tastatură Setări Se intră în modul acțiune în bloc Ați ieșit din modul acțiune în bloc diff --git a/java/com/android/dialer/app/res/values-ru/strings.xml b/java/com/android/dialer/app/res/values-ru/strings.xml index 0d8cb5074d..1810b5d013 100644 --- a/java/com/android/dialer/app/res/values-ru/strings.xml +++ b/java/com/android/dialer/app/res/values-ru/strings.xml @@ -35,7 +35,6 @@ Выбрать позицию для воспроизведения Журнал звонков Ещё - клавиатура Настройки Вы вошли в режим массового действия Вы вышли из режима массового действия diff --git a/java/com/android/dialer/app/res/values-si/strings.xml b/java/com/android/dialer/app/res/values-si/strings.xml index 2cacb180d6..e55936e94b 100644 --- a/java/com/android/dialer/app/res/values-si/strings.xml +++ b/java/com/android/dialer/app/res/values-si/strings.xml @@ -33,7 +33,6 @@ Playback ස්ථානය සොයාබලන්න ඇමතුම් ඉතිහාසය තවත් විකල්ප - යතුරු පුවරුව සැකසීම් තොග ක්‍රියා ප්‍රකාරය ඇතුළු කරමින් තොග ක්‍රියා ප්‍රකාරය හැර යන ලදී diff --git a/java/com/android/dialer/app/res/values-sk/strings.xml b/java/com/android/dialer/app/res/values-sk/strings.xml index bdacbb7bdd..3e38b7b830 100644 --- a/java/com/android/dialer/app/res/values-sk/strings.xml +++ b/java/com/android/dialer/app/res/values-sk/strings.xml @@ -35,7 +35,6 @@ Hľadať pozíciu prehrávania História hovorov Ďalšie možnosti - klávesnica Nastavenia Vstupuje sa do režimu hromadných akcií Odišli ste z režimu hromadných akcií diff --git a/java/com/android/dialer/app/res/values-sl/strings.xml b/java/com/android/dialer/app/res/values-sl/strings.xml index 0d64625ea8..95fde9cfe4 100644 --- a/java/com/android/dialer/app/res/values-sl/strings.xml +++ b/java/com/android/dialer/app/res/values-sl/strings.xml @@ -35,7 +35,6 @@ Iskanje položaja predvajanja Zgodovina klicev Več možnosti - tipkovnica Nastavitve Prehod v način množičnega dejanja Prehod iz načina množičnega dejanja diff --git a/java/com/android/dialer/app/res/values-sq/strings.xml b/java/com/android/dialer/app/res/values-sq/strings.xml index c20d8d1e22..bfcd7ff9d8 100644 --- a/java/com/android/dialer/app/res/values-sq/strings.xml +++ b/java/com/android/dialer/app/res/values-sq/strings.xml @@ -33,7 +33,6 @@ Kërko pozicionin e luajtjes Historiku i telefonatave Opsione të tjera - blloku i tasteve Cilësimet Po hyn në modalitetin e veprimit në masë U largove nga modaliteti i veprimit në masë diff --git a/java/com/android/dialer/app/res/values-sr/strings.xml b/java/com/android/dialer/app/res/values-sr/strings.xml index 929ad38f47..70206306d6 100644 --- a/java/com/android/dialer/app/res/values-sr/strings.xml +++ b/java/com/android/dialer/app/res/values-sr/strings.xml @@ -34,7 +34,6 @@ Тражење позиције у репродукцији Историја позива Још опција - тастатура Подешавања Улазите у режим групних радњи Изашли сте из режима групних радњи diff --git a/java/com/android/dialer/app/res/values-sv/strings.xml b/java/com/android/dialer/app/res/values-sv/strings.xml index 5c68dad140..6033b81b61 100644 --- a/java/com/android/dialer/app/res/values-sv/strings.xml +++ b/java/com/android/dialer/app/res/values-sv/strings.xml @@ -33,7 +33,6 @@ Sök uppspelningsläge Samtalshistorik Fler alternativ - knappsats Inställningar Öppnar läget för massåtgärd Stängde läget för massåtgärd diff --git a/java/com/android/dialer/app/res/values-sw/strings.xml b/java/com/android/dialer/app/res/values-sw/strings.xml index eaef3526db..c3eeaa5f94 100644 --- a/java/com/android/dialer/app/res/values-sw/strings.xml +++ b/java/com/android/dialer/app/res/values-sw/strings.xml @@ -33,7 +33,6 @@ Tafuta sehemu ya kucheza ujumbe wa sauti Rekodi ya simu zilizopigwa Chaguo zaidi - vitufe vya simu Mipangilio Unaingia katika hali ya kutekeleza vitendo vingi Umeondoka katika hali ya kutekeleza vitendo vingi diff --git a/java/com/android/dialer/app/res/values-ta/strings.xml b/java/com/android/dialer/app/res/values-ta/strings.xml index 9dbc55c7b1..78f4e30561 100644 --- a/java/com/android/dialer/app/res/values-ta/strings.xml +++ b/java/com/android/dialer/app/res/values-ta/strings.xml @@ -33,7 +33,6 @@ பிளேபேக் நிலையைத் தேடு அழைப்பு வரலாறு மேலும் விருப்பங்கள் - விசைத்தளம் அமைப்பு மொத்தச் செயல் பயன்முறையில் நுழைகிறீர்கள் மொத்தச் செயல் பயன்முறையிலிருந்து வெளியேறிவிட்டீர்கள் diff --git a/java/com/android/dialer/app/res/values-te/strings.xml b/java/com/android/dialer/app/res/values-te/strings.xml index 3207a694ef..dbef1863f5 100644 --- a/java/com/android/dialer/app/res/values-te/strings.xml +++ b/java/com/android/dialer/app/res/values-te/strings.xml @@ -33,7 +33,6 @@ ప్లేబ్యాక్ స్థానాన్ని కావాల్సిన చోటుకి జరపండి కాల్ చరిత్ర మరిన్ని ఎంపికలు - కీ ప్యాడ్ సెట్టింగ్‌లు బల్క్ చర్య మోడ్‌లోకి ప్రవేశిస్తున్నారు బల్క్ చర్య మోడ్ నుండి నిష్క్రమించారు diff --git a/java/com/android/dialer/app/res/values-th/strings.xml b/java/com/android/dialer/app/res/values-th/strings.xml index 305cbc1d6e..372e4f99e8 100644 --- a/java/com/android/dialer/app/res/values-th/strings.xml +++ b/java/com/android/dialer/app/res/values-th/strings.xml @@ -33,7 +33,6 @@ ค้นหาตำแหน่งการเล่น ประวัติการโทร ตัวเลือกเพิ่มเติม - ปุ่มกด การตั้งค่า กำลังเข้าสู่โหมดการดำเนินการแบบกลุ่ม ออกจากโหมดการทำงานแบบกลุ่มแล้ว diff --git a/java/com/android/dialer/app/res/values-tl/strings.xml b/java/com/android/dialer/app/res/values-tl/strings.xml index 980ff9b81e..15d3696894 100644 --- a/java/com/android/dialer/app/res/values-tl/strings.xml +++ b/java/com/android/dialer/app/res/values-tl/strings.xml @@ -33,7 +33,6 @@ Hanapin ang posisyon ng playback History ng tawag Higit pang mga pagpipilian - keypad Mga Setting Pumapasok sa bulk action mode Umalis sa bulk action mode diff --git a/java/com/android/dialer/app/res/values-tr/strings.xml b/java/com/android/dialer/app/res/values-tr/strings.xml index 91c2d57ec9..e29896f562 100644 --- a/java/com/android/dialer/app/res/values-tr/strings.xml +++ b/java/com/android/dialer/app/res/values-tr/strings.xml @@ -33,7 +33,6 @@ Oynatma konumunu ayarla Çağrı geçmişi Diğer seçenekler - tuş takımı Ayarlar Toplu işlem moduna giriliyor Toplu işlem modundan çıkıldı diff --git a/java/com/android/dialer/app/res/values-uk/strings.xml b/java/com/android/dialer/app/res/values-uk/strings.xml index 584b4405f4..59da296e0c 100644 --- a/java/com/android/dialer/app/res/values-uk/strings.xml +++ b/java/com/android/dialer/app/res/values-uk/strings.xml @@ -35,7 +35,6 @@ Шукати місце відтворення Історія викликів Інші варіанти - клавіатура Налаштування Перехід у режим масових дій Ви вийшли з режиму масових дій diff --git a/java/com/android/dialer/app/res/values-ur/strings.xml b/java/com/android/dialer/app/res/values-ur/strings.xml index 107e8e693a..badc2a625c 100644 --- a/java/com/android/dialer/app/res/values-ur/strings.xml +++ b/java/com/android/dialer/app/res/values-ur/strings.xml @@ -33,7 +33,6 @@ پلے بیک پوزیشن طلب کریں کال کی سرگزشت مزید اختیارات - کی پیڈ ترتیبات بلک کاروائی موڈ میں داخل ہو رہا ہے بلک کاروائی موڈ چھوڑ دیا diff --git a/java/com/android/dialer/app/res/values-uz/strings.xml b/java/com/android/dialer/app/res/values-uz/strings.xml index 9f5ae9cedf..5d97bf72bd 100644 --- a/java/com/android/dialer/app/res/values-uz/strings.xml +++ b/java/com/android/dialer/app/res/values-uz/strings.xml @@ -33,7 +33,6 @@ Ijro vaziyatini qidirish Chaqiruvlar tarixi Boshqa parametrlar - klaviatura Sozlamalar Yoppasiga bajariladigan amallar rejimiga o‘tilmoqda Yoppasiga bajariladigan amallar rejimidan chiqib ketildi diff --git a/java/com/android/dialer/app/res/values-vi/strings.xml b/java/com/android/dialer/app/res/values-vi/strings.xml index d663d7a9af..3c06b3fbd8 100644 --- a/java/com/android/dialer/app/res/values-vi/strings.xml +++ b/java/com/android/dialer/app/res/values-vi/strings.xml @@ -33,7 +33,6 @@ Tìm kiếm vị trí phát lại Nhật ký cuộc gọi Tùy chọn khác - bàn phím Cài đặt Truy cập chế độ tác vụ hàng loạt Đã rời khỏi chế độ tác vụ hàng loạt diff --git a/java/com/android/dialer/app/res/values-zh-rCN/strings.xml b/java/com/android/dialer/app/res/values-zh-rCN/strings.xml index 3be628e1c3..043af95f67 100644 --- a/java/com/android/dialer/app/res/values-zh-rCN/strings.xml +++ b/java/com/android/dialer/app/res/values-zh-rCN/strings.xml @@ -33,7 +33,6 @@ 拖动到播放位置 通话记录 更多选项 - 拨号键盘 设置 正在进入批量操作模式 已退出批量操作模式 diff --git a/java/com/android/dialer/app/res/values-zh-rHK/strings.xml b/java/com/android/dialer/app/res/values-zh-rHK/strings.xml index a46298144c..27d8037dc5 100644 --- a/java/com/android/dialer/app/res/values-zh-rHK/strings.xml +++ b/java/com/android/dialer/app/res/values-zh-rHK/strings.xml @@ -33,7 +33,6 @@ 指定播放位置 通話記錄 更多選項 - 小鍵盤 設定 正在進入大量操作模式 已離開大量操作模式 diff --git a/java/com/android/dialer/app/res/values-zh-rTW/strings.xml b/java/com/android/dialer/app/res/values-zh-rTW/strings.xml index f682d66dc5..a95a50cc24 100644 --- a/java/com/android/dialer/app/res/values-zh-rTW/strings.xml +++ b/java/com/android/dialer/app/res/values-zh-rTW/strings.xml @@ -33,7 +33,6 @@ 指定播放時間點 通話記錄 更多選項 - 撥號鍵盤 設定 已進入大量操作模式 已離開大量操作模式 diff --git a/java/com/android/dialer/app/res/values-zu/strings.xml b/java/com/android/dialer/app/res/values-zu/strings.xml index 2b57e75215..9d4e26f1c6 100644 --- a/java/com/android/dialer/app/res/values-zu/strings.xml +++ b/java/com/android/dialer/app/res/values-zu/strings.xml @@ -33,7 +33,6 @@ Funa indawo yokudlala Umlando wekholi Izinketho eziningi - ikhiphedi Izilungiselelo Kungenwa kumodi yesenzo senqwaba Ishiye imodi yesenzo senqwaba diff --git a/java/com/android/dialer/app/res/values/colors.xml b/java/com/android/dialer/app/res/values/colors.xml index b78d408945..8a37df006d 100644 --- a/java/com/android/dialer/app/res/values/colors.xml +++ b/java/com/android/dialer/app/res/values/colors.xml @@ -16,14 +16,13 @@ #80000000 - ?colorIcon #8a000000 #FF3F3B - @*android:color/system_neutral1_600 - @*android:color/system_accent2_200 + @android:color/system_neutral1_600 + @android:color/system_accent2_200 #ffffffff diff --git a/java/com/android/dialer/app/res/values/strings.xml b/java/com/android/dialer/app/res/values/strings.xml index e8f5277967..7800d41c5d 100644 --- a/java/com/android/dialer/app/res/values/strings.xml +++ b/java/com/android/dialer/app/res/values/strings.xml @@ -146,10 +146,6 @@ [CHAR LIMIT=NONE] --> More options - - key pad - Settings diff --git a/java/com/android/dialer/app/res/values/styles.xml b/java/com/android/dialer/app/res/values/styles.xml index bb11bcc347..43168699bd 100644 --- a/java/com/android/dialer/app/res/values/styles.xml +++ b/java/com/android/dialer/app/res/values/styles.xml @@ -21,10 +21,6 @@ @null - - - - - - - - - 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 b058ab4478..1780fcbb68 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 @@ -71,10 +71,9 @@ @color/google_grey_700 @color/google_grey_400 - @*android:color/system_neutral1_0 - @*android:color/system_neutral1_0 - @color/dialer_theme_color_20pct - @*android:color/system_accent2_200 + @android:color/system_neutral1_0 + @android:color/system_neutral1_0 + @android:color/system_accent2_200 diff --git a/java/com/android/dialer/theme/common/res/values-night/colors.xml b/java/com/android/dialer/theme/common/res/values-night/colors.xml index 45bccc61e2..2ad50c7543 100644 --- a/java/com/android/dialer/theme/common/res/values-night/colors.xml +++ b/java/com/android/dialer/theme/common/res/values-night/colors.xml @@ -19,6 +19,6 @@ #3ee0a0 #ffb3ac #b5c4ff - @*android:color/system_accent1_600 + @android:color/system_accent1_600 @android:color/black 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 08255f32f8..e5ac731b0b 100644 --- a/java/com/android/dialer/theme/common/res/values/colors.xml +++ b/java/com/android/dialer/theme/common/res/values/colors.xml @@ -20,7 +20,7 @@ #b52425 #D8D8D8 #2A56C6 - @*android:color/system_accent1_600 + @android:color/system_accent1_600 @android:color/white @@ -33,5 +33,5 @@ #CFD8DC - @*android:color/system_neutral1_50 + @android:color/system_neutral1_50 diff --git a/java/com/android/dialer/theme/common/res/values/dimens.xml b/java/com/android/dialer/theme/common/res/values/dimens.xml index 4c2edb48a1..f1c4051be6 100644 --- a/java/com/android/dialer/theme/common/res/values/dimens.xml +++ b/java/com/android/dialer/theme/common/res/values/dimens.xml @@ -27,8 +27,6 @@ 56dp - 64dp - 3dp 48dp 2dp 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 e48474e9f3..41c5fd1c56 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 @@ -18,5 +18,4 @@ #5195EA #335195EA #2374CE - #5195EA 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 9779716eb8..c894da3ff6 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 @@ -19,7 +19,6 @@ #332A56C6 @color/dialer_background_color @android:color/system_neutral2_50 - @android:color/system_accent3_400 #1f000000 @android:color/system_neutral1_10 @android:color/system_neutral1_50 diff --git a/java/com/android/dialer/theme/res/values-fa/strings.xml b/java/com/android/dialer/theme/res/values-fa/strings.xml index c909281a4a..e9c127e432 100644 --- a/java/com/android/dialer/theme/res/values-fa/strings.xml +++ b/java/com/android/dialer/theme/res/values-fa/strings.xml @@ -18,7 +18,7 @@ "ناشناس" - "%1$d %2$s" + "%1$s %2$d" "تلفن عمومی" "تماس ویدیویی" "تماس" diff --git a/java/com/android/dialer/theme/res/values-lt/strings.xml b/java/com/android/dialer/theme/res/values-lt/strings.xml index bbed6d1e91..af8f90e969 100644 --- a/java/com/android/dialer/theme/res/values-lt/strings.xml +++ b/java/com/android/dialer/theme/res/values-lt/strings.xml @@ -18,7 +18,7 @@ "Nežinomas" - "%1$d %2$s" + "%1$s %2$d" "Taksofonas" "Vaizdo skambutis" "Skambinti" diff --git a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_tos_fragment.xml b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_tos_fragment.xml index 0882717837..2ecc14355c 100644 --- a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_tos_fragment.xml +++ b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_tos_fragment.xml @@ -83,8 +83,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/verizon_terms_and_conditions_decline_english"/> - %s ดูและฟังข้อความได้โดยไม่ต้องโทรไปฟังข้อความเสียงเอง บริการถอดเสียงฟรีของ Google ถอดเสียงข้อความให้คุณแล้ว โดยเลือกปิดฟีเจอร์นี้ในการตั้งค่าได้ทุกเมื่อ %s บริการถอดเสียงฟรีของ Google ถอดเสียงข้อความให้คุณแล้ว โดยเลือกปิดฟีเจอร์นี้ในการตั้งค่าได้ทุกเมื่อ %s - ดูและฟังข้อความโดยไม่ต้องโทรไปฟังข้อความเสียงเอง %s + ดูและฟังข้อความโดยไม่ต้องโทรไปฟังข้อความเสียงเอง ดูข้อมูลเพิ่มเติม รับทราบ ไม่เป็นไร diff --git a/java/com/android/dialer/voicemail/listui/error/res/values/dimens.xml b/java/com/android/dialer/voicemail/listui/error/res/values/dimens.xml index f40cc5f2b7..64ec30b2d4 100644 --- a/java/com/android/dialer/voicemail/listui/error/res/values/dimens.xml +++ b/java/com/android/dialer/voicemail/listui/error/res/values/dimens.xml @@ -27,8 +27,6 @@ 4dp 11dp 4dp - 16sp - 14sp 280dp diff --git a/java/com/android/dialer/voicemail/listui/res/values/styles.xml b/java/com/android/dialer/voicemail/listui/res/values/styles.xml index 5e529e8350..2b6e38ed31 100644 --- a/java/com/android/dialer/voicemail/listui/res/values/styles.xml +++ b/java/com/android/dialer/voicemail/listui/res/values/styles.xml @@ -30,12 +30,4 @@ 8sp - - diff --git a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java index 43b65e6ea3..0fe5c42c99 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java @@ -239,7 +239,7 @@ public class VoicemailChangePinActivity extends AppCompatActivity public void onEnter(VoicemailChangePinActivity activity) { activity.headerText.setText(R.string.change_pin_confirm_pin_header); activity.hintText.setText(null); - activity.nextButton.setText(R.string.change_pin_ok_label); + activity.nextButton.setText(android.R.string.ok); } @Override diff --git a/java/com/android/dialer/voicemail/settings/res/layout/voicemail_change_pin.xml b/java/com/android/dialer/voicemail/settings/res/layout/voicemail_change_pin.xml index 304bd37eca..9ca6708cb4 100644 --- a/java/com/android/dialer/voicemail/settings/res/layout/voicemail_change_pin.xml +++ b/java/com/android/dialer/voicemail/settings/res/layout/voicemail_change_pin.xml @@ -80,7 +80,7 @@ android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" - android:text="@string/change_pin_cancel_label"/> + android:text="@android:string/cancel"/>