diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..2aed390b1a94a8acbbb7e69e8e30eb866bff697e --- /dev/null +++ b/Android.bp @@ -0,0 +1,288 @@ +// +// SPDX-FileCopyrightText: 2023 The LineageOS Project +// SPDX-License-Identifier: Apache-2.0 +// + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +android_app { + name: "Dialer", + aaptflags: [ + "--auto-add-overlay", + "--extra-packages com.android.contacts.common", + "--extra-packages com.android.dialer.app", + "--extra-packages com.android.dialer.assisteddialing", + "--extra-packages com.android.dialer.assisteddialing.ui", + "--extra-packages com.android.dialer.blocking", + "--extra-packages com.android.dialer.blockreportspam", + "--extra-packages com.android.dialer.calldetails", + "--extra-packages com.android.dialer.calllog.database", + "--extra-packages com.android.dialer.calllog.ui", + "--extra-packages com.android.dialer.calllog.ui.menu", + "--extra-packages com.android.dialer.calllogutils", + "--extra-packages com.android.dialer.clipboard", + "--extra-packages com.android.dialer.common", + "--extra-packages com.android.dialer.contactphoto", + "--extra-packages com.android.dialer.contacts.displaypreference", + "--extra-packages com.android.dialer.contacts.resources", + "--extra-packages com.android.dialer.contactsfragment", + "--extra-packages com.android.dialer.databasepopulator", + "--extra-packages com.android.dialer.dialpadview", + "--extra-packages com.android.dialer.dialpadview.theme", + "--extra-packages com.android.dialer.glidephotomanager.impl", + "--extra-packages com.android.dialer.historyitemactions", + "--extra-packages com.android.dialer.interactions", + "--extra-packages com.android.dialer.lettertile", + "--extra-packages com.android.dialer.location", + "--extra-packages com.android.dialer.main.impl", + "--extra-packages com.android.dialer.main.impl.bottomnav", + "--extra-packages com.android.dialer.main.impl.toolbar", + "--extra-packages com.android.dialer.notification", + "--extra-packages com.android.dialer.oem", + "--extra-packages com.android.dialer.phonelookup.database", + "--extra-packages com.android.dialer.phonenumberutil", + "--extra-packages com.android.dialer.postcall", + "--extra-packages com.android.dialer.precall.externalreceiver", + "--extra-packages com.android.dialer.precall.impl", + "--extra-packages com.android.dialer.preferredsim.impl", + "--extra-packages com.android.dialer.preferredsim.suggestion", + "--extra-packages com.android.dialer.promotion.impl", + "--extra-packages com.android.dialer.rtt", + "--extra-packages com.android.dialer.searchfragment.common", + "--extra-packages com.android.dialer.searchfragment.cp2", + "--extra-packages com.android.dialer.searchfragment.directories", + "--extra-packages com.android.dialer.searchfragment.list", + "--extra-packages com.android.dialer.searchfragment.nearbyplaces", + "--extra-packages com.android.dialer.shortcuts", + "--extra-packages com.android.dialer.simulator.impl", + "--extra-packages com.android.dialer.simulator.service", + "--extra-packages com.android.dialer.spannable", + "--extra-packages com.android.dialer.speeddial", + "--extra-packages com.android.dialer.theme", + "--extra-packages com.android.dialer.theme.base", + "--extra-packages com.android.dialer.theme.base.impl", + "--extra-packages com.android.dialer.theme.common", + "--extra-packages com.android.dialer.theme.hidden", + "--extra-packages com.android.dialer.util", + "--extra-packages com.android.dialer.voicemail.listui", + "--extra-packages com.android.dialer.voicemail.listui.error", + "--extra-packages com.android.dialer.voicemail.settings", + "--extra-packages com.android.dialer.voicemailstatus", + "--extra-packages com.android.dialer.widget", + "--extra-packages com.android.incallui", + "--extra-packages com.android.incallui.answer.impl", + "--extra-packages com.android.incallui.answer.impl.affordance", + "--extra-packages com.android.incallui.answer.impl.answermethod", + "--extra-packages com.android.incallui.answer.impl.hint", + "--extra-packages com.android.incallui.audioroute", + "--extra-packages com.android.incallui.autoresizetext", + "--extra-packages com.android.incallui.callpending", + "--extra-packages com.android.incallui.commontheme", + "--extra-packages com.android.incallui.contactgrid", + "--extra-packages com.android.incallui.disconnectdialog", + "--extra-packages com.android.incallui.hold", + "--extra-packages com.android.incallui.incall.impl", + "--extra-packages com.android.incallui.rtt.impl", + "--extra-packages com.android.incallui.rtt.protocol", + "--extra-packages com.android.incallui.sessiondata", + "--extra-packages com.android.incallui.spam", + "--extra-packages com.android.incallui.speakerbuttonlogic", + "--extra-packages com.android.incallui.telecomeventui", + "--extra-packages com.android.incallui.video.impl", + "--extra-packages com.android.incallui.video.protocol", + "--extra-packages com.android.voicemail", + "--extra-packages com.android.voicemail.impl", + "--extra-packages com.android.voicemail.impl.configui", + ], + aidl: { + local_include_dirs: ["java"], + }, + certificate: "shared", + exclude_srcs: ["java/com/android/dialer/rootcomponentgenerator/*.java"], + libs: [ + "auto_value_annotations", + "org.apache.http.legacy", + ], + optimize: { + proguard_flags_files: [ + "java/com/android/dialer/common/proguard.flags", + "java/com/android/dialer/proguard/proguard.flags", + "java/com/android/dialer/proguard/proguard_base.flags", + "java/com/android/dialer/proguard/proguard_release.flags", + "java/com/android/incallui/answer/impl/proguard.flags", + "java/com/android/voicemail/impl/proguard.flags", + "proguard.flags", + ], + }, + optional_uses_libs: ["org.apache.http.legacy"], + plugins: [ + "auto_value_plugin", + "dagger2-compiler", + "dialer-rootcomponentprocessor", + "glide-annotation-processor", + ], + privileged: true, + product_specific: true, + required: [ + "privapp_whitelist_com.android.dialer", + "privapp_whitelist_com.android.dialer-ext.xml", + ], + resource_dirs: [ + "assets/quantum/res", + "java/com/android/contacts/common/res", + "java/com/android/dialer/app/res", + "java/com/android/dialer/assisteddialing/res", + "java/com/android/dialer/assisteddialing/ui/res", + "java/com/android/dialer/blocking/res", + "java/com/android/dialer/blockreportspam/res", + "java/com/android/dialer/calldetails/res", + "java/com/android/dialer/calllog/ui/menu/res", + "java/com/android/dialer/calllogutils/res", + "java/com/android/dialer/callrecord/res", + "java/com/android/dialer/callstats/res", + "java/com/android/dialer/clipboard/res", + "java/com/android/dialer/common/res", + "java/com/android/dialer/contactphoto/res", + "java/com/android/dialer/contacts/displaypreference/res", + "java/com/android/dialer/contacts/resources/res", + "java/com/android/dialer/contactsfragment/res", + "java/com/android/dialer/dialpadview/res", + "java/com/android/dialer/dialpadview/theme/res", + "java/com/android/dialer/glidephotomanager/impl/res", + "java/com/android/dialer/helplines/res", + "java/com/android/dialer/historyitemactions/res", + "java/com/android/dialer/interactions/res", + "java/com/android/dialer/lettertile/res", + "java/com/android/dialer/lookup/res", + "java/com/android/dialer/main/impl/bottomnav/res", + "java/com/android/dialer/main/impl/res", + "java/com/android/dialer/main/impl/toolbar/res", + "java/com/android/dialer/notification/res", + "java/com/android/dialer/oem/res", + "java/com/android/dialer/phonenumberutil/res", + "java/com/android/dialer/postcall/res", + "java/com/android/dialer/precall/impl/res", + "java/com/android/dialer/preferredsim/impl/res", + "java/com/android/dialer/preferredsim/suggestion/res", + "java/com/android/dialer/promotion/impl/res", + "java/com/android/dialer/rtt/res", + "java/com/android/dialer/searchfragment/common/res", + "java/com/android/dialer/searchfragment/cp2/res", + "java/com/android/dialer/searchfragment/directories/res", + "java/com/android/dialer/searchfragment/list/res", + "java/com/android/dialer/searchfragment/nearbyplaces/res", + "java/com/android/dialer/searchfragment/remote/res", + "java/com/android/dialer/shortcuts/res", + "java/com/android/dialer/spannable/res", + "java/com/android/dialer/speeddial/res", + "java/com/android/dialer/theme/base/res", + "java/com/android/dialer/theme/common/res", + "java/com/android/dialer/theme/hidden/res", + "java/com/android/dialer/theme/res", + "java/com/android/dialer/util/res", + "java/com/android/dialer/voicemail/listui/error/res", + "java/com/android/dialer/voicemail/listui/res", + "java/com/android/dialer/voicemail/settings/res", + "java/com/android/dialer/widget/res", + "java/com/android/incallui/answer/impl/affordance/res", + "java/com/android/incallui/answer/impl/answermethod/res", + "java/com/android/incallui/answer/impl/res", + "java/com/android/incallui/audioroute/res", + "java/com/android/incallui/autoresizetext/res", + "java/com/android/incallui/callpending/res", + "java/com/android/incallui/commontheme/res", + "java/com/android/incallui/contactgrid/res", + "java/com/android/incallui/disconnectdialog/res", + "java/com/android/incallui/hold/res", + "java/com/android/incallui/incall/impl/res", + "java/com/android/incallui/res", + "java/com/android/incallui/rtt/impl/res", + "java/com/android/incallui/sessiondata/res", + "java/com/android/incallui/spam/res", + "java/com/android/incallui/speakerbuttonlogic/res", + "java/com/android/incallui/telecomeventui/res", + "java/com/android/incallui/theme/res", + "java/com/android/incallui/video/impl/res", + "java/com/android/incallui/video/protocol/res", + "java/com/android/voicemail/impl/configui/res", + "java/com/android/voicemail/impl/res", + ], + sdk_version: "system_current", + srcs: [ + "java/**/I*.aidl", + "java/**/*.java", + ], + static_libs: [ + "android-common", + "androidx.annotation_annotation", + "androidx.appcompat_appcompat", + "androidx.cardview_cardview", + "androidx.collection_collection", + "androidx.coordinatorlayout_coordinatorlayout", + "androidx.dynamicanimation_dynamicanimation", + "androidx.exifinterface_exifinterface", + "androidx.fragment_fragment", + "androidx.localbroadcastmanager_localbroadcastmanager", + "androidx.preference_preference", + "androidx.recyclerview_recyclerview", + "apache-commons-compress", + "com.google.android.material_material", + "dagger2", + "dialer-apache-mime4j-core", + "dialer-apache-mime4j-dom", + "dialer-commons-io", + "dialer-protos", + "error_prone_annotations", + "glide-annotation-and-compiler-prebuilt", + "glide-disklrucache-prebuilt", + "glide-gifdecoder-prebuilt", + "glide-prebuilt", + "guava", + "jsr305", + "jsr330", + "libphonenumber", + "org.lineageos.lib.phone", + "volley", + "elib", + ], + use_embedded_native_libs: true, +} + +java_library { + name: "dialer-protos", + proto: { + canonical_path_from_root: false, + type: "lite", + }, + sdk_version: "system_current", + srcs: ["java/**/*.proto",], + static_libs: ["libprotobuf-java-lite"], +} + +java_plugin { + name: "dialer-rootcomponentprocessor", + processor_class: "com.android.dialer.rootcomponentgenerator.RootComponentProcessor", + srcs: [ + "java/com/android/dialer/rootcomponentgenerator/*.java", + "java/com/android/dialer/inject/HasRootComponent.java", + "java/com/android/dialer/inject/IncludeInDialerRoot.java", + "java/com/android/dialer/inject/RootComponentGeneratorMetadata.java", + ], + static_libs: [ + "auto_common", + "auto_service_annotations", + "dagger2", + "guava", + "javapoet", + "jsr330", + ], +} + +prebuilt_etc { + name: "privapp_whitelist_com.android.dialer-ext.xml", + product_specific: true, + src: "privapp_whitelist_com.android.dialer-ext.xml", + sub_dir: "permissions", +} diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 786d5a69b73257e59509ccbe81b85c082af8b8c8..0000000000000000000000000000000000000000 --- a/Android.mk +++ /dev/null @@ -1,349 +0,0 @@ -# Local modifications: -# * removed com.google.android.geo.API_KEY key. This should be added to -# the manifest files in java/com/android/incallui/calllocation/impl/ -# and /java/com/android/incallui/maps/impl/ -# * b/62417801 modify translation string naming convention: -# $ find . -type d | grep 262 | rename 's/(values)\-([a-zA-Z\+\-]+)\-(mcc262-mnc01)/$1-$3-$2/' -# * b/37077388 temporarily disable proguard with javac -# * b/62875795 include manually generated GRPC service class: -# $ protoc --plugin=protoc-gen-grpc-java=prebuilts/tools/common/m2/repository/io/grpc/protoc-gen-grpc-java/1.0.3/protoc-gen-grpc-java-1.0.3-linux-x86_64.exe \ -# --grpc-java_out=lite:"packages/apps/Dialer/java/com/android/voicemail/impl/" \ -# --proto_path="packages/apps/Dialer/java/com/android/voicemail/impl/transcribe/grpc/" "packages/apps/Dialer/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto" -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -# The base directory for Dialer sources. -BASE_DIR := java/com/android - -# Exclude testing only class, not used anywhere here -EXCLUDE_FILES += \ - $(BASE_DIR)/contacts/common/format/testing/SpannedTestUtils.java - -# Exclude rootcomponentgenerator -EXCLUDE_FILES += \ - $(call all-java-files-under, $(BASE_DIR)/dialer/rootcomponentgenerator) \ - -# All Dialer resources. -RES_DIRS := $(call all-subdir-named-dirs,res,.) - -# Dialer manifest files to merge. -DIALER_MANIFEST_FILES := $(call all-named-files-under,AndroidManifest.xml,.) - -# Merge all manifest files. -LOCAL_FULL_LIBS_MANIFEST_FILES := \ - $(addprefix $(LOCAL_PATH)/, $(DIALER_MANIFEST_FILES)) - -LOCAL_SRC_FILES := $(call all-java-files-under, $(BASE_DIR)) -LOCAL_SRC_FILES += $(call all-proto-files-under, $(BASE_DIR)) -LOCAL_SRC_FILES += $(call all-Iaidl-files-under, $(BASE_DIR)) -LOCAL_SRC_FILES := $(filter-out $(EXCLUDE_FILES),$(LOCAL_SRC_FILES)) - -LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/java - -LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH) - -LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(RES_DIRS)) - -# We specify each package explicitly to glob resource files. -include ${LOCAL_PATH}/packages.mk - -LOCAL_AAPT_FLAGS := $(addprefix --extra-packages , $(LOCAL_AAPT_FLAGS)) -LOCAL_AAPT_FLAGS += \ - --auto-add-overlay \ - -LOCAL_STATIC_JAVA_LIBRARIES := \ - android-common \ - android-support-dynamic-animation \ - dialer-commons-io-target \ - dialer-dagger2-target \ - dialer-disklrucache-target \ - dialer-gifdecoder-target \ - dialer-glide-target \ - dialer-j2objc-annotations-target \ - dialer-javax-annotation-api-target \ - dialer-javax-inject-target \ - dialer-mime4j-core-target \ - dialer-mime4j-dom-target \ - dialer-guava-target \ - dialer-glide-target \ - dialer-glide-annotation-target \ - error_prone_annotations \ - jsr305 \ - libphonenumber \ - 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 \ - -LOCAL_JAVA_LIBRARIES := \ - auto_value_annotations \ - org.apache.http.legacy \ - -LOCAL_ANNOTATION_PROCESSORS := \ - auto_value_plugin \ - javapoet-prebuilt-jar \ - dialer-dagger2 \ - dialer-dagger2-compiler \ - dialer-dagger2-producers \ - dialer-glide-annotation \ - dialer-glide-compiler \ - dialer-guava \ - dialer-javax-annotation-api \ - dialer-javax-inject \ - dialer-rootcomponentprocessor - -LOCAL_ANNOTATION_PROCESSOR_CLASSES := \ - com.google.auto.value.processor.AutoValueProcessor,dagger.internal.codegen.ComponentProcessor,com.bumptech.glide.annotation.compiler.GlideAnnotationProcessor,com.android.dialer.rootcomponentgenerator.RootComponentProcessor - -# Proguard includes -LOCAL_PROGUARD_FLAG_FILES := proguard.flags $(call all-named-files-under,proguard.*flags,$(BASE_DIR)) -LOCAL_PROGUARD_ENABLED := custom - -LOCAL_PROGUARD_ENABLED += optimization - -LOCAL_SDK_VERSION := system_current -LOCAL_MODULE_TAGS := optional -LOCAL_PACKAGE_NAME := Dialer -LOCAL_CERTIFICATE := shared -LOCAL_PRIVILEGED_MODULE := true -LOCAL_PRODUCT_MODULE := true -LOCAL_USE_AAPT2 := true -LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.dialer -LOCAL_REQUIRED_MODULES += privapp_whitelist_com.android.dialer-ext.xml -LOCAL_USES_LIBRARIES := org.apache.http.legacy - -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -include $(BUILD_PACKAGE) - -include $(CLEAR_VARS) -LOCAL_MODULE := privapp_whitelist_com.android.dialer-ext.xml -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/permissions -LOCAL_PRODUCT_MODULE := true -LOCAL_SRC_FILES := $(LOCAL_MODULE) -include $(BUILD_PREBUILT) - -# Cleanup local state -BASE_DIR := -EXCLUDE_FILES := -RES_DIRS := -DIALER_MANIFEST_FILES := -EXCLUDE_MANIFESTS := -EXCLUDE_EXTRA_PACKAGES := - -# Create references to prebuilt libraries. -include $(CLEAR_VARS) - -LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \ - dialer-dagger2-compiler:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-compiler/2.7/dagger-compiler-2.7.jar \ - dialer-dagger2:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger/2.7/dagger-2.7.jar \ - dialer-dagger2-producers:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-producers/2.7/dagger-producers-2.7.jar \ - dialer-glide-annotation:../../../prebuilts/maven_repo/bumptech/com/github/bumptech/glide/annotation/SNAPSHOT/annotation-SNAPSHOT.jar \ - dialer-glide-compiler:../../../prebuilts/maven_repo/bumptech/com/github/bumptech/glide/compiler/SNAPSHOT/compiler-SNAPSHOT.jar \ - dialer-guava:../../../prebuilts/tools/common/m2/repository/com/google/guava/guava/23.0/guava-23.0.jar \ - dialer-javax-annotation-api:../../../prebuilts/tools/common/m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar \ - dialer-javax-inject:../../../prebuilts/tools/common/m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar \ - -include $(BUILD_HOST_PREBUILT) - -# Enumerate target prebuilts to avoid linker warnings like -# Dialer (java:sdk) should not link to dialer-guava (java:platform) -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-guava-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/google/guava/guava/23.0/guava-23.0.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-dagger2-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger/2.7/dagger-2.7.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-disklrucache-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/maven_repo/bumptech/com/github/bumptech/glide/disklrucache/SNAPSHOT/disklrucache-SNAPSHOT.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-gifdecoder-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/maven_repo/bumptech/com/github/bumptech/glide/gifdecoder/SNAPSHOT/gifdecoder-SNAPSHOT.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-glide-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/maven_repo/bumptech/com/github/bumptech/glide/glide/SNAPSHOT/glide-SNAPSHOT.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-glide-annotation-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/maven_repo/bumptech/com/github/bumptech/glide/annotation/SNAPSHOT/annotation-SNAPSHOT.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-javax-annotation-api-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-javax-inject-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-commons-io-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-mime4j-core-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/org/apache/james/apache-mime4j-core/0.7.2/apache-mime4j-core-0.7.2.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-mime4j-dom-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/org/apache/james/apache-mime4j-dom/0.7.2/apache-mime4j-dom-0.7.2.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_MODULE := dialer-j2objc-annotations-target -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_SDK_VERSION := current -LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar -LOCAL_UNINSTALLABLE_MODULE := true - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE := dialer-rootcomponentprocessor -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_IS_HOST_MODULE := true -BASE_DIR := java/com/android - -LOCAL_SRC_FILES := \ - $(call all-java-files-under, $(BASE_DIR)/dialer/rootcomponentgenerator) \ - $(BASE_DIR)/dialer/inject/HasRootComponent.java \ - $(BASE_DIR)/dialer/inject/IncludeInDialerRoot.java \ - $(BASE_DIR)/dialer/inject/RootComponentGeneratorMetadata.java - -LOCAL_STATIC_JAVA_LIBRARIES := \ - dialer-guava \ - dialer-dagger2 \ - javapoet-prebuilt-jar \ - auto_service_annotations \ - auto_common \ - dialer-javax-annotation-api \ - dialer-javax-inject \ - error_prone_annotations - -LOCAL_JAVA_LANGUAGE_VERSION := 1.8 - -include $(BUILD_HOST_JAVA_LIBRARY) - -include $(CLEAR_VARS) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 9dd5dc7e3acd0e880a815673c9fab1e820f5f42c..8bbde4c7262432784a56dc36ecd2654d3c3ff780 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -14,102 +14,739 @@ --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + xmlns:tools="http://schemas.android.com/tools" + coreApp="true" + package="com.android.dialer" + android:versionCode="2900000" + android:versionName="23.0"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/quantum/AndroidManifest.xml b/assets/quantum/AndroidManifest.xml deleted file mode 100644 index 28f8eec9708689832b4167c74bb6b71898063d05..0000000000000000000000000000000000000000 --- a/assets/quantum/AndroidManifest.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - diff --git a/java/com/android/contacts/common/AndroidManifest.xml b/java/com/android/contacts/common/AndroidManifest.xml deleted file mode 100644 index cb1777a122104c912edf81ce11a90aa69dd7b690..0000000000000000000000000000000000000000 --- a/java/com/android/contacts/common/AndroidManifest.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/java/com/android/contacts/common/Collapser.java b/java/com/android/contacts/common/Collapser.java index 0b5c48bf260f8e25e020969787f332cabd789b01..f3d6850f0a8225e738ccf29d71356e61e13dbfd7 100644 --- a/java/com/android/contacts/common/Collapser.java +++ b/java/com/android/contacts/common/Collapser.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. @@ -17,8 +18,9 @@ package com.android.contacts.common; import android.content.Context; -import java.util.Iterator; + import java.util.List; +import java.util.Objects; /** * Class used for collapsing data items into groups of similar items. The data items that should be @@ -74,12 +76,7 @@ public final class Collapser { } // Remove the null items - Iterator itr = list.iterator(); - while (itr.hasNext()) { - if (itr.next() == null) { - itr.remove(); - } - } + list.removeIf(Objects::isNull); } /* diff --git a/java/com/android/contacts/common/ContactTileLoaderFactory.java b/java/com/android/contacts/common/ContactTileLoaderFactory.java index 80eda882bb32fd2b2a31f9306fc08d2d915fa697..c82b670cd0b79e79bcb719b93d9e9c02493fd913 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/ContactsUtils.java b/java/com/android/contacts/common/ContactsUtils.java index 5dac957755d7bd41b7bd605d2fe421517657821a..1a243615722aedf85dfa2b00af5870360f6cea67 100644 --- a/java/com/android/contacts/common/ContactsUtils.java +++ b/java/com/android/contacts/common/ContactsUtils.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. @@ -19,7 +20,7 @@ package com.android.contacts.common; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Directory; -import androidx.annotation.IntDef; +import androidx.annotation.LongDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -80,6 +81,6 @@ public class ContactsUtils { */ @Retention(RetentionPolicy.SOURCE) // TODO: Switch to @LongDef when @LongDef is available in the support library - @IntDef({(int) USER_TYPE_CURRENT, (int) USER_TYPE_WORK}) + @LongDef({USER_TYPE_CURRENT, USER_TYPE_WORK}) public @interface UserType {} } diff --git a/java/com/android/contacts/common/GroupMetaData.java b/java/com/android/contacts/common/GroupMetaData.java index 6afb2a44b35c029aff0170b123cd21fcd6426e9e..506fe44e190306f16de7ddf77f00d4c0e0bb8608 100644 --- a/java/com/android/contacts/common/GroupMetaData.java +++ b/java/com/android/contacts/common/GroupMetaData.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. @@ -21,13 +22,13 @@ package com.android.contacts.common; */ public final class GroupMetaData { - private String mAccountName; - private String mAccountType; - private String mDataSet; - private long mGroupId; - private String mTitle; - private boolean mDefaultGroup; - private boolean mFavorites; + private final String mAccountName; + private final String mAccountType; + private final String mDataSet; + private final long mGroupId; + private final String mTitle; + private final boolean mDefaultGroup; + private final boolean mFavorites; public GroupMetaData( String accountName, diff --git a/java/com/android/contacts/common/MoreContactUtils.java b/java/com/android/contacts/common/MoreContactUtils.java index 9749cabfdf9a822d59e727b6471f1e47403ece84..8fc22706e3c356caf03678b969fd806c9ddd8039 100644 --- a/java/com/android/contacts/common/MoreContactUtils.java +++ b/java/com/android/contacts/common/MoreContactUtils.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. @@ -23,6 +24,7 @@ import android.provider.ContactsContract; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.view.View; + import com.android.contacts.common.model.account.AccountType; import com.google.i18n.phonenumbers.NumberParseException; import com.google.i18n.phonenumbers.PhoneNumberUtil; diff --git a/java/com/android/contacts/common/database/EmptyCursor.java b/java/com/android/contacts/common/database/EmptyCursor.java index c2b24cdf7eaca3c4b1cf94ba20a6b44accfb5b2b..768302e1b4650b199688d18452136323862b3ae9 100644 --- a/java/com/android/contacts/common/database/EmptyCursor.java +++ b/java/com/android/contacts/common/database/EmptyCursor.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. @@ -27,7 +28,7 @@ import android.database.CursorIndexOutOfBoundsException; */ public final class EmptyCursor extends AbstractCursor { - private String[] mColumns; + private final String[] mColumns; public EmptyCursor(String[] columns) { this.mColumns = columns; diff --git a/java/com/android/contacts/common/dialog/CallSubjectDialog.java b/java/com/android/contacts/common/dialog/CallSubjectDialog.java index bf0ac14b25881261077f92f8c23d18be4c2ebaa4..610316b956d2cf9a3632d18e6e120ee23f936c84 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,15 +41,20 @@ 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.R; import com.android.dialer.animation.AnimUtils; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.LogUtil; import com.android.dialer.contactphoto.ContactPhotoManager; -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"; @@ -83,8 +88,6 @@ public class CallSubjectDialog extends Activity { private TextView mNumberView; private EditText mCallSubjectView; private TextView mCharacterLimitView; - private View mHistoryButton; - private View mSendAndCallButton; private ListView mSubjectList; private int mLimit = CALL_SUBJECT_LIMIT; @@ -110,27 +113,19 @@ public class CallSubjectDialog extends Activity { 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; @@ -142,43 +137,31 @@ public class CallSubjectDialog extends Activity { 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). @@ -291,22 +274,22 @@ public class CallSubjectDialog extends Activity { mBackgroundView = findViewById(R.id.call_subject_dialog); mBackgroundView.setOnClickListener(mBackgroundListener); mDialogView = findViewById(R.id.dialog_view); - mContactPhoto = (QuickContactBadge) findViewById(R.id.contact_photo); - mNameView = (TextView) findViewById(R.id.name); - mNumberView = (TextView) findViewById(R.id.number); - mCallSubjectView = (EditText) findViewById(R.id.call_subject); + mContactPhoto = findViewById(R.id.contact_photo); + mNameView = findViewById(R.id.name); + mNumberView = findViewById(R.id.number); + mCallSubjectView = findViewById(R.id.call_subject); mCallSubjectView.addTextChangedListener(mTextWatcher); mCallSubjectView.setOnClickListener(mCallSubjectClickListener); InputFilter[] filters = new InputFilter[1]; filters[0] = new InputFilter.LengthFilter(mLimit); mCallSubjectView.setFilters(filters); - mCharacterLimitView = (TextView) findViewById(R.id.character_limit); - mHistoryButton = findViewById(R.id.history_button); - mHistoryButton.setOnClickListener(mHistoryOnClickListener); - mHistoryButton.setVisibility(mSubjectHistory.isEmpty() ? View.GONE : View.VISIBLE); - mSendAndCallButton = findViewById(R.id.send_and_call_button); - mSendAndCallButton.setOnClickListener(mSendAndCallOnClickListener); - mSubjectList = (ListView) findViewById(R.id.subject_list); + mCharacterLimitView = findViewById(R.id.character_limit); + View historyButton = findViewById(R.id.history_button); + historyButton.setOnClickListener(mHistoryOnClickListener); + historyButton.setVisibility(mSubjectHistory.isEmpty() ? View.GONE : View.VISIBLE); + View sendAndCallButton = findViewById(R.id.send_and_call_button); + sendAndCallButton.setOnClickListener(mSendAndCallOnClickListener); + mSubjectList = findViewById(R.id.subject_list); mSubjectList.setOnItemClickListener(mItemClickListener); mSubjectList.setVisibility(View.GONE); @@ -344,14 +327,15 @@ public class CallSubjectDialog extends Activity { 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); } /** @@ -370,13 +354,14 @@ public class CallSubjectDialog extends Activity { length = subjectText.length(); } - mCharacterLimitView.setText(getString(R.string.call_subject_limit, length, mLimit)); + mCharacterLimitView.setText(getString(R.string.call_subject_limit, + String.valueOf(length), String.valueOf(mLimit))); if (length >= mLimit) { mCharacterLimitView.setTextColor( - getResources().getColor(R.color.call_subject_limit_exceeded)); + getResources().getColor(R.color.call_subject_limit_exceeded, getTheme())); } else { mCharacterLimitView.setTextColor( - getResources().getColor(R.color.dialer_secondary_text_color)); + getResources().getColor(R.color.dialer_secondary_text_color, getTheme())); } } @@ -428,9 +413,8 @@ public class CallSubjectDialog extends Activity { final int dialogStartingBottom = mDialogView.getBottom(); if (show) { // Showing the subject list; bind the list of history items to the list and show it. - ArrayAdapter adapter = - new ArrayAdapter( - CallSubjectDialog.this, R.layout.call_subject_history_list_item, mSubjectHistory); + ArrayAdapter adapter = new ArrayAdapter<>(CallSubjectDialog.this, + R.layout.call_subject_history_list_item, mSubjectHistory); mSubjectList.setAdapter(adapter); mSubjectList.setVisibility(View.VISIBLE); } else { diff --git a/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java b/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java index cd9511c38b4cee925a710f2a4d661b8ffa1709c5..ecea6ce28bdbfc74469fd6dc869bb6fe9160392c 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,21 +17,26 @@ 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; -import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; -import android.os.AsyncTask; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; import android.provider.ContactsContract; -import com.android.dialer.contacts.resources.R; + +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentManager; + +import com.android.dialer.R; import com.android.dialer.util.PermissionsUtil; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + /** Dialog that clears the frequently contacted list after confirming with the user. */ public class ClearFrequentsDialog extends DialogFragment { @@ -44,39 +50,27 @@ public class ClearFrequentsDialog extends DialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { final Context context = getActivity().getApplicationContext(); final ContentResolver resolver = getActivity().getContentResolver(); - final OnClickListener okListener = - new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (!PermissionsUtil.hasContactsReadPermissions(context)) { - return; - } + final OnClickListener okListener = (dialog, which) -> { + if (!PermissionsUtil.hasContactsReadPermissions(context)) { + return; + } - final ProgressDialog progressDialog = - ProgressDialog.show( - getContext(), - getString(R.string.clearFrequentsProgress_title), - null, - true, - true); + final ProgressDialog progressDialog = + ProgressDialog.show( + getContext(), + getString(R.string.clearFrequentsProgress_title), + null, + true, + true); - final AsyncTask task = - new AsyncTask() { - @Override - protected Void doInBackground(Void... params) { - resolver.delete( - ContactsContract.DataUsageFeedback.DELETE_USAGE_URI, null, null); - return null; - } + final ExecutorService executorService = Executors.newSingleThreadExecutor(); + final Handler handler = new Handler(Looper.getMainLooper()); - @Override - protected void onPostExecute(Void result) { - progressDialog.dismiss(); - } - }; - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } - }; + executorService.execute(() -> { + resolver.delete(ContactsContract.DataUsageFeedback.DELETE_USAGE_URI, null, null); + handler.post(progressDialog::dismiss); + }); + }; return new AlertDialog.Builder(getActivity()) .setTitle(R.string.clearFrequentsConfirmation_title) .setMessage(R.string.clearFrequentsConfirmation) diff --git a/java/com/android/contacts/common/list/ContactEntry.java b/java/com/android/contacts/common/list/ContactEntry.java index 75e6509e79080a7525ccc0bb75049f965a9e7bfe..31942554ef8ebbc1ddc538cfdfc4459cd11d914c 100644 --- a/java/com/android/contacts/common/list/ContactEntry.java +++ b/java/com/android/contacts/common/list/ContactEntry.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. @@ -19,6 +20,7 @@ package com.android.contacts.common.list; import android.content.Context; import android.net.Uri; import android.provider.ContactsContract.PinnedPositions; + import com.android.dialer.contacts.ContactsComponent; /** Class to hold contact information */ diff --git a/java/com/android/contacts/common/list/ContactListFilter.java b/java/com/android/contacts/common/list/ContactListFilter.java index 1a03bb64c445485d1839b7099f48cee421f555b5..39bd4a6f717381a43fea295501de5e15442719c7 100644 --- a/java/com/android/contacts/common/list/ContactListFilter.java +++ b/java/com/android/contacts/common/list/ContactListFilter.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. @@ -136,7 +137,7 @@ public final class ContactListFilter implements Comparable, P return new ContactListFilter(filterType, accountType, accountName, dataSet, null); } - public static final String filterTypeToString(int filterType) { + public static String filterTypeToString(int filterType) { switch (filterType) { case FILTER_TYPE_DEFAULT: return "FILTER_TYPE_DEFAULT"; diff --git a/java/com/android/contacts/common/list/ContactListFilterController.java b/java/com/android/contacts/common/list/ContactListFilterController.java index 60fba0d6d43058b5bed69dd05a2348c271da0351..f9b9710abbeafa017b0d026c90c27595e773de33 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; @@ -66,8 +70,7 @@ public abstract class ContactListFilterController { class ContactListFilterControllerImpl extends ContactListFilterController { private final Context mAppContext; - private final List mListeners = - new ArrayList(); + private final List mListeners = new ArrayList<>(); private ContactListFilter mFilter; public ContactListFilterControllerImpl(Context context) { diff --git a/java/com/android/contacts/common/list/ViewPagerTabStrip.java b/java/com/android/contacts/common/list/ViewPagerTabStrip.java index 667f3ce604bcfd914ad9a29c3a44cd4dfa521466..39252220a96e5ea31104ffa1333519e69fb4c4d7 100644 --- a/java/com/android/contacts/common/list/ViewPagerTabStrip.java +++ b/java/com/android/contacts/common/list/ViewPagerTabStrip.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. @@ -23,13 +24,14 @@ import android.graphics.Paint; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; + import com.android.dialer.contacts.resources.R; import com.android.dialer.theme.base.ThemeComponent; public class ViewPagerTabStrip extends LinearLayout { private final Paint mSelectedUnderlinePaint; - private int mSelectedUnderlineThickness; + private final int mSelectedUnderlineThickness; private int mIndexForSelection; private float mSelectionOffset; diff --git a/java/com/android/contacts/common/list/ViewPagerTabs.java b/java/com/android/contacts/common/list/ViewPagerTabs.java index b3242ee2b7d40eed2f8c04cd8408eeb8d72b5a0d..5ab23b867f7bbc7fa4ef3f02636bcd147061f50b 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; /** @@ -71,7 +74,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP ViewPager mPager; int mPrevSelected = -1; int mSidePadding; - private ViewPagerTabStrip mTabStrip; + private final ViewPagerTabStrip mTabStrip; private int[] mTabIcons; // For displaying the unread count next to the tab icon. private int[] mUnreadCounts; @@ -181,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 70800aef8da2e360faafb147c653b707557d343e..70009a58b0a1f6834f211d6804f790495b1bcc4d 100644 --- a/java/com/android/contacts/common/model/AccountTypeManager.java +++ b/java/com/android/contacts/common/model/AccountTypeManager.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. @@ -30,7 +31,6 @@ import android.content.SyncStatusObserver; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; -import android.os.AsyncTask; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; @@ -40,6 +40,7 @@ import android.provider.ContactsContract; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; + import com.android.contacts.common.MoreContactUtils; import com.android.contacts.common.list.ContactListFilterController; import com.android.contacts.common.model.account.AccountType; @@ -52,6 +53,7 @@ import com.android.contacts.common.model.account.GoogleAccountType; import com.android.contacts.common.model.account.SamsungAccountType; import com.android.contacts.common.model.dataitem.DataKind; import com.android.contacts.common.util.Constants; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -63,6 +65,8 @@ import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; /** @@ -160,8 +164,7 @@ class AccountTypeManagerImpl extends AccountTypeManager implements OnAccountsUpdateListener, SyncStatusObserver { private static final Map - EMPTY_UNMODIFIABLE_ACCOUNT_TYPE_MAP = - Collections.unmodifiableMap(new HashMap()); + EMPTY_UNMODIFIABLE_ACCOUNT_TYPE_MAP = Collections.unmodifiableMap(new HashMap<>()); /** * A sample contact URI used to test whether any activities will respond to an invitable intent @@ -172,37 +175,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 @@ -216,7 +215,7 @@ class AccountTypeManagerImpl extends AccountTypeManager private final AtomicBoolean mInvitablesTaskIsRunning = new AtomicBoolean(false); private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper()); - private Context mContext; + private final Context mContext; private final Runnable mCheckFilterValidityRunnable = new Runnable() { @Override @@ -224,17 +223,17 @@ class AccountTypeManagerImpl extends AccountTypeManager ContactListFilterController.getInstance(mContext).checkFilterValidity(true); } }; - private AccountManager mAccountManager; - private AccountType mFallbackAccountType; + private final AccountManager mAccountManager; + private final AccountType mFallbackAccountType; private List mAccounts = new ArrayList<>(); private List mContactWritableAccounts = new ArrayList<>(); private List mGroupWritableAccounts = new ArrayList<>(); private Map mAccountTypesWithDataSets = new ArrayMap<>(); private Map mInvitableAccountTypes = EMPTY_UNMODIFIABLE_ACCOUNT_TYPE_MAP; - private HandlerThread mListenerThread; - private Handler mListenerHandler; - private BroadcastReceiver mBroadcastReceiver = + private final HandlerThread mListenerThread; + private final Handler mListenerHandler; + private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override @@ -521,9 +520,9 @@ class AccountTypeManagerImpl extends AccountTypeManager } } - Collections.sort(allAccounts, ACCOUNT_COMPARATOR); - Collections.sort(contactWritableAccounts, ACCOUNT_COMPARATOR); - Collections.sort(groupWritableAccounts, ACCOUNT_COMPARATOR); + allAccounts.sort(ACCOUNT_COMPARATOR); + contactWritableAccounts.sort(ACCOUNT_COMPARATOR); + groupWritableAccounts.sort(ACCOUNT_COMPARATOR); synchronized (this) { mAccountTypesWithDataSets = accountTypesByTypeAndDataSet; @@ -698,8 +697,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. @@ -775,18 +774,20 @@ class AccountTypeManagerImpl extends AccountTypeManager * the list of all potential invitable account types. Once the work is completed, the list of * account types is stored in the {@link AccountTypeManager}'s {@link InvitableAccountTypeCache}. */ - private class FindInvitablesTask - extends AsyncTask> { - - @Override - protected Map doInBackground(Void... params) { - return findUsableInvitableAccountTypes(mContext); - } - - @Override - protected void onPostExecute(Map accountTypes) { - mInvitableAccountTypeCache.setCachedValue(accountTypes); - mInvitablesTaskIsRunning.set(false); + private class FindInvitablesTask { + + private void execute() { + ExecutorService executor = Executors.newSingleThreadExecutor(); + Handler handler = new Handler(Looper.getMainLooper()); + + executor.execute(() -> { + final Map accountTypes = + findUsableInvitableAccountTypes(mContext); + handler.post(() -> { + mInvitableAccountTypeCache.setCachedValue(accountTypes); + mInvitablesTaskIsRunning.set(false); + }); + }); } } } diff --git a/java/com/android/contacts/common/model/Contact.java b/java/com/android/contacts/common/model/Contact.java index 44b94f74f40a05e6336339f60155f39baf4d066b..08c5ce8777cc20f0136ca46eaed732fe9e9fbe93 100644 --- a/java/com/android/contacts/common/model/Contact.java +++ b/java/com/android/contacts/common/model/Contact.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. @@ -22,9 +23,11 @@ import android.provider.ContactsContract.CommonDataKinds.Photo; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.Directory; import android.provider.ContactsContract.DisplayNameSources; + import com.android.contacts.common.GroupMetaData; import com.android.contacts.common.model.account.AccountType; import com.google.common.collect.ImmutableList; + import java.util.ArrayList; /** diff --git a/java/com/android/contacts/common/model/ContactLoader.java b/java/com/android/contacts/common/model/ContactLoader.java index a3a3b9d7f7b1d9399516540ca14cc0f3bd43a1d9..8942bf44eb77427a9784446ac887f353ad50b50e 100644 --- a/java/com/android/contacts/common/model/ContactLoader.java +++ b/java/com/android/contacts/common/model/ContactLoader.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. @@ -16,7 +17,6 @@ package com.android.contacts.common.model; -import android.content.AsyncTaskLoader; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; @@ -36,6 +36,9 @@ import android.provider.ContactsContract.Directory; import android.provider.ContactsContract.Groups; import android.provider.ContactsContract.RawContacts; import android.text.TextUtils; + +import androidx.loader.content.AsyncTaskLoader; + import com.android.contacts.common.GroupMetaData; import com.android.contacts.common.model.account.AccountType; import com.android.contacts.common.model.account.AccountTypeWithDataSet; @@ -53,6 +56,11 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -64,9 +72,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; /** Loads a single Contact and all it constituent RawContacts. */ public class ContactLoader extends AsyncTaskLoader { @@ -79,10 +84,10 @@ public class ContactLoader extends AsyncTaskLoader { private final Uri mRequestedUri; private final Set mNotifiedRawContactIds = Sets.newHashSet(); private Uri mLookupUri; - private boolean mLoadGroupMetaData; - private boolean mLoadInvitableAccountTypes; - private boolean mPostViewNotification; - private boolean mComputeFormattedPhoneNumber; + private final boolean mLoadGroupMetaData; + private final boolean mLoadInvitableAccountTypes; + private final boolean mPostViewNotification; + private final boolean mComputeFormattedPhoneNumber; private Contact mContact; private ForceLoadContentObserver mObserver; @@ -292,8 +297,7 @@ public class ContactLoader extends AsyncTaskLoader { // status data. Initially, result has empty entities and statuses. long currentRawContactId = -1; RawContact rawContact = null; - ImmutableList.Builder rawContactsBuilder = - new ImmutableList.Builder(); + ImmutableList.Builder rawContactsBuilder = new ImmutableList.Builder<>(); do { long rawContactId = cursor.getLong(ContactQuery.RAW_CONTACT_ID); if (rawContactId != currentRawContactId) { @@ -388,8 +392,7 @@ public class ContactLoader extends AsyncTaskLoader { /** Sets the "invitable" account types to {@link Contact#mInvitableAccountTypes}. */ private void loadInvitableAccountTypes(Contact contactData) { - final ImmutableList.Builder resultListBuilder = - new ImmutableList.Builder(); + final ImmutableList.Builder resultListBuilder = new ImmutableList.Builder<>(); if (!contactData.isUserProfile()) { Map invitables = AccountTypeManager.getInstance(getContext()).getUsableInvitableAccountTypes(); @@ -594,7 +597,7 @@ public class ContactLoader extends AsyncTaskLoader { */ private void loadGroupMetaData(Contact result) { StringBuilder selection = new StringBuilder(); - ArrayList selectionArgs = new ArrayList(); + ArrayList selectionArgs = new ArrayList<>(); final HashSet accountsSeen = new HashSet<>(); for (RawContact rawContact : result.getRawContacts()) { final String accountName = rawContact.getAccountName(); @@ -619,8 +622,7 @@ public class ContactLoader extends AsyncTaskLoader { selection.append(")"); } } - final ImmutableList.Builder groupListBuilder = - new ImmutableList.Builder(); + final ImmutableList.Builder groupListBuilder = new ImmutableList.Builder<>(); final Cursor cursor = getContext() .getContentResolver() @@ -928,7 +930,7 @@ public class ContactLoader extends AsyncTaskLoader { static { List projectionList = Lists.newArrayList(COLUMNS_INTERNAL); projectionList.add(Data.CARRIER_PRESENCE); - COLUMNS = projectionList.toArray(new String[projectionList.size()]); + COLUMNS = projectionList.toArray(new String[0]); } } diff --git a/java/com/android/contacts/common/model/RawContact.java b/java/com/android/contacts/common/model/RawContact.java index 9efc8a87859048b0e3922f74e665a34260427031..cdb25718733eae4d9ff155de6d399e8944833372 100644 --- a/java/com/android/contacts/common/model/RawContact.java +++ b/java/com/android/contacts/common/model/RawContact.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. @@ -25,9 +26,11 @@ import android.os.Parcelable; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.RawContacts; + import com.android.contacts.common.model.account.AccountType; import com.android.contacts.common.model.account.AccountWithDataSet; import com.android.contacts.common.model.dataitem.DataItem; + import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -69,7 +72,7 @@ public final class RawContact implements Parcelable { public RawContact(ContentValues values) { mValues = values; - mDataItems = new ArrayList(); + mDataItems = new ArrayList<>(); } /** @@ -78,7 +81,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 +317,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/AccountType.java b/java/com/android/contacts/common/model/account/AccountType.java index e1fb572b7381b4c73e5be71d1bdc319c949b3021..fd9eb0ebd123fac9a9868de711f87c90c0b8762a 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,15 +25,17 @@ 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; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -48,7 +51,7 @@ public abstract class AccountType { private static final String TAG = "AccountType"; /** {@link Comparator} to sort by {@link DataKind#weight}. */ - private static Comparator sWeightComparator = + private final static Comparator sWeightComparator = Comparator.comparingInt(object -> object.weight); /** The {@link RawContacts#ACCOUNT_TYPE} these constraints apply to. */ public String accountType = null; @@ -203,7 +206,7 @@ public abstract class AccountType { * the account. */ public List getExtensionPackageNames() { - return new ArrayList(); + return new ArrayList<>(); } /** @@ -234,13 +237,6 @@ public abstract class AccountType { /** Whether or not groups created under this account type have editable membership lists. */ public abstract boolean isGroupMembershipEditable(); - /** Return list of {@link DataKind} supported, sorted by {@link DataKind#weight}. */ - public ArrayList getSortedDataKinds() { - // TODO: optimize by marking if already sorted - Collections.sort(mKinds, sWeightComparator); - return mKinds; - } - /** Find the {@link DataKind} for a specific MIME-type, if it's handled by this data source. */ public DataKind getKindForMimetype(String mimeType) { return this.mMimeKinds.get(mimeType); @@ -289,8 +285,8 @@ public abstract class AccountType { */ public static class EditType { - public int rawValue; - public int labelRes; + public final int rawValue; + public final int labelRes; public boolean secondary; /** * The number of entries allowed for the type. -1 if not specified. @@ -381,8 +377,8 @@ public abstract class AccountType { */ public static final class EditField { - public String column; - public int titleRes; + public final String column; + public final int titleRes; public int inputType; public int minLines; public boolean optional; diff --git a/java/com/android/contacts/common/model/account/AccountTypeWithDataSet.java b/java/com/android/contacts/common/model/account/AccountTypeWithDataSet.java index a32ebe139bc6aa59b77d2ceb47d5706c84e995b4..24fcac3754920952301fd16708ebe8c99febb513 100644 --- a/java/com/android/contacts/common/model/account/AccountTypeWithDataSet.java +++ b/java/com/android/contacts/common/model/account/AccountTypeWithDataSet.java @@ -23,6 +23,7 @@ import android.provider.BaseColumns; import android.provider.ContactsContract; import android.provider.ContactsContract.RawContacts; import android.text.TextUtils; + import java.util.Objects; /** Encapsulates an "account type" string and a "data set" string. */ diff --git a/java/com/android/contacts/common/model/account/AccountWithDataSet.java b/java/com/android/contacts/common/model/account/AccountWithDataSet.java index 54e9a3cea05f3a1089e3167df55e42ed45e7069b..63399d12b53276edd1717f52c022c3d890caa76b 100644 --- a/java/com/android/contacts/common/model/account/AccountWithDataSet.java +++ b/java/com/android/contacts/common/model/account/AccountWithDataSet.java @@ -16,20 +16,11 @@ package com.android.contacts.common.model.account; -import android.accounts.Account; -import android.content.Context; -import android.database.Cursor; -import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; -import android.provider.BaseColumns; -import android.provider.ContactsContract; -import android.provider.ContactsContract.RawContacts; import android.text.TextUtils; -import java.util.ArrayList; -import java.util.List; + import java.util.Objects; -import java.util.regex.Pattern; /** Wrapper for an account that includes a data set (which may be null). */ public class AccountWithDataSet implements Parcelable { diff --git a/java/com/android/contacts/common/model/account/BaseAccountType.java b/java/com/android/contacts/common/model/account/BaseAccountType.java index 1cf41514a22522e73c6cbd240c2f6109b0b4798a..0d8b73e744d6a23684ffdf7f8431e826ab5fbea4 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. @@ -37,43 +38,40 @@ import android.provider.ContactsContract.CommonDataKinds.Website; import android.util.ArrayMap; import android.util.AttributeSet; import android.view.inputmethod.EditorInfo; + import com.android.contacts.common.model.dataitem.DataKind; import com.android.contacts.common.util.CommonDateUtils; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.contacts.resources.R; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; -import org.xmlpull.v1.XmlPullParser; -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; @@ -314,28 +312,17 @@ public abstract class BaseAccountType extends AccountType { kind.actionBody = new SimpleInflater(Phone.NUMBER); kind.typeColumn = Phone.TYPE; kind.typeList = new ArrayList<>(); + kind.typeList = new ArrayList<>(); kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE)); - kind.typeList.add(buildPhoneType(Phone.TYPE_HOME)); kind.typeList.add(buildPhoneType(Phone.TYPE_WORK)); + kind.typeList.add(buildPhoneType(Phone.TYPE_HOME)); + kind.typeList.add(buildPhoneType(Phone.TYPE_MAIN)); kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true)); kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true)); kind.typeList.add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true)); kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER)); kind.typeList.add( - buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true).setCustomColumn(Phone.LABEL)); - kind.typeList.add(buildPhoneType(Phone.TYPE_CALLBACK).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_CAR).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_COMPANY_MAIN).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_ISDN).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_MAIN).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER_FAX).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_RADIO).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_TELEX).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_TTY_TDD).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_MOBILE).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_PAGER).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true)); - kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true)); + buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true).setCustomColumn(Phone.LABEL)); kind.fieldList = new ArrayList<>(); kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE)); @@ -354,7 +341,6 @@ public abstract class BaseAccountType extends AccountType { kind.typeList.add(buildEmailType(Email.TYPE_HOME)); kind.typeList.add(buildEmailType(Email.TYPE_WORK)); kind.typeList.add(buildEmailType(Email.TYPE_OTHER)); - kind.typeList.add(buildEmailType(Email.TYPE_MOBILE)); kind.typeList.add( buildEmailType(Email.TYPE_CUSTOM).setSecondary(true).setCustomColumn(Email.LABEL)); @@ -407,14 +393,6 @@ public abstract class BaseAccountType extends AccountType { kind.typeColumn = Im.PROTOCOL; kind.typeList = new ArrayList<>(); - kind.typeList.add(buildImType(Im.PROTOCOL_AIM)); - kind.typeList.add(buildImType(Im.PROTOCOL_MSN)); - kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO)); - kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE)); - kind.typeList.add(buildImType(Im.PROTOCOL_QQ)); - kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK)); - kind.typeList.add(buildImType(Im.PROTOCOL_ICQ)); - kind.typeList.add(buildImType(Im.PROTOCOL_JABBER)); kind.typeList.add( buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(Im.CUSTOM_PROTOCOL)); @@ -771,31 +749,7 @@ public abstract class BaseAccountType extends AccountType { @Override protected int getTypeLabelResource(Integer type) { - if (type == null) { - return R.string.chat; - } - switch (type) { - case Im.PROTOCOL_AIM: - return R.string.chat_aim; - case Im.PROTOCOL_MSN: - return R.string.chat_msn; - case Im.PROTOCOL_YAHOO: - return R.string.chat_yahoo; - case Im.PROTOCOL_SKYPE: - return R.string.chat_skype; - case Im.PROTOCOL_QQ: - return R.string.chat_qq; - case Im.PROTOCOL_GOOGLE_TALK: - return R.string.chat_gtalk; - case Im.PROTOCOL_ICQ: - return R.string.chat_icq; - case Im.PROTOCOL_JABBER: - return R.string.chat_jabber; - case Im.PROTOCOL_NETMEETING: - return R.string.chat; - default: - return R.string.chat; - } + return R.string.chat; } } @@ -1481,30 +1435,6 @@ public abstract class BaseAccountType extends AccountType { @Override protected EditType buildEditTypeForTypeTag(AttributeSet attrs, String type) { - if ("aim".equals(type)) { - return buildImType(Im.PROTOCOL_AIM); - } - if ("msn".equals(type)) { - return buildImType(Im.PROTOCOL_MSN); - } - if ("yahoo".equals(type)) { - return buildImType(Im.PROTOCOL_YAHOO); - } - if ("skype".equals(type)) { - return buildImType(Im.PROTOCOL_SKYPE); - } - if ("qq".equals(type)) { - return buildImType(Im.PROTOCOL_QQ); - } - if ("google_talk".equals(type)) { - return buildImType(Im.PROTOCOL_GOOGLE_TALK); - } - if ("icq".equals(type)) { - return buildImType(Im.PROTOCOL_ICQ); - } - if ("jabber".equals(type)) { - return buildImType(Im.PROTOCOL_JABBER); - } if ("custom".equals(type)) { return buildImType(Im.PROTOCOL_CUSTOM) .setSecondary(true) diff --git a/java/com/android/contacts/common/model/account/ExchangeAccountType.java b/java/com/android/contacts/common/model/account/ExchangeAccountType.java index 0a95e7ecbf01be349304539739e726c166a69c45..20f3c09fb58fbd0c436aa0baada8d0d4a85ba5d8 100644 --- a/java/com/android/contacts/common/model/account/ExchangeAccountType.java +++ b/java/com/android/contacts/common/model/account/ExchangeAccountType.java @@ -29,10 +29,12 @@ import android.provider.ContactsContract.CommonDataKinds.Photo; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.CommonDataKinds.StructuredPostal; import android.provider.ContactsContract.CommonDataKinds.Website; + import com.android.contacts.common.model.dataitem.DataKind; import com.android.contacts.common.util.CommonDateUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.contacts.resources.R; + import java.util.ArrayList; import java.util.Locale; diff --git a/java/com/android/contacts/common/model/account/ExternalAccountType.java b/java/com/android/contacts/common/model/account/ExternalAccountType.java index a38f8f2f84d2654684f4fd13a735318e1c1290e4..d93195b8c3541003b45628a02f9eef6b3ac2eb31 100644 --- a/java/com/android/contacts/common/model/account/ExternalAccountType.java +++ b/java/com/android/contacts/common/model/account/ExternalAccountType.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. @@ -30,14 +31,17 @@ 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 org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; /** A general contacts account type descriptor. */ public class ExternalAccountType extends BaseAccountType { @@ -151,7 +155,7 @@ public class ExternalAccountType extends BaseAccountType { } } - mExtensionPackageNames = new ArrayList(); + mExtensionPackageNames = new ArrayList<>(); mInviteActionLabelResId = resolveExternalResId( context, @@ -189,25 +193,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; } } } @@ -401,9 +403,7 @@ public class ExternalAccountType extends BaseAccountType { addKind(kind); } } - } catch (XmlPullParserException e) { - throw new DefinitionException("Problem reading XML", e); - } catch (IOException e) { + } catch (XmlPullParserException | IOException e) { throw new DefinitionException("Problem reading XML", e); } } diff --git a/java/com/android/contacts/common/model/account/FallbackAccountType.java b/java/com/android/contacts/common/model/account/FallbackAccountType.java index 9e8af628f2f61caccd54cccd0efadb73a22cb36d..6fc02f14c37d0a0a714fd844b725d9ccb3cca96f 100644 --- a/java/com/android/contacts/common/model/account/FallbackAccountType.java +++ b/java/com/android/contacts/common/model/account/FallbackAccountType.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. @@ -17,7 +18,7 @@ package com.android.contacts.common.model.account; import android.content.Context; -import com.android.contacts.common.model.dataitem.DataKind; + import com.android.dialer.common.LogUtil; import com.android.dialer.contacts.resources.R; diff --git a/java/com/android/contacts/common/model/account/GoogleAccountType.java b/java/com/android/contacts/common/model/account/GoogleAccountType.java index e10ade4790bbe8d247a7282c79fb43c4a2c8f301..55ab9450d1ce9f458264d3abee7f351423d39fdc 100644 --- a/java/com/android/contacts/common/model/account/GoogleAccountType.java +++ b/java/com/android/contacts/common/model/account/GoogleAccountType.java @@ -24,10 +24,12 @@ import android.provider.ContactsContract.CommonDataKinds.Email; import android.provider.ContactsContract.CommonDataKinds.Event; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.Relation; + import com.android.contacts.common.model.dataitem.DataKind; import com.android.contacts.common.util.CommonDateUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.contacts.resources.R; + import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/java/com/android/contacts/common/model/account/SamsungAccountType.java b/java/com/android/contacts/common/model/account/SamsungAccountType.java index 77c0575eac25dcd8546d8171cce08e770c3eda64..a550c3f056c167bcfbb7203cb0f92d422bff5bad 100644 --- a/java/com/android/contacts/common/model/account/SamsungAccountType.java +++ b/java/com/android/contacts/common/model/account/SamsungAccountType.java @@ -23,10 +23,12 @@ import android.provider.ContactsContract.CommonDataKinds.Event; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.Relation; import android.provider.ContactsContract.CommonDataKinds.StructuredPostal; + import com.android.contacts.common.model.dataitem.DataKind; import com.android.contacts.common.util.CommonDateUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.contacts.resources.R; + import java.util.ArrayList; import java.util.Locale; diff --git a/java/com/android/contacts/common/model/dataitem/DataItem.java b/java/com/android/contacts/common/model/dataitem/DataItem.java index 43a472bde8c220f408485faf390a1f22fdc54725..ebfe85e48c6b17fad46c09b25158b6989ab90beb 100644 --- a/java/com/android/contacts/common/model/dataitem/DataItem.java +++ b/java/com/android/contacts/common/model/dataitem/DataItem.java @@ -35,6 +35,7 @@ import android.provider.ContactsContract.CommonDataKinds.StructuredPostal; import android.provider.ContactsContract.CommonDataKinds.Website; import android.provider.ContactsContract.Contacts.Data; import android.provider.ContactsContract.Contacts.Entity; + import com.android.contacts.common.Collapser; import com.android.contacts.common.MoreContactUtils; import com.android.contacts.common.model.account.AccountType.EditType; diff --git a/java/com/android/contacts/common/model/dataitem/DataKind.java b/java/com/android/contacts/common/model/dataitem/DataKind.java index 3b470a2ae647f687632cfb26978908b4833f7ebb..194aa8436ea5dca412fc1df2e658981bcdcb11b5 100644 --- a/java/com/android/contacts/common/model/dataitem/DataKind.java +++ b/java/com/android/contacts/common/model/dataitem/DataKind.java @@ -19,10 +19,12 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; import android.content.Context; import android.provider.ContactsContract.Data; + import com.android.contacts.common.model.account.AccountType.EditField; import com.android.contacts.common.model.account.AccountType.EditType; import com.android.contacts.common.model.account.AccountType.StringInflater; import com.google.common.collect.Iterators; + import java.text.SimpleDateFormat; import java.util.List; diff --git a/java/com/android/contacts/common/model/dataitem/EmailDataItem.java b/java/com/android/contacts/common/model/dataitem/EmailDataItem.java index 2fe297816f7a2b846a55e368a0873c198296cd79..aed419de03f18a050c174fc1d90d50fd385a908f 100644 --- a/java/com/android/contacts/common/model/dataitem/EmailDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/EmailDataItem.java @@ -17,6 +17,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Email; /** diff --git a/java/com/android/contacts/common/model/dataitem/EventDataItem.java b/java/com/android/contacts/common/model/dataitem/EventDataItem.java index 15d9880b1439eea6882eb92e59b7cfe1bb7ef8cd..4060e67fee909a210a63b368a84d612dca62d624 100644 --- a/java/com/android/contacts/common/model/dataitem/EventDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/EventDataItem.java @@ -18,6 +18,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; import android.content.Context; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Event; import android.text.TextUtils; diff --git a/java/com/android/contacts/common/model/dataitem/GroupMembershipDataItem.java b/java/com/android/contacts/common/model/dataitem/GroupMembershipDataItem.java index 42a0dcddfb771d7be7ff4f9138175e1b71357225..7b5115db50fa89cd6aa23e7eff17423435c68d70 100644 --- a/java/com/android/contacts/common/model/dataitem/GroupMembershipDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/GroupMembershipDataItem.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. @@ -18,7 +19,6 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; import android.provider.ContactsContract; -import android.provider.ContactsContract.CommonDataKinds.GroupMembership; /** * Represents a group memebership data item, wrapping the columns in {@link diff --git a/java/com/android/contacts/common/model/dataitem/IdentityDataItem.java b/java/com/android/contacts/common/model/dataitem/IdentityDataItem.java index 81e6934f632165c0d5f5bbae50d01d7e4e498ab8..09cca100dbb8b879d3b3f45b729da96119bcdc75 100644 --- a/java/com/android/contacts/common/model/dataitem/IdentityDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/IdentityDataItem.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. @@ -17,7 +18,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; -import android.provider.ContactsContract.CommonDataKinds.Identity; +import android.provider.ContactsContract; /** * Represents an identity data item, wrapping the columns in {@link diff --git a/java/com/android/contacts/common/model/dataitem/ImDataItem.java b/java/com/android/contacts/common/model/dataitem/ImDataItem.java index 20a7a9a72e9954061b6a312038017db209a3b745..ed2b0c4aa875dfa6800e2dc04811c0db6519bba6 100644 --- a/java/com/android/contacts/common/model/dataitem/ImDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/ImDataItem.java @@ -18,6 +18,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; import android.content.Context; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Email; import android.provider.ContactsContract.CommonDataKinds.Im; import android.text.TextUtils; diff --git a/java/com/android/contacts/common/model/dataitem/NicknameDataItem.java b/java/com/android/contacts/common/model/dataitem/NicknameDataItem.java index a448be78624477e1ed7c83829db2a097dc5dd52a..0eabb40bf6a23dc28e3b2267c20009093b053f46 100644 --- a/java/com/android/contacts/common/model/dataitem/NicknameDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/NicknameDataItem.java @@ -17,6 +17,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Nickname; /** diff --git a/java/com/android/contacts/common/model/dataitem/NoteDataItem.java b/java/com/android/contacts/common/model/dataitem/NoteDataItem.java index b55ecc3e5daf29ada6b322e15797b66e197e9bed..ec9a862a14a837252aaf6757d70b7180491ad8df 100644 --- a/java/com/android/contacts/common/model/dataitem/NoteDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/NoteDataItem.java @@ -17,6 +17,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Note; /** diff --git a/java/com/android/contacts/common/model/dataitem/PhoneDataItem.java b/java/com/android/contacts/common/model/dataitem/PhoneDataItem.java index a314f7ab3f4875d33f8766c9523265c05376ee9e..e25328fdb591871660f8374001335379abfb397b 100644 --- a/java/com/android/contacts/common/model/dataitem/PhoneDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/PhoneDataItem.java @@ -19,6 +19,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; import android.content.Context; import android.provider.ContactsContract.CommonDataKinds.Phone; + import com.android.dialer.phonenumberutil.PhoneNumberHelper; /** diff --git a/java/com/android/contacts/common/model/dataitem/RelationDataItem.java b/java/com/android/contacts/common/model/dataitem/RelationDataItem.java index fdbcbb31335d8102749c3b47ae898d68eef32a5a..517b7a2f3dbd4ba496e160f88d1170df077b4c97 100644 --- a/java/com/android/contacts/common/model/dataitem/RelationDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/RelationDataItem.java @@ -18,6 +18,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; import android.content.Context; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Relation; import android.text.TextUtils; diff --git a/java/com/android/contacts/common/model/dataitem/StructuredNameDataItem.java b/java/com/android/contacts/common/model/dataitem/StructuredNameDataItem.java index a2ddf4365356ca9b629b250c314ba88087d1441b..2b5b48064ca66cae8b50d9b11f8406c8958e3650 100644 --- a/java/com/android/contacts/common/model/dataitem/StructuredNameDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/StructuredNameDataItem.java @@ -17,6 +17,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.Contacts.Data; diff --git a/java/com/android/contacts/common/model/dataitem/WebsiteDataItem.java b/java/com/android/contacts/common/model/dataitem/WebsiteDataItem.java index b8400ecd1b3d8d398e02138092fbba80c028fb33..53b103904a24546a75eb2ecde17cd75601072fb1 100644 --- a/java/com/android/contacts/common/model/dataitem/WebsiteDataItem.java +++ b/java/com/android/contacts/common/model/dataitem/WebsiteDataItem.java @@ -17,6 +17,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Website; /** diff --git a/java/com/android/contacts/common/util/ContactDisplayUtils.java b/java/com/android/contacts/common/util/ContactDisplayUtils.java index 22da7196aa722066e111c0feffa98d68e5832da9..74123f77acfb804b456c314458f953ad0e062cb4 100644 --- a/java/com/android/contacts/common/util/ContactDisplayUtils.java +++ b/java/com/android/contacts/common/util/ContactDisplayUtils.java @@ -31,6 +31,7 @@ import androidx.annotation.Nullable; import com.android.dialer.common.LogUtil; import com.android.dialer.contacts.resources.R; + import java.util.Objects; /** Methods for handling various contact data labels. */ diff --git a/java/com/android/contacts/common/util/ContactListViewUtils.java b/java/com/android/contacts/common/util/ContactListViewUtils.java index ba240792bc264c300c0dfed5893bb69d87f51ebf..5bdb96d194177e79f4e293be4c94e8404429a975 100644 --- a/java/com/android/contacts/common/util/ContactListViewUtils.java +++ b/java/com/android/contacts/common/util/ContactListViewUtils.java @@ -16,11 +16,8 @@ package com.android.contacts.common.util; -import android.content.res.Resources; import android.view.View; import android.widget.ListView; -import com.android.dialer.contacts.resources.R; -import com.android.dialer.util.ViewUtil; /** Utilities for configuring ListViews with a card background. */ public class ContactListViewUtils { diff --git a/java/com/android/contacts/common/util/ContactLoaderUtils.java b/java/com/android/contacts/common/util/ContactLoaderUtils.java index 371bb4eef32b304e47eac01e94af3adb9201e572..df081b127a3318ace947dd449abb01fd67759301 100644 --- a/java/com/android/contacts/common/util/ContactLoaderUtils.java +++ b/java/com/android/contacts/common/util/ContactLoaderUtils.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,10 +20,11 @@ package com.android.contacts.common.util; import android.content.ContentResolver; import android.content.ContentUris; import android.net.Uri; -import android.provider.Contacts; import android.provider.ContactsContract; import android.provider.ContactsContract.RawContacts; +import com.android.contacts.common.model.ContactLoader; + /** Utility methods for the {@link ContactLoader}. */ public final class ContactLoaderUtils { @@ -36,7 +38,6 @@ public final class ContactLoaderUtils { * *

Do not call from the UI thread. */ - @SuppressWarnings("deprecation") public static Uri ensureIsContactUri(final ContentResolver resolver, final Uri uri) throws IllegalArgumentException { if (uri == null) { diff --git a/java/com/android/contacts/common/util/DateUtils.java b/java/com/android/contacts/common/util/DateUtils.java index 09d52bce8cd24c71d65e00d771dfcaf20786f419..d5147eb9beba24437db46fa0ce5f52b994880642 100644 --- a/java/com/android/contacts/common/util/DateUtils.java +++ b/java/com/android/contacts/common/util/DateUtils.java @@ -16,7 +16,11 @@ package com.android.contacts.common.util; -import android.text.format.Time; +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; + /** Utility methods for processing dates. */ public class DateUtils { @@ -30,13 +34,9 @@ public class DateUtils { * @param date2 Second date to check. * @return The absolute difference in days between the two dates. */ - public static int getDayDifference(Time time, long date1, long date2) { - time.set(date1); - int startDay = Time.getJulianDay(date1, time.gmtoff); - - time.set(date2); - int currentDay = Time.getJulianDay(date2, time.gmtoff); - - return Math.abs(currentDay - startDay); + public static int getDayDifference(ZoneId timeZone, long date1, long date2) { + LocalDate localDate1 = Instant.ofEpochMilli(date1).atZone(timeZone).toLocalDate(); + LocalDate localDate2 = Instant.ofEpochMilli(date2).atZone(timeZone).toLocalDate(); + return Math.abs((int) ChronoUnit.DAYS.between(localDate2, localDate1)); } } diff --git a/java/com/android/contacts/common/util/TelephonyManagerUtils.java b/java/com/android/contacts/common/util/TelephonyManagerUtils.java index e4c2c63732e6df44957ec2dac09b0608d254883d..10af0f5a7b3dc7d79f64af4cf1d98192c85c7e29 100644 --- a/java/com/android/contacts/common/util/TelephonyManagerUtils.java +++ b/java/com/android/contacts/common/util/TelephonyManagerUtils.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,6 +16,7 @@ */ package com.android.contacts.common.util; +import android.annotation.SuppressLint; import android.content.Context; import android.telephony.TelephonyManager; @@ -27,6 +29,7 @@ public class TelephonyManagerUtils { * @param context Current application context * @return Voicemail tag, the alphabetic identifier associated with the voice mail number. */ + @SuppressLint("MissingPermission") public static String getVoiceMailAlphaTag(Context context) { final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); diff --git a/java/com/android/contacts/common/widget/ActivityTouchLinearLayout.java b/java/com/android/contacts/common/widget/ActivityTouchLinearLayout.java index 2988a5a58d2ff725b6df5530a4354a3635a13869..7df82c0b3745d8d9701bee07731d5ddd78d7a1b7 100644 --- a/java/com/android/contacts/common/widget/ActivityTouchLinearLayout.java +++ b/java/com/android/contacts/common/widget/ActivityTouchLinearLayout.java @@ -20,6 +20,7 @@ import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.LinearLayout; + import com.android.dialer.util.TouchPointManager; /** diff --git a/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java b/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java index d84d8f75736b239d657fe614ed43f51767d6e831..423881541b94c258cbe891844473f960380f9ba3 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/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java index 43027811c1badaedbe518e3d9b9747531a8df2c9..4a465a24bd3fc5b6a498f00bc29fdfa8d3c4a8cc 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,13 +18,12 @@ 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; import android.os.Handler; +import android.os.Looper; import android.os.ResultReceiver; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; @@ -43,6 +43,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; @@ -50,7 +52,8 @@ import com.android.dialer.location.GeoUtil; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.protos.ProtoParsers; import com.android.dialer.telecom.TelecomUtil; -import com.google.common.base.Optional; + +import java.util.Optional; /** * Dialog that allows the user to select a phone accounts for a given action. Optionally provides @@ -101,31 +104,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 = @@ -191,14 +186,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) { @@ -215,7 +210,7 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { static class SelectAccountListAdapter extends ArrayAdapter { - private int mResId; + private final int mResId; private final SelectPhoneAccountDialogOptions options; SelectAccountListAdapter( diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java index 1880d653877503636d8a6049ddd899e4d513b1f9..18b0055742ace7151bbcbb482eca900fb549c46a 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. @@ -18,11 +19,10 @@ package com.android.contacts.common.widget; import android.os.Parcel; import android.os.UserHandle; -import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; + import com.android.dialer.common.Assert; import com.android.dialer.telecom.TelecomUtil; - import com.google.protobuf.ByteString; import java.util.Collection; @@ -39,7 +39,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/activecalls/ActiveCallInfo.java b/java/com/android/dialer/activecalls/ActiveCallInfo.java index ccf35014189ee997862c037fbcdf19237dca0fca..7c93ceb9f2e1e5f8b393aadffffb10777582b09a 100644 --- a/java/com/android/dialer/activecalls/ActiveCallInfo.java +++ b/java/com/android/dialer/activecalls/ActiveCallInfo.java @@ -21,11 +21,11 @@ import android.telecom.PhoneAccountHandle; import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; -import com.google.common.base.Optional; + +import java.util.Optional; /** Info of an active call */ @AutoValue -@SuppressWarnings("Guava") public abstract class ActiveCallInfo { /** The {@link PhoneAccountHandle} the call is made with */ @@ -40,7 +40,7 @@ public abstract class ActiveCallInfo { public abstract static class Builder { public Builder setPhoneAccountHandle(@Nullable PhoneAccountHandle phoneAccountHandle) { - return setPhoneAccountHandle(Optional.fromNullable(phoneAccountHandle)); + return setPhoneAccountHandle(Optional.ofNullable(phoneAccountHandle)); } public abstract Builder setPhoneAccountHandle(Optional phoneAccountHandle); diff --git a/java/com/android/dialer/activecalls/ActiveCallsComponent.java b/java/com/android/dialer/activecalls/ActiveCallsComponent.java index 99e0e94930dfaf523073efb478910d3320758c2a..f583b8350dde310013f2607a9eba7498ec9ebd3e 100644 --- a/java/com/android/dialer/activecalls/ActiveCallsComponent.java +++ b/java/com/android/dialer/activecalls/ActiveCallsComponent.java @@ -17,8 +17,10 @@ package com.android.dialer.activecalls; import android.content.Context; + import com.android.dialer.inject.HasRootComponent; import com.android.dialer.inject.IncludeInDialerRoot; + import dagger.Subcomponent; /** Component for {@link ActiveCalls} */ diff --git a/java/com/android/dialer/activecalls/ActiveCallsModule.java b/java/com/android/dialer/activecalls/ActiveCallsModule.java index 9c02ba65755ea1e28b49a78bb5fdb18432dc5804..8ebb6ffb3724b7ddb655f6357db80b36a08a4dca 100644 --- a/java/com/android/dialer/activecalls/ActiveCallsModule.java +++ b/java/com/android/dialer/activecalls/ActiveCallsModule.java @@ -17,9 +17,11 @@ package com.android.dialer.activecalls; import com.android.dialer.activecalls.impl.ActiveCallsImpl; + +import javax.inject.Singleton; + import dagger.Binds; import dagger.Module; -import javax.inject.Singleton; /** Module for {@link ActiveCallsComponent} */ @Module diff --git a/java/com/android/dialer/activecalls/impl/ActiveCallsImpl.java b/java/com/android/dialer/activecalls/impl/ActiveCallsImpl.java index 10e6ffa9dc9e16019d1892224dfa19a861949264..8995962e9761f16232faf4f4cd7f4636ba5dfcf9 100644 --- a/java/com/android/dialer/activecalls/impl/ActiveCallsImpl.java +++ b/java/com/android/dialer/activecalls/impl/ActiveCallsImpl.java @@ -22,6 +22,7 @@ import com.android.dialer.activecalls.ActiveCallInfo; import com.android.dialer.activecalls.ActiveCalls; import com.android.dialer.common.Assert; import com.google.common.collect.ImmutableList; + import javax.inject.Inject; /** Implementation of {@link ActiveCalls} */ diff --git a/java/com/android/dialer/app/AccountSelectionActivity.java b/java/com/android/dialer/app/AccountSelectionActivity.java index de84a36b987f6c329df91a490497607d4bee971e..b6ab6b7942ffe7784091b11acc2f3dd381a872fe 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; @@ -60,7 +62,7 @@ public class AccountSelectionActivity extends AppCompatActivity { private String number; private CallInitiationType.Type initiationType; - private SelectPhoneAccountDialogFragment.SelectPhoneAccountListener listener = + private final SelectPhoneAccountDialogFragment.SelectPhoneAccountListener listener = new SelectPhoneAccountDialogFragment.SelectPhoneAccountListener() { @Override public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, @@ -85,8 +87,9 @@ public class AccountSelectionActivity extends AppCompatActivity { number = getIntent().getStringExtra("number"); initiationType = CallInitiationType.Type.values()[getIntent().getIntExtra("type", 0)]; - if (getFragmentManager().findFragmentByTag("dialog") == null) { - List handles = getIntent().getParcelableArrayListExtra("accountHandles"); + if (getSupportFragmentManager().findFragmentByTag("dialog") == null) { + List handles = getIntent().getParcelableArrayListExtra("accountHandles", + PhoneAccountHandle.class); SelectPhoneAccountDialogOptions options = SelectPhoneAccountDialogOptionsUtil .builderWithAccounts(handles) .setTitle(R.string.call_via_dialog_title) @@ -95,7 +98,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 deleted file mode 100644 index 15fd14c0d36ec319253f6119fe9e8fc105aafc30..0000000000000000000000000000000000000000 --- a/java/com/android/dialer/app/AndroidManifest.xml +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java index 6efdc6286c4c1372a58b9d20a71885769cc5a53d..b91d164df73a63162341b37dc5a9470729b5a46a 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 1a07daa1d4bd6b119dfb125e67f0cea6e10c296e..5df7fdd999f72bb138c976b0d90ccb8de868e428 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; @@ -86,14 +86,14 @@ public class CallLogActivity extends TransactionSafeActivity implements tabTitles[1] = getString(R.string.call_log_missed_title); tabTitles[2] = getString(R.string.call_log_stats_title); - viewPager = (ViewPager) findViewById(R.id.call_log_pager); + viewPager = findViewById(R.id.call_log_pager); - viewPagerAdapter = new ViewPagerAdapter(getFragmentManager()); + viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(viewPagerAdapter); viewPager.setOffscreenPageLimit(1); viewPager.setOnPageChangeListener(this); - viewPagerTabs = (ViewPagerTabs) findViewById(R.id.viewpager_header); + viewPagerTabs = findViewById(R.id.viewpager_header); viewPagerTabs.setViewPager(viewPager); viewPager.setCurrentItem(startingTab); @@ -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); @@ -212,11 +212,6 @@ public class CallLogActivity extends TransactionSafeActivity implements } } - @Override - public void onBackPressed() { - super.onBackPressed(); - } - /** Adapter for the view pager. */ public class ViewPagerAdapter extends FragmentPagerAdapter { diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index 866f4d725bfb2ae9cb9f0b070d0bf49abfa24cc8..869f90bd87c687fc6e6e9f303f754628e845217d 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. @@ -18,21 +19,16 @@ package com.android.dialer.app.calllog; import android.app.Activity; import android.content.ContentUris; -import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; import android.content.res.Resources; import android.database.Cursor; import android.net.Uri; -import android.os.AsyncTask; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; 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 +47,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; @@ -68,8 +68,6 @@ import com.android.dialer.calllogutils.PhoneCallDetails; import com.android.dialer.common.Assert; import com.android.dialer.common.FragmentUtils.FragmentUtilListener; import com.android.dialer.common.LogUtil; -import com.android.dialer.common.concurrent.AsyncTaskExecutor; -import com.android.dialer.common.concurrent.AsyncTaskExecutors; import com.android.dialer.contacts.ContactsComponent; import com.android.dialer.logging.ContactSource; import com.android.dialer.logging.ContactSource.Type; @@ -80,9 +78,12 @@ 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; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** Adapter class to fill in data for the Call Log. */ public class CallLogAdapter extends GroupingListAdapter @@ -119,8 +120,7 @@ public class CallLogAdapter extends GroupingListAdapter /** Helper to group call log entries. */ private final CallLogGroupBuilder callLogGroupBuilder; - private final AsyncTaskExecutor asyncTaskExecutor = AsyncTaskExecutors.createAsyncTaskExecutor(); - private ContactInfoCache contactInfoCache; + private final ContactInfoCache contactInfoCache; // Tracks the position of the currently expanded list item. private int currentlyExpandedPosition = RecyclerView.NO_POSITION; // Tracks the rowId of the currently expanded list item, so the position can be updated if there @@ -201,34 +201,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(); } @@ -380,7 +363,7 @@ public class CallLogAdapter extends GroupingListAdapter * if removing an item, it will be shown as an invisible view. This simplifies the calculation of * item position. */ - @NonNull private Set hiddenRowIds = new ArraySet<>(); + @NonNull private final Set hiddenRowIds = new ArraySet<>(); /** * Holds a list of URIs that are pending deletion or undo. If the activity ends before the undo * timeout, all of the pending URIs will be deleted. @@ -391,7 +374,7 @@ public class CallLogAdapter extends GroupingListAdapter */ @NonNull private final Set hiddenItemUris = new ArraySet<>(); - private CallLogListItemViewHolder.OnClickListener blockReportSpamListener; + private final CallLogListItemViewHolder.OnClickListener blockReportSpamListener; /** * Map, keyed by call ID, used to track the callback action for a call. Calls associated with the @@ -611,7 +594,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 = @@ -643,7 +626,7 @@ public class CallLogAdapter extends GroupingListAdapter * @param position The position of the entry. */ @Override - public void onBindViewHolder(ViewHolder viewHolder, int position) { + public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) { Trace.beginSection("onBindViewHolder: " + position); switch (getItemViewType(position)) { case VIEW_TYPE_ALERT: @@ -663,7 +646,7 @@ public class CallLogAdapter extends GroupingListAdapter updateCheckMarkedStatusOfEntry(views); if (views.asyncTask != null) { - views.asyncTask.cancel(true); + views.asyncTask.cancel(); } } } @@ -726,10 +709,7 @@ public class CallLogAdapter extends GroupingListAdapter } private boolean isHiddenRow(@Nullable String number, long rowId) { - if (hiddenRowIds.contains(rowId)) { - return true; - } - return false; + return hiddenRowIds.contains(rowId); } private void loadAndRender( @@ -744,38 +724,68 @@ public class CallLogAdapter extends GroupingListAdapter viewHolder.isBlocked = false; viewHolder.setDetailedPhoneDetails(callDetailsEntries); - final AsyncTask loadDataTask = - new AsyncTask() { - @Override - protected Boolean doInBackground(Void... params) { - viewHolder.isBlocked = BlockedNumberContract.canCurrentUserBlockNumbers(activity) && - BlockedNumberContract.isBlocked(activity, viewHolder.number); - details.isBlocked = viewHolder.isBlocked; - if (isCancelled()) { - return false; - } - return !isCancelled() && loadData(viewHolder, rowId, details); - } + final LoadDataTask loadDataTask = new LoadDataTask(viewHolder, details, rowId); - @Override - protected void onPostExecute(Boolean success) { - viewHolder.isLoaded = true; - if (success) { - viewHolder.callbackAction = getCallbackAction(viewHolder.rowId); - int currentDayGroup = getDayGroup(viewHolder.rowId); - if (currentDayGroup != details.previousGroup) { - viewHolder.dayGroupHeaderVisibility = View.VISIBLE; - viewHolder.dayGroupHeaderText = getGroupDescription(currentDayGroup); - } else { - viewHolder.dayGroupHeaderVisibility = View.GONE; - } - render(viewHolder, details, rowId); + viewHolder.asyncTask = loadDataTask; + loadDataTask.execute(); + } + + public interface LoadDataTaskInterface { + void execute(); + void cancel(); + } + + private class LoadDataTask implements LoadDataTaskInterface { + + private boolean mIsCancelled = false; + private final CallLogListItemViewHolder mViewHolder; + private final PhoneCallDetails mDetails; + private final long mRowId; + + private final ExecutorService mExecutor; + private final Handler mHandler; + + public LoadDataTask(CallLogListItemViewHolder viewHolder, PhoneCallDetails details, + long rowId) { + mExecutor = Executors.newSingleThreadExecutor(); + mHandler = new Handler(Looper.getMainLooper()); + mViewHolder = viewHolder; + mDetails = details; + mRowId = rowId; + } + + public void execute() { + mExecutor.execute(() -> { + final boolean success; + mViewHolder.isBlocked = BlockedNumberContract.canCurrentUserBlockNumbers(activity) && + BlockedNumberContract.isBlocked(activity, mViewHolder.number); + mDetails.isBlocked = mViewHolder.isBlocked; + if (mIsCancelled) { + success = false; + } else { + success = !mIsCancelled && loadData(mViewHolder, mRowId, mDetails); + } + + mHandler.post(() -> { + mViewHolder.isLoaded = true; + if (success) { + mViewHolder.callbackAction = getCallbackAction(mViewHolder.rowId); + int currentDayGroup = getDayGroup(mViewHolder.rowId); + if (currentDayGroup != mDetails.previousGroup) { + mViewHolder.dayGroupHeaderVisibility = View.VISIBLE; + mViewHolder.dayGroupHeaderText = getGroupDescription(currentDayGroup); + } else { + mViewHolder.dayGroupHeaderVisibility = View.GONE; } + render(mViewHolder, mDetails, mRowId); } - }; + }); + }); + } - viewHolder.asyncTask = loadDataTask; - asyncTaskExecutor.submit(LOAD_DATA_TASK_IDENTIFIER, loadDataTask); + public void cancel() { + mIsCancelled = true; + } } /** diff --git a/java/com/android/dialer/app/calllog/CallLogAlertManager.java b/java/com/android/dialer/app/calllog/CallLogAlertManager.java index 40b30f001edd7d0a9e660cc459d36aeaf4014a3c..1440c70030a2b7ac7e33cc044736cabb0872dec1 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/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java index d285848af106849bb52921445458a198f6b4dade..3aebbe9cf88433353526fe6e6e0d59ef56b306d9 100644 --- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java +++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.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,7 +21,6 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.os.AsyncTask; import android.provider.CallLog; import android.provider.VoicemailContract.Voicemails; import android.text.TextUtils; @@ -52,23 +52,18 @@ public class CallLogAsyncTaskUtil { } asyncTaskExecutor.submit( - Tasks.MARK_VOICEMAIL_READ, - new AsyncTask() { - @Override - public Void doInBackground(Void... params) { - ContentValues values = new ContentValues(); - values.put(Voicemails.IS_READ, true); - // "External" changes to the database will be automatically marked as dirty, but this - // voicemail might be from dialer so it need to be marked manually. - values.put(Voicemails.DIRTY, 1); - if (context - .getContentResolver() - .update(voicemailUri, values, Voicemails.IS_READ + " = 0", null) - > 0) { - uploadVoicemailLocalChangesToServer(context); - CallLogNotificationsService.markAllNewVoicemailsAsOld(context); - } - return null; + Tasks.MARK_VOICEMAIL_READ, () -> { + ContentValues values = new ContentValues(); + values.put(Voicemails.IS_READ, true); + // "External" changes to the database will be automatically marked as dirty, but this + // voicemail might be from dialer so it need to be marked manually. + values.put(Voicemails.DIRTY, 1); + if (context + .getContentResolver() + .update(voicemailUri, values, Voicemails.IS_READ + " = 0", null) + > 0) { + uploadVoicemailLocalChangesToServer(context); + CallLogNotificationsService.markAllNewVoicemailsAsOld(context); } }); } @@ -81,22 +76,13 @@ public class CallLogAsyncTaskUtil { initTaskExecutor(); } - asyncTaskExecutor.submit( - Tasks.DELETE_VOICEMAIL, - new AsyncTask() { - @Override - public Void doInBackground(Void... params) { - deleteVoicemailSynchronous(context, voicemailUri); - return null; - } - - @Override - public void onPostExecute(Void result) { - if (callLogAsyncTaskListener != null) { - callLogAsyncTaskListener.onDeleteVoicemail(); - } - } - }); + asyncTaskExecutor.submit(Tasks.DELETE_VOICEMAIL, + () -> deleteVoicemailSynchronous(context, voicemailUri), + () -> { + if (callLogAsyncTaskListener != null) { + callLogAsyncTaskListener.onDeleteVoicemail(); + } + }); } public static void deleteVoicemailSynchronous(Context context, Uri voicemailUri) { @@ -117,35 +103,28 @@ public class CallLogAsyncTaskUtil { initTaskExecutor(); } - asyncTaskExecutor.submit( - Tasks.MARK_CALL_READ, - new AsyncTask() { - @Override - public Void doInBackground(Void... params) { - - StringBuilder where = new StringBuilder(); - where.append(CallLog.Calls.TYPE).append(" = ").append(CallLog.Calls.MISSED_TYPE); - where.append(" AND "); - - Long[] callIdLongs = new Long[callIds.length]; - for (int i = 0; i < callIds.length; i++) { - callIdLongs[i] = callIds[i]; - } - where - .append(CallLog.Calls._ID) - .append(" IN (" + TextUtils.join(",", callIdLongs) + ")"); - - ContentValues values = new ContentValues(1); - values.put(CallLog.Calls.IS_READ, "1"); - context - .getContentResolver() - .update(CallLog.Calls.CONTENT_URI, values, where.toString(), null); - return null; - } - }); + asyncTaskExecutor.submit(Tasks.MARK_CALL_READ, () -> { + StringBuilder where = new StringBuilder(); + where.append(CallLog.Calls.TYPE).append(" = ").append(CallLog.Calls.MISSED_TYPE); + where.append(" AND "); + + Long[] callIdLongs = new Long[callIds.length]; + for (int i = 0; i < callIds.length; i++) { + callIdLongs[i] = callIds[i]; + } + where + .append(CallLog.Calls._ID) + .append(" IN (" + TextUtils.join(",", callIdLongs) + ")"); + + ContentValues values = new ContentValues(1); + values.put(CallLog.Calls.IS_READ, "1"); + context + .getContentResolver() + .update(CallLog.Calls.CONTENT_URI, values, where.toString(), null); + }); } - /** The enumeration of {@link AsyncTask} objects used in this class. */ + /** The enumeration of objects used in this class. */ public enum Tasks { DELETE_VOICEMAIL, MARK_VOICEMAIL_READ, diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index 058dba8f7d33522ab3773ed956b9af0b937c67f2..cd2371f838df05c56ffc693d2a15d9ce0d009011 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; @@ -44,10 +39,17 @@ 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; +import androidx.appcompat.content.res.AppCompatResources; +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 +69,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 +81,6 @@ public class CallLogFragment extends Fragment CallFetcher, MultiSelectRemoveView, OnEmptyViewActionButtonClickedListener, - OnRequestPermissionsResultCallback, CallLogModalAlertManager.Listener, OnClickListener { private static final String KEY_FILTER_TYPE = "filter_type"; @@ -94,12 +96,10 @@ 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; - 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(); @@ -140,7 +140,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) { @@ -156,6 +156,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); } @@ -213,7 +222,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); @@ -257,16 +266,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; } @@ -318,7 +323,7 @@ public class CallLogFragment extends Fragment contactInfoCache = new ContactInfoCache( - ExpirableCacheHeadlessFragment.attach((AppCompatActivity) getActivity()) + ExpirableCacheHeadlessFragment.attach(getChildFragmentManager()) .getRetainedCache(), new ContactInfoHelper(getActivity(), currentCountryIso), onContactInfoChangedListener); @@ -334,7 +339,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 +353,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 +362,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 +391,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,7 +412,10 @@ 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"); } } @@ -426,7 +435,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); @@ -443,8 +452,8 @@ public class CallLogFragment extends Fragment @Override public void onDestroy() { LogUtil.enterBlock("CallLogFragment.onDestroy"); - getActivity().getContentResolver().unregisterContentObserver(callLogObserver); - getActivity().getContentResolver().unregisterContentObserver(contactsObserver); + requireActivity().getContentResolver().unregisterContentObserver(callLogObserver); + requireActivity().getContentResolver().unregisterContentObserver(contactsObserver); if (adapter != null) { adapter.changeCursor(null); } @@ -452,7 +461,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,7 +571,7 @@ public class CallLogFragment extends Fragment LogUtil.i( "CallLogFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - FragmentCompat.requestPermissions(this, 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. @@ -570,17 +579,6 @@ public class CallLogFragment extends Fragment } } - @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() { if (!displayUpdateHandler.hasMessages(EVENT_UPDATE_DISPLAY)) { @@ -672,8 +670,8 @@ public class CallLogFragment extends Fragment @Override public void setSelectAllModeToFalse() { selectAllMode = false; - selectUnselectAllIcon.setImageDrawable( - getContext().getDrawable(R.drawable.ic_empty_check_mark_white_24dp)); + selectUnselectAllIcon.setImageDrawable(AppCompatResources.getDrawable(requireContext(), + R.drawable.ic_empty_check_mark_white_24dp)); } @Override @@ -691,12 +689,12 @@ public class CallLogFragment extends Fragment private void updateSelectAllIcon() { if (selectAllMode) { - selectUnselectAllIcon.setImageDrawable( - getContext().getDrawable(R.drawable.ic_check_mark_blue_24dp)); + selectUnselectAllIcon.setImageDrawable(AppCompatResources.getDrawable(requireContext(), + R.drawable.ic_check_mark_blue_24dp)); getAdapter().onAllSelected(); } else { - selectUnselectAllIcon.setImageDrawable( - getContext().getDrawable(R.drawable.ic_empty_check_mark_white_24dp)); + selectUnselectAllIcon.setImageDrawable(AppCompatResources.getDrawable(requireContext(), + R.drawable.ic_empty_check_mark_white_24dp)); getAdapter().onAllDeselected(); } } diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java index db3f284001b8f55c92e832dd54a139583ccc93f9..e4d27a4b0b03de0242d6d96cde3b3dfb451ba36a 100644 --- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java +++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java @@ -20,7 +20,6 @@ import android.database.Cursor; import android.provider.CallLog.Calls; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; -import android.text.format.Time; import androidx.annotation.Nullable; @@ -30,7 +29,8 @@ import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.phonenumbercache.CallLogQuery; import com.android.dialer.phonenumberutil.PhoneNumberHelper; -import java.util.Objects; + +import java.time.ZoneId; /** * Groups together calls in the call log. The primary grouping attempts to group together calls to @@ -55,7 +55,7 @@ public class CallLogGroupBuilder { /** Day grouping for calls which occurred before last week. */ public static final int DAY_GROUP_OTHER = 2; /** Instance of the time object used for time calculations. */ - private static final Time TIME = new Time(); + private static final ZoneId TIME_ZONE = ZoneId.systemDefault(); /** The object on which the groups are created. */ private final GroupCreator groupCreator; @@ -189,7 +189,7 @@ public class CallLogGroupBuilder { */ private boolean equalNumbers(@Nullable String number1, @Nullable String number2) { if (PhoneNumberHelper.isUriNumber(number1) || PhoneNumberHelper.isUriNumber(number2)) { - return compareSipAddresses(number1, number2); + return PhoneNumberHelper.compareSipAddresses(number1, number2); } // PhoneNumberUtils.compare(String, String) ignores special characters such as '#'. For example, @@ -208,36 +208,6 @@ public class CallLogGroupBuilder { return TextUtils.equals(name1, name2) && TextUtils.equals(id1, id2); } - private boolean compareSipAddresses(@Nullable String number1, @Nullable String number2) { - if (number1 == null || number2 == null) { - return Objects.equals(number1, number2); - } - - int index1 = number1.indexOf('@'); - final String userinfo1; - final String rest1; - if (index1 != -1) { - userinfo1 = number1.substring(0, index1); - rest1 = number1.substring(index1); - } else { - userinfo1 = number1; - rest1 = ""; - } - - int index2 = number2.indexOf('@'); - final String userinfo2; - final String rest2; - if (index2 != -1) { - userinfo2 = number2.substring(0, index2); - rest2 = number2.substring(index2); - } else { - userinfo2 = number2; - rest2 = ""; - } - - return userinfo1.equals(userinfo2) && rest1.equalsIgnoreCase(rest2); - } - /** * Given a call date and the current date, determine which date group the call belongs in. * @@ -246,7 +216,7 @@ public class CallLogGroupBuilder { * @return The date group the call belongs in. */ private int getDayGroup(long date, long now) { - int days = DateUtils.getDayDifference(TIME, date, now); + int days = DateUtils.getDayDifference(TIME_ZONE, date, now); if (days == 0) { return DAY_GROUP_TODAY; diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 53cc4b70677bcda444f7ccc7c2d86daf4d41a246..1dd4e5360e5f1b8059c74f099661b48702925156 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. @@ -29,13 +30,10 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.net.Uri; -import android.os.AsyncTask; 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 +43,24 @@ 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; @@ -72,7 +71,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; @@ -88,8 +86,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; /** @@ -130,7 +127,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder private final CachedNumberLookupService cachedNumberLookupService; private final VoicemailPlaybackPresenter voicemailPlaybackPresenter; private final OnClickListener blockReportListener; - @HostUi private final int hostUi; /** Whether the data fields are populated by the worker thread, ready to be shown. */ public boolean isLoaded; /** The view containing call log item actions. Null until the ViewStub is inflated. */ @@ -150,8 +146,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder public View detailsButtonView; public View callWithNoteButtonView; public View sendVoicemailButtonView; - public ImageView workIconView; - public ImageView checkBoxView; + public final ImageView workIconView; + public final ImageView checkBoxView; /** * The row Id for the first call associated with the call log entry. Used as a key for the map * used to track which call log entries have the action button section expanded. @@ -217,7 +213,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder /** Whether the current log entry is a spam number or not. */ public boolean isSpam; - private View.OnClickListener expandCollapseListener; + private final View.OnClickListener expandCollapseListener; private final OnActionModeStateChangedListener onActionModeStateChangedListener; private final View.OnLongClickListener longPressListener; private boolean voicemailPrimaryActionButtonClicked; @@ -227,7 +223,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder public CharSequence dayGroupHeaderText; public boolean isAttachedToWindow; - public AsyncTask asyncTask; + public CallLogAdapter.LoadDataTaskInterface asyncTask; private CallDetailsEntries callDetailsEntries; private CallLogListItemViewHolder( @@ -269,21 +265,13 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder this.callLogEntryView = callLogEntryView; this.dayGroupHeader = dayGroupHeader; this.primaryActionButtonView = primaryActionButtonView; - this.workIconView = (ImageView) rootView.findViewById(R.id.work_profile_icon); - this.checkBoxView = (ImageView) rootView.findViewById(R.id.quick_contact_checkbox); + this.workIconView = rootView.findViewById(R.id.work_profile_icon); + this.checkBoxView = rootView.findViewById(R.id.quick_contact_checkbox); // Set text height to false on the TextViews so they don't have extra padding. phoneCallDetailsViews.nameView.setElegantTextHeight(false); phoneCallDetailsViews.callLocationAndDate.setElegantTextHeight(false); - if (this.context instanceof CallLogActivity) { - hostUi = HostUi.CALL_HISTORY; - } else if (this.voicemailPlaybackPresenter == null) { - hostUi = HostUi.CALL_LOG; - } else { - hostUi = HostUi.VOICEMAIL; - } - quickContactView.setOverlay(null); quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); primaryActionButtonView.setOnClickListener(this); @@ -493,7 +481,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder videoCallButtonView.setVisibility(View.GONE); // For an emergency number, show "Call details" only. - if (PhoneNumberHelper.isLocalEmergencyNumber(context, number)) { + if (PhoneNumberHelper.isEmergencyNumber(context, number)) { createNewContactButtonView.setVisibility(View.GONE); addToExistingContactButtonView.setVisibility(View.GONE); sendMessageView.setVisibility(View.GONE); @@ -897,14 +885,8 @@ 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) - == VideoProfile.STATE_BIDIRECTIONAL) { - } - DialerUtils.startActivityWithErrorToast(context, intent); } } @@ -965,11 +947,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder blockView.setVisibility(View.GONE); unblockView.setVisibility(View.GONE); reportNotSpamView.setVisibility(View.GONE); - String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso); + if (!canPlaceCallToNumber || isVoicemailNumber || !BlockedNumberContract.canCurrentUserBlockNumbers(context) - || PhoneNumberUtils.isEmergencyNumber(e164Number)) { + || PhoneNumberHelper.isEmergencyNumber(context, number, countryIso)) { return; } @@ -1022,13 +1004,12 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder .setOnMenuItemClickListener(this); } - String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso); boolean isVoicemailNumber = callLogCache.isVoicemailNumber(accountHandle, number); boolean canPlaceCallToNumber = PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation); if (canPlaceCallToNumber && !isVoicemailNumber && BlockedNumberContract.canCurrentUserBlockNumbers(context) - && !PhoneNumberUtils.isEmergencyNumber(e164Number)) { + && !PhoneNumberHelper.isEmergencyNumber(context, number, countryIso)) { if (isBlocked) { menu.add( ContextMenu.NONE, @@ -1052,15 +1033,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } } - /** Specifies where the view holder belongs. */ - @IntDef({HostUi.CALL_LOG, HostUi.CALL_HISTORY, HostUi.VOICEMAIL}) - @Retention(RetentionPolicy.SOURCE) - private @interface HostUi { - int CALL_LOG = 0; - int CALL_HISTORY = 1; - int VOICEMAIL = 2; - } - public interface OnClickListener { void onBlockReportSpam( @@ -1093,7 +1065,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder ContactSource.Type contactSourceType); } - private static class DeleteCallTask extends AsyncTask { + private static class DeleteCallTask implements Runnable { // Using a weak reference to hold the Context so that there is no memory leak. private final WeakReference contextWeakReference; @@ -1104,15 +1076,15 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder this.callIdsStr = concatCallIds(callIdsArray); } - @Override // Suppress the lint check here as the user will not be able to see call log entries if // permission.WRITE_CALL_LOG is not granted. @SuppressLint("MissingPermission") @RequiresPermission(value = permission.WRITE_CALL_LOG) - protected Void doInBackground(Void... params) { + @Override + public void run() { Context context = contextWeakReference.get(); if (context == null) { - return null; + return; } if (callIdsStr != null) { @@ -1126,13 +1098,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder .getContentResolver() .notifyChange(Calls.CONTENT_URI, null); } - - return null; } - @Override - public void onPostExecute(Void result) {} - private String concatCallIds(long[] callIds) { if (callIds == null || callIds.length == 0) { return null; diff --git a/java/com/android/dialer/app/calllog/CallLogModalAlertManager.java b/java/com/android/dialer/app/calllog/CallLogModalAlertManager.java index 9de260a0ae1ca636e0ba514b1977fcc1c821b180..7d8ed4b3b6d7698d78f97ecde222a3ed9d1575cf 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 c08d2c02b47b648e62bca21f462a74ab710dbfe3..b8488c537b9cc5241c6ef7dda751b2128352adc0 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 60d82f69bc3572bbaa6df8555d81fd9bbd0eaf7f..00d08de0ae81cd99a6f6b4eebf994250ba70d551 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/CallLogNotificationsService.java b/java/com/android/dialer/app/calllog/CallLogNotificationsService.java index 947dd0213a881450645a340d4339edc1ab110d0e..d2d31a3c11e0138dea2beab0f319fba0d51b77ae 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsService.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsService.java @@ -99,7 +99,7 @@ public class CallLogNotificationsService extends IntentService { public static PendingIntent createMarkAllNewVoicemailsAsOldIntent(@NonNull Context context) { Intent intent = new Intent(context, CallLogNotificationsService.class); intent.setAction(CallLogNotificationsService.ACTION_MARK_ALL_NEW_VOICEMAILS_AS_OLD); - return PendingIntent.getService(context, 0, intent, 0); + return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); } public static PendingIntent createMarkSingleNewVoicemailAsOldIntent( @@ -107,13 +107,13 @@ public class CallLogNotificationsService extends IntentService { Intent intent = new Intent(context, CallLogNotificationsService.class); intent.setAction(CallLogNotificationsService.ACTION_MARK_SINGLE_NEW_VOICEMAIL_AS_OLD); intent.setData(voicemailUri); - return PendingIntent.getService(context, 0, intent, 0); + return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); } public static PendingIntent createCancelAllMissedCallsPendingIntent(@NonNull Context context) { Intent intent = new Intent(context, CallLogNotificationsService.class); intent.setAction(ACTION_CANCEL_ALL_MISSED_CALLS); - return PendingIntent.getService(context, 0, intent, 0); + return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); } public static PendingIntent createCancelSingleMissedCallPendingIntent( @@ -121,7 +121,7 @@ public class CallLogNotificationsService extends IntentService { Intent intent = new Intent(context, CallLogNotificationsService.class); intent.setAction(ACTION_CANCEL_SINGLE_MISSED_CALL); intent.setData(callUri); - return PendingIntent.getService(context, 0, intent, 0); + return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); } public static PendingIntent createLegacyVoicemailDismissedPendingIntent( @@ -129,7 +129,7 @@ public class CallLogNotificationsService extends IntentService { Intent intent = new Intent(context, CallLogNotificationsService.class); intent.setAction(ACTION_LEGACY_VOICEMAIL_DISMISSED); intent.putExtra(EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); - return PendingIntent.getService(context, 0, intent, 0); + return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); } @Override @@ -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/CallLogReceiver.java b/java/com/android/dialer/app/calllog/CallLogReceiver.java index 5d8d13039e711643e74b2cd8c8c7c2fceb93e3c0..e28a0819e26a32ea0a40ca0ec3222da40aeb5a0e 100644 --- a/java/com/android/dialer/app/calllog/CallLogReceiver.java +++ b/java/com/android/dialer/app/calllog/CallLogReceiver.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,6 +22,7 @@ import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.provider.VoicemailContract; + import com.android.dialer.common.LogUtil; import com.android.dialer.database.CallLogQueryHandler; diff --git a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java index faece65b6d0d970d7f48097d36455610ba200f1d..0b4e5dbb97995f312c2691ec699ef4d289e25069 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/DialerQuickContactBadge.java b/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java index ef61aac9d49e3469ce800e94c91f1ae3b6ef34f5..5a4dd0afeec0e85f6d1776af118fda1ea7fbaa84 100644 --- a/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java +++ b/java/com/android/dialer/app/calllog/DialerQuickContactBadge.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,6 +21,7 @@ import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.QuickContactBadge; + import com.android.dialer.app.calllog.CallLogAdapter.OnActionModeStateChangedListener; /** Allows us to click the contact badge for non multi select mode. */ diff --git a/java/com/android/dialer/app/calllog/GroupingListAdapter.java b/java/com/android/dialer/app/calllog/GroupingListAdapter.java index 29a4d4e4a321f8e35c0ee8ea9ea39fbcfdc6c086..01250abdf967fbcc547a79f21bac77f72ebcc407 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,11 @@ import android.database.ContentObserver; import android.database.Cursor; import android.database.DataSetObserver; import android.os.Handler; -import android.support.v7.widget.RecyclerView; +import android.os.Looper; 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 @@ -32,8 +35,8 @@ import android.util.SparseIntArray; */ abstract class GroupingListAdapter extends RecyclerView.Adapter { - protected ContentObserver changeObserver = - new ContentObserver(new Handler()) { + protected final ContentObserver changeObserver = + new ContentObserver(new Handler(Looper.getMainLooper())) { @Override public boolean deliverSelfNotifications() { return true; @@ -44,7 +47,7 @@ abstract class GroupingListAdapter extends RecyclerView.Adapter { onContentChanged(); } }; - protected DataSetObserver dataSetObserver = + protected final DataSetObserver dataSetObserver = new DataSetObserver() { @Override public void onChanged() { diff --git a/java/com/android/dialer/app/calllog/IntentProvider.java b/java/com/android/dialer/app/calllog/IntentProvider.java index f80e0d8692efc53b8e5d2ae1050ad182e9143acc..10d6a891ec0dcebe72c2f31e95a6ac623e43a06b 100644 --- a/java/com/android/dialer/app/calllog/IntentProvider.java +++ b/java/com/android/dialer/app/calllog/IntentProvider.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. @@ -23,6 +24,7 @@ import android.net.Uri; import android.provider.ContactsContract; import android.telecom.PhoneAccountHandle; import android.telephony.TelephonyManager; + import com.android.contacts.common.model.Contact; import com.android.contacts.common.model.ContactLoader; import com.android.dialer.app.AccountSelectionActivity; @@ -33,6 +35,7 @@ import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.precall.PreCall; import com.android.dialer.util.IntentUtil; + import java.util.ArrayList; /** diff --git a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java index dba69808b9110de22fbc7f2cc7b5d4638b173d33..301265d99a28c59e464250910d5ab1fa3cfde7a9 100644 --- a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java @@ -16,6 +16,7 @@ package com.android.dialer.app.calllog; +import android.annotation.SuppressLint; import android.app.Notification; import android.app.PendingIntent; import android.content.Context; @@ -96,6 +97,7 @@ public final class LegacyVoicemailNotifier { context .getResources() .getQuantityString(R.plurals.notification_voicemail_title, count, count); + @SuppressLint("MissingPermission") PersistableBundle config = pinnedTelephonyManager.getCarrierConfig(); boolean isOngoing; if (config == null) { @@ -174,7 +176,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/MissedCallNotificationReceiver.java b/java/com/android/dialer/app/calllog/MissedCallNotificationReceiver.java index 2ec1a533077524f82b8950968eb813cb5abce963..6bf9203e867cc6e18855a26596a8bcb722619d88 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 cc9c62ea54781996eb51c99e59970702cb2d9c30..987336d3e9c6d0a33770679df4742dc7fbd2a484 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. @@ -17,8 +18,8 @@ package com.android.dialer.app.calllog; import static com.android.dialer.app.DevicePolicyResources.NOTIFICATION_MISSED_WORK_CALL_TITLE; +import android.annotation.SuppressLint; import android.app.Notification; -import android.app.Notification.Builder; import android.app.PendingIntent; import android.app.admin.DevicePolicyManager; import android.content.ComponentName; @@ -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,10 +42,12 @@ 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.R; import com.android.dialer.app.MainComponent; -import com.android.dialer.app.R; import com.android.dialer.app.calllog.CallLogNotificationsQueryHelper.NewCall; import com.android.dialer.app.contactinfo.ContactPhotoLoader; import com.android.dialer.callintent.CallInitiationType; @@ -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; @@ -364,7 +366,7 @@ public class MissedCallNotifier implements Worker, Void> { } private Notification.Builder createNotificationBuilder() { - return new Notification.Builder(context) + return new Notification.Builder(context, NotificationChannelId.MISSED_CALL) .setGroup(MissedCallConstants.GROUP_KEY) .setSmallIcon(android.R.drawable.stat_notify_missed_call) .setColor(context.getResources().getColor(R.color.dialer_primary_color)) @@ -375,7 +377,7 @@ public class MissedCallNotifier implements Worker, Void> { } private Notification.Builder createNotificationBuilder(@NonNull NewCall call) { - Builder builder = + Notification.Builder builder = createNotificationBuilder() .setWhen(call.dateMs) .setDeleteIntent( @@ -430,7 +432,8 @@ public class MissedCallNotifier implements Worker, Void> { // TODO (a bug): scroll to call contentIntent.setData(callUri); - return PendingIntent.getActivity(context, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT); + return PendingIntent.getActivity(context, 0, contentIntent, + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); } private PendingIntent createCallBackPendingIntent(String number, @NonNull Uri callUri) { @@ -440,7 +443,8 @@ public class MissedCallNotifier implements Worker, Void> { intent.setData(callUri); // Use FLAG_UPDATE_CURRENT to make sure any previous pending intent is updated with the new // extra. - return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); + return PendingIntent.getService(context, 0, intent, + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); } private PendingIntent createSendSmsFromNotificationPendingIntent( @@ -451,7 +455,8 @@ public class MissedCallNotifier implements Worker, Void> { intent.setData(callUri); // Use FLAG_UPDATE_CURRENT to make sure any previous pending intent is updated with the new // extra. - return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); + return PendingIntent.getActivity(context, 0, intent, + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); } /** Configures a notification to emit the blinky notification light. */ @@ -461,6 +466,7 @@ public class MissedCallNotifier implements Worker, Void> { } /** Closes open system dialogs and the notification shade. */ + @SuppressLint("MissingPermission") private void closeSystemDialogs(Context context) { context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); } diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java index 0ecdf061f51903992ccdaf0b34711b91486f9303..4bd74fdfa6cd15aeeb2d6f0aa0aab171378a91e4 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,9 +22,8 @@ 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.telephony.TelephonyManager; import android.text.TextUtils; import android.text.format.DateUtils; import android.view.View; @@ -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; @@ -57,7 +58,7 @@ public class PhoneCallDetailsHelper { private final CachedNumberLookupService cachedNumberLookupService; /** List of items to be concatenated together for accessibility descriptions */ - private ArrayList descriptionItems = new ArrayList<>(); + private final ArrayList descriptionItems = new ArrayList<>(); /** * Creates a new instance of the helper. @@ -150,7 +151,8 @@ public class PhoneCallDetailsHelper { int color = callLogCache.getAccountColor(details.accountHandle); if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) { int defaultColor = R.color.dialer_secondary_text_color; - views.callAccountLabel.setTextColor(context.getResources().getColor(defaultColor)); + views.callAccountLabel.setTextColor(context.getResources().getColor(defaultColor, + context.getTheme())); } else { views.callAccountLabel.setTextColor(color); } @@ -179,7 +181,8 @@ public class PhoneCallDetailsHelper { return; } - if (PhoneNumberUtils.isEmergencyNumber(details.displayNumber)) { + TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class); + if (telephonyManager.isEmergencyNumber(details.displayNumber)) { views.nameView.setText(R.string.emergency_number); views.nameView.setTextDirection(View.TEXT_DIRECTION_INHERIT); return; @@ -198,24 +201,27 @@ public class PhoneCallDetailsHelper { * @return The call location and date string. */ public CharSequence getCallLocationAndDate(PhoneCallDetails details) { - descriptionItems.clear(); - - if (details.callTypes[0] != Calls.VOICEMAIL_TYPE) { - // Get type of call (ie mobile, home, etc) if known, or the caller's location. - CharSequence callTypeOrLocation = getCallTypeOrLocation(details); - - // Only add the call type or location if its not empty. It will be empty for unknown - // callers. - if (!TextUtils.isEmpty(callTypeOrLocation)) { - descriptionItems.add(callTypeOrLocation); + synchronized (this) { + descriptionItems.clear(); + + if (details.callTypes[0] != Calls.VOICEMAIL_TYPE) { + // Get type of call (ie mobile, home, etc) if known, or the caller's location. + CharSequence callTypeOrLocation = getCallTypeOrLocation(details); + + // Only add the call type or location if its not empty. It will be empty for unknown + // callers. + if (!TextUtils.isEmpty(callTypeOrLocation)) { + descriptionItems.add(callTypeOrLocation); + } } - } - // The date of this call - descriptionItems.add(getCallDate(details)); + // The date of this call + descriptionItems.add(getCallDate(details)); + + // Create a comma separated list from the call type or location, and call date. - // Create a comma separated list from the call type or location, and call date. - return DialerUtils.join(descriptionItems); + return DialerUtils.join(descriptionItems); + } } /** diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java index 8ba34938d57dc92ac8f3a76754b4af859604b4e2..88d05fb6265d188005f50edc98688efdd3235e55 100644 --- a/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java +++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.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. @@ -18,6 +19,7 @@ package com.android.dialer.app.calllog; import android.view.View; import android.widget.TextView; + import com.android.dialer.app.R; import com.android.dialer.calllogutils.CallTypeIconsView; import com.android.dialer.widget.BidiTextView; diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index 1a21b79b49f59ea3b64ada5b8c0fd00009c463be..e5927fe16f3daf7cb60d6be42d891a193c706a54 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-2024 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,11 @@ import android.provider.VoicemailContract; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import com.android.dialer.app.R; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; + +import com.android.dialer.R; import com.android.dialer.app.voicemail.VoicemailAudioManager; import com.android.dialer.app.voicemail.VoicemailErrorManager; import com.android.dialer.app.voicemail.VoicemailPlaybackPresenter; @@ -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 { @@ -60,9 +66,9 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { } @Override - public void onActivityCreated(Bundle savedInstanceState) { - voicemailPlaybackPresenter = - VoicemailPlaybackPresenter.getInstance(getActivity(), savedInstanceState); + public void onCreate(Bundle savedInstanceState) { + voicemailPlaybackPresenter = VoicemailPlaybackPresenter.getInstance( + (AppCompatActivity) getActivity(), savedInstanceState); if (PermissionsUtil.hasReadVoicemailPermissions(getContext()) && PermissionsUtil.hasAddVoicemailPermissions(getContext())) { getActivity() @@ -71,16 +77,21 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { VoicemailContract.Status.CONTENT_URI, true, voicemailStatusObserver); } else { LogUtil.w( - "VisualVoicemailCallLogFragment.onActivityCreated", + "VisualVoicemailCallLogFragment.onCreate", "read voicemail permission unavailable."); } - super.onActivityCreated(savedInstanceState); + super.onCreate(savedInstanceState); + } + + @Override + public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); preSyncVoicemailStatusCheckExecutor = DialerExecutorComponent.get(getContext()) .dialerExecutorFactory() .createUiTaskBuilder( - getActivity().getFragmentManager(), + getActivity().getSupportFragmentManager(), "fetchVoicemailStatus", new VoicemailStatusWorker()) .onSuccess(this::onPreSyncVoicemailStatusChecked) @@ -99,7 +110,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { voicemailErrorManager.getContentObserver()); } else { LogUtil.w( - "VisualVoicemailCallLogFragment.onActivityCreated", + "VisualVoicemailCallLogFragment.onViewCreated", "read voicemail permission unavailable."); } } @@ -147,7 +158,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); @@ -204,7 +215,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/calllog/VisualVoicemailNotifier.java b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java index dd3ce34c742388baa2cae123530b3b97edcf85e7..5ddbf4f75be7c8174bb5e12fc81afe18b973e572 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; @@ -89,11 +91,11 @@ final class VisualVoicemailNotifier { if (shouldAlert) { groupSummary.setOnlyAlertOnce(false); // Group summary will alert when posted/updated - groupSummary.setGroupAlertBehavior(Notification.GROUP_ALERT_ALL); + groupSummary.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL); } else { // Only children will alert. but since all children are set to "only alert summary" it is // effectively silenced. - groupSummary.setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN); + groupSummary.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN); } PhoneAccountHandle handle = getAccountForCall(context, newCalls.get(0)); groupSummary.setChannelId(NotificationChannelManager.getVoicemailChannelId(context, handle)); @@ -169,7 +171,7 @@ final class VisualVoicemailNotifier { } builder.setChannelId(NotificationChannelManager.getVoicemailChannelId(context, handle)); - builder.setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY); + builder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY); ContactPhotoLoader loader = new ContactPhotoLoader(context, contactInfo); Bitmap photoIcon = loader.loadPhotoIcon(); @@ -223,7 +225,8 @@ final class VisualVoicemailNotifier { if (voicemail != null) { intent.setData(voicemail.voicemailUri); } - return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); + return PendingIntent.getActivity(context, 0, intent, + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); } /** diff --git a/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java b/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java index 754ab2727aa0a72329079da59950e79cbf687c05..4801f962125c55b6669a9e235c3cd754ae995354 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. @@ -23,6 +24,7 @@ import android.app.job.JobService; import android.content.ComponentName; import android.content.Context; import android.provider.VoicemailContract; + import com.android.dialer.common.LogUtil; import com.android.dialer.constants.ScheduledJobIds; @@ -52,11 +54,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 cad838a553e0a6933ec8d95c57145878ad17057d..c2729bc423d1b6820eef67e4f35919db2e5714a6 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/calllog/calllogcache/CallLogCache.java b/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java index ca759af06f20c2a9dc11233233b48dd4202c6c09..8e2b4c6d79fd6c22cf3d3e39847ef29b26bd1fc1 100644 --- a/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java +++ b/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.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,9 @@ import com.android.dialer.app.calllog.CallLogAdapter; import com.android.dialer.calllogutils.PhoneAccountUtils; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.CallUtil; + import java.util.Map; + import javax.annotation.concurrent.ThreadSafe; /** @@ -104,7 +107,7 @@ public class CallLogCache { if (phoneAccountColorCache.containsKey(accountHandle)) { return phoneAccountColorCache.get(accountHandle); } else { - Integer color = PhoneAccountUtils.getAccountColor(context, accountHandle); + int color = PhoneAccountUtils.getAccountColor(context, accountHandle); phoneAccountColorCache.put(accountHandle, color); return color; } @@ -121,7 +124,7 @@ public class CallLogCache { if (phoneAccountCallWithNoteCache.containsKey(accountHandle)) { return phoneAccountCallWithNoteCache.get(accountHandle); } else { - Boolean supportsCallWithNote = + boolean supportsCallWithNote = PhoneAccountUtils.getAccountSupportsCallSubject(context, accountHandle); phoneAccountCallWithNoteCache.put(accountHandle, supportsCallWithNote); return supportsCallWithNote; diff --git a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java index 702bacb5097cca1d02fd22ee1ae648b6e1c2a62d..f53bd5e801b4a1b7c131af7967b5574e086a24e4 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; @@ -29,6 +31,7 @@ import com.android.dialer.oem.CequintCallerIdManager; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.phonenumbercache.ContactInfoHelper; import com.android.dialer.util.ExpirableCache; + import java.lang.ref.WeakReference; import java.util.Objects; import java.util.concurrent.BlockingQueue; @@ -66,6 +69,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/contactinfo/ContactInfoRequest.java b/java/com/android/dialer/app/contactinfo/ContactInfoRequest.java index 256c9c06c4345965277c5ca90a6793c34ef627f0..f575e87065bd39bbcbf097cc2e9fca6325cd307f 100644 --- a/java/com/android/dialer/app/contactinfo/ContactInfoRequest.java +++ b/java/com/android/dialer/app/contactinfo/ContactInfoRequest.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. @@ -21,6 +22,7 @@ import android.text.TextUtils; import androidx.annotation.IntDef; import com.android.dialer.phonenumbercache.ContactInfo; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; diff --git a/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java b/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java index 68e42b261b50e42ad54c511e20a403714c16e3e6..82cdb7308e079fd803addd9e4479a70285bf8ea4 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 72b68ffd6d0078f1df0be3077fdd0a3da5d43cc6..dc059d8b1d760d79c349bcecc7934cd0d89262bf 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,10 @@ 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.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.util.ExpirableCache; @@ -36,16 +36,11 @@ public class ExpirableCacheHeadlessFragment extends Fragment { private static final String FRAGMENT_TAG = "ExpirableCacheHeadlessFragment"; private static final int CONTACT_INFO_CACHE_SIZE = 100; - private ExpirableCache retainedCache = + private final ExpirableCache retainedCache = ExpirableCache.create(CONTACT_INFO_CACHE_SIZE); @NonNull - public static ExpirableCacheHeadlessFragment attach(@NonNull AppCompatActivity parentActivity) { - return attach(parentActivity.getSupportFragmentManager()); - } - - @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 bb547351108d991194e95b1e032b12c1f02f0038..1420ead285668f6b19d346d1d6f3447d8ff3f657 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,10 @@ import android.view.accessibility.AccessibilityEvent; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; -import com.android.dialer.app.R; + +import androidx.core.content.res.ResourcesCompat; + +import com.android.dialer.R; public class RemoveView extends FrameLayout { @@ -49,12 +53,13 @@ public class RemoveView extends FrameLayout { @Override protected void onFinishInflate() { - removeText = (TextView) findViewById(R.id.remove_view_text); - removeIcon = (ImageView) findViewById(R.id.remove_view_icon); + super.onFinishInflate(); + removeText = findViewById(R.id.remove_view_text); + removeIcon = findViewById(R.id.remove_view_icon); final Resources r = getResources(); - unhighlightedColor = r.getColor(android.R.color.white); - highlightedColor = r.getColor(R.color.remove_highlighted_text_color); - removeDrawable = r.getDrawable(R.drawable.quantum_ic_clear_vd_theme_24, + unhighlightedColor = r.getColor(android.R.color.white, getContext().getTheme()); + highlightedColor = r.getColor(R.color.remove_highlighted_text_color, getContext().getTheme()); + removeDrawable = ResourcesCompat.getDrawable(r, R.drawable.quantum_ic_clear_vd_theme_24, getContext().getTheme()); } diff --git a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_shadow.xml b/java/com/android/dialer/app/res/color/switch_thumb_color.xml similarity index 54% rename from java/com/android/dialer/main/impl/toolbar/res/drawable/search_shadow.xml rename to java/com/android/dialer/app/res/color/switch_thumb_color.xml index 583ad20d579d19942bb3600d95b714d71a4153bb..6391563b004980df0421eaa5b00c26cb1680e4ef 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_shadow.xml +++ b/java/com/android/dialer/app/res/color/switch_thumb_color.xml @@ -1,5 +1,6 @@ - - - - - \ No newline at end of file + + + + + + + + diff --git a/java/com/android/dialer/app/res/color/switch_track_color.xml b/java/com/android/dialer/app/res/color/switch_track_color.xml new file mode 100644 index 0000000000000000000000000000000000000000..9a645d908f0d1e6a841966715083c5a27de39bf2 --- /dev/null +++ b/java/com/android/dialer/app/res/color/switch_track_color.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/java/com/android/dialer/app/res/drawable/popup_background.xml b/java/com/android/dialer/app/res/drawable/popup_background.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe5e4656aa5c85a221fe49260e6d7333981b0fe9 --- /dev/null +++ b/java/com/android/dialer/app/res/drawable/popup_background.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/java/com/android/voicemail/impl/configui/AndroidManifest.xml b/java/com/android/dialer/app/res/drawable/switch_thumb.xml similarity index 57% rename from java/com/android/voicemail/impl/configui/AndroidManifest.xml rename to java/com/android/dialer/app/res/drawable/switch_thumb.xml index 95796f978e44a6be5f4c89081ff22d3ca1b6eab0..4ff649cd91d3cd793664a405c98d3f9f1eb70461 100644 --- a/java/com/android/voicemail/impl/configui/AndroidManifest.xml +++ b/java/com/android/dialer/app/res/drawable/switch_thumb.xml @@ -1,5 +1,6 @@ - - - - - - - - - + + + + + + + + diff --git a/java/com/android/dialer/contacts/resources/res/drawable/dialog_background_material.xml b/java/com/android/dialer/app/res/drawable/switch_track.xml similarity index 66% rename from java/com/android/dialer/contacts/resources/res/drawable/dialog_background_material.xml rename to java/com/android/dialer/app/res/drawable/switch_track.xml index c93d43ea6a68e13af2ef7bdc2d5c4cb67f3e76ca..f54a350a6bc6efd64c8c2827360ab8d6aeffcc80 100644 --- a/java/com/android/dialer/contacts/resources/res/drawable/dialog_background_material.xml +++ b/java/com/android/dialer/app/res/drawable/switch_track.xml @@ -1,5 +1,6 @@ - + - - - - - - + + + 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 0000000000000000000000000000000000000000..e53ce2122847e9cdfe032a6dce7210c7004f25ac --- /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/res/layout/call_log_activity.xml b/java/com/android/dialer/app/res/layout/call_log_activity.xml index f42fe56e72883dc4c79f03bf3d33b914ca0f51f7..cbbec105c39eb8a5104d31e37f551a6445fba925 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 4f10d111c8704840b6fbd45c2d075eff8372286d..92c0544a5e1f36823348ea5992879cc4c13a22c1 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 @@ - \ No newline at end of file + + 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 e78b72e3c975cab0bac738e712450ed648819976..abe869b2bb9a4fad13f223f8a2252d06fe77c18e 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 36e3a16f026245de91bbdd6325b522dcc720ca10..f87e01ac9e33d4184997ba7bcf45a7f539b85661 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 f21d8ffea80242a6b98cbb677e7e6a266701125d..01b58aa0d7b32ef5c5844e1a24a374a3a8d2e119 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 072b2424cf1317143c9dfcd9b2ee930fe9240685..6bc1249f5b82f63e41f6b4691489d5f080fc570a 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 ea51441e05aa97c89f6706a74a76e728b31652dc..dbfe2a51f3128a128d52a5fb0f166b4204737f42 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 6fab3a2e9a9f5811cfc1be72af9732ed2d35f395..f51b5d03a410471564592bfc295c3c6148bbfc39 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 2ece35b4c8c47c37878216073400379fa95effc7..16faf48a62704faad24e50b43527839921458601 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 56211c1c9208c1973c08d56fb8b4bd7c650929ee..717b729ade798f6a22fb193d33050d82d3de4fc1 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 b188a58b642b6fb52f94a16e3def57d00e91d56a..42be05892d974e4c96157514561719d564e55223 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 c1aaafd10e0cea40ef671c1c22b55390665cc404..daf71cfec06bf7e10d36df177c8880bbdadbeb18 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 31f95c20b27ca770d914099fd4f31aebfa9f84c5..0d4d73651cbf24efcd7c5fa6887a27bc7fe35271 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 66547f00e67ca8eec4c0b1e519f310bbce94c958..94d0b744302a5e9d4ab25451385212369431f3af 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 88f10b03e51326e538f09379b003e252e901744a..a18205c7f930bed41ece6b108d3e13de2cd94725 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 6d39b1e2c534ec4ed31596b372c2966940127123..112d5666d49491e9b7980456beaf65bb7c5baab7 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 3bc900b0bbbf65df887b7aafe17975bc963fae04..c8fb3d898f78118b1422648f63c95ff38bfd1074 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 17e4c9dbf4de5a24beab59ed685729d5b5899f27..3825948772deca66d289bef978858ef7fb0dde99 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 17e4c9dbf4de5a24beab59ed685729d5b5899f27..3825948772deca66d289bef978858ef7fb0dde99 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 17e4c9dbf4de5a24beab59ed685729d5b5899f27..3825948772deca66d289bef978858ef7fb0dde99 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 d42d667b4c12b61db56f5de64f913ffb5db82d2f..c6fafe08a381797a0d7144c69e9dc31b9394e240 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 fb7ce7fc364144f030a2f62da3973fdd38fc23a5..e9a1b40f9d88d7137c04e17cabf7d71405230a81 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 bb5f9365150e85a2a7ca9dcaa690f347948cc4a8..a0a3a9b5b6dd71059dd74ee75f85520e09f172d1 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 54368b39ceca085ecbcabf46c689e9af7741450a..3cb6ca29f6ac7fdbdc6b71c1dd33991006c9233c 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 f4c5b0b1ba9222c1dbe771b4038f4cbad0468984..cdfe73718ae7ccfb72f7855443129d4be3b4abea 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 812697d373225a6774f97e0deb42d53ff46629d5..7a350363d68dd6c76cc406b87495efbed84beb6d 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 42292a9a1a7684d08b9fb79e448b8af6cd26f4bd..975ba8ee0ded0766898a005b83d484c9f1f4e8b5 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 6d5cfad6adb31b7cc80fdcb48c6720b17cdaa78b..68e6583077ec4c84a345eb360d580909dd942d09 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 d0a63e15772520d4646d44991fc48b479631e3d0..03456287f2dabb1bbdf77010ad74fe55801bbba4 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 68b0e84104a68b901b0dbfd7fbe5ca58a8ac41da..7d3435c14b84dd41ab7f67fd0bb98a328225e25d 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 2db69adb6095c6eca0debb3db401188342999da2..28c9c615ffa7cf1ca139b9279585b48ababfbd53 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 9afe3808f08779e8d267193d7f94803e5f6ca816..7ffbf3fef7461ba0c633e0b00c4ea1cf95924926 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 17b238dbd661a89cb2aafccd801e1659a34f9da7..0babfbfc4fe99271a76a01e79394aa72903eafa1 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 4c5baedde8cae54951a1dc05a7d14b7f12dd0898..14f7ec249a36ec9d93301e42091a65a2f2270be3 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 06b50dfb4da2d3681653d7eb37aeccb7b7564332..0d43c63e745676ca5d9e44ea1c5afbcb332e9a13 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 ff2892a34d33a09fa8dc204330b58ba5942dc478..055337e0eb09a3209abc342c6e907bdf46d3c263 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 67b90ed0a3b85c4971370304934b16f3a5ff3ba6..9d97fcd2f98c341ddd71122b78d7fb5078ccd026 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 543a1e3a9421615ca130a6a5ffd38ffce0b9bea8..194ba7f9c8700cad47088f085c6e822cfab12979 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 164485d3d5ac5e239034b33a3f3b300ad2448f0b..0959be90b8f2efb8628a670257df75ce5c9c70b5 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 6f4d08c29c18589149f48a43e8ed2c8e35d18226..4912b514746241bf37b1614684417fbd5944737e 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 ffb48e7500f4ec25e81706e4029d999b88e9759e..da8c236585ee809db5c1bb0b1d78f2718309b65d 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 52b5d96f548e208da2e70dcc2a7a9b960cbf29e9..904245cf3e2c5041bc7bbf8b96b6704267d09c55 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 43bdb38129051b6fed6e7c5036eec5b6bb6bd145..f833e070bab53c87f1ca8f413308aef9c95aae33 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/cm_strings.xml b/java/com/android/dialer/app/res/values-ko/cm_strings.xml index a219b1f975e8750f18409326a91109ea2b6f4fe2..63d5234db0be215aa3e865a2e0d222e31f7ea4ae 100644 --- a/java/com/android/dialer/app/res/values-ko/cm_strings.xml +++ b/java/com/android/dialer/app/res/values-ko/cm_strings.xml @@ -32,5 +32,6 @@ 다음 앱으로 통화\u2026 통계 헬프라인 + 앱을 사용하려면 먼저 이 앱을 기본 전화 앱으로 설정해야 합니다. 기본값으로 설정 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 155867107305414178457c7b666c537204852541..156077040d1a0dca3584f48d946fdda8c30c4f3e 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 160ef3946a6fce107683913d826430f685c4dc30..22b4e33d51b06b98456f52923f7a00062035e04a 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 36df91acf7e188711ab4b3cc8889ad3a6c5e87dc..f2c8cf8eb61a9514def57e341f82cfb5290bdf49 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 f73f793836e8d9a024b75f3995e6c14bb0e0bd22..0078d6f2bebe29993d5f1fdc9f5d4b5432e0648d 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 aca914032cee6f8af369a308334d6f179a5abec7..9d70b1d66bce46fcadfbc965b61726771ca1d205 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 4427fe5210579425f762491abd1fb230fbe91db7..1083336c49cd6f835f938ff953cedd4391d5dc81 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 9dcc02b6dc0594f5168ea57aecd2174a94b7cbea..1027b38b09105c52113bda1b18effcff67dcb942 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 0237e1d37cb328d08fa334b03849a6a0d00a2a92..54266d46667807983c7c1e714a74f2cbdc4bbace 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 322f2537b29e1fd89a538aa0470e6970c789117c..517c2c05422eb1aca5719ebf46ff38304503d6fe 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 39dfdbef9c1910e56cf8aaac1053ceacfdb5bdae..675766a401ccb707a9dadbdfce3abefbe8542310 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 5c758e3b1c1fa818c3b7c49ee2969c51fa31a6c0..35d711d7cab3ab3f548e2f332aed6ea058258e87 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 6c49eb3534b724dcbea16d0c854349f66d3d5a23..2ff357928b953a7306e53e2f5715085937926419 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 edd94c64f88720a339151e3e992a4836c2b9c9ca..54587ffee9a962de4d5d76c26bea3e8302b3a228 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 c975fc179afd4fc44d84ffdafa13cd2e1ca72a49..e0e88c088ac05818bf52e449acf1d1972025ca12 100644 --- a/java/com/android/dialer/app/res/values-night/colors.xml +++ b/java/com/android/dialer/app/res/values-night/colors.xml @@ -17,13 +17,4 @@ @*android:color/system_neutral1_300 @*android:color/system_accent2_700 - - @*android:color/background_device_default_dark - @color/e_action_bar - @*android:color/surface_header_dark - #deffffff - #99ffffff - @*android:color/accent_device_default_dark - @*android:color/background_floating_device_default_dark - #1FFFFFFF 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 4726a5eb9a18244a1de5d2d60c526aceaa199da1..f91e2b8c46c4692178d6104404f6224b005cd136 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 6c49eb3534b724dcbea16d0c854349f66d3d5a23..2ff357928b953a7306e53e2f5715085937926419 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 4dbd5464b9df016ec3626108f5be3de6991fc638..8f25fd0ae8925da0c768f0dfb0dd4e11a19e08c6 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 d2f334dfa3c055f8718f6d0b1ad94fe357afbaa1..57bca616ad0c7c2c6a574fa9fd62c7ab45a0b4f0 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 e8564873eed66de77f7bb07c08605a437f70c419..e376e8924728c0bc08a266b4a639fdccf9ac5915 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 9f6b93b195a1fc71bc3556808c7e07bee214b668..4d1c62f28061af4adf37ae795be124a65ce93b2d 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 e8564873eed66de77f7bb07c08605a437f70c419..e376e8924728c0bc08a266b4a639fdccf9ac5915 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 2ffc4e233ab3fd40933c51ed72f2b32856dfb385..c2ad8d336b8fda4c93a761dd3fdeec9b57c5b6a9 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 0d8cb5074de97f184ad925831ea607835a8c1eb1..1810b5d013558240fa46c08dc2831b7c7d86363b 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 2cacb180d6ef892d861ced45570594cfa720d9aa..e55936e94b929060b69ebee9c9b2e592380e33bd 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 bdacbb7bdd00df70c8200770eef868b812651ffb..3e38b7b830eb5a7488402776329c698ca15cb4dd 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 0d64625ea8a92833af47c1ed9906f051fd3eb8f0..95fde9cfe46c0b8103ce889e769ca538bb0c3a19 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 c20d8d1e22776d410d5ff9a50e3995904aab65d6..bfcd7ff9d8665558be1fce771f6182413293c0c4 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 929ad38f4739f4ae4fe54d0b8832f0e9a4fce0c8..70206306d69fd6181e9cb026765a46dd1c6caaa5 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 5c68dad14089cdf698c48b140307c20b169871ff..6033b81b61226acf490b26cd2233b16774a62736 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 eaef3526dbd33459cb3cb2b13f997200ba8893a2..c3eeaa5f9497f07225f1c678b427342948039577 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 9dbc55c7b1615eefd6fc75d3b0e4940d820f01c1..78f4e30561accb5434a9ffdf16c803cce74c1ebc 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 3207a694efc50b99c3e2e29acae7745691d5e296..dbef1863f510e6be3fc241e2de62cbb7565b1315 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 305cbc1d6e754405efa418d8acdb971307f432d0..372e4f99e8970f2a90a67a5bc7835a272aad1c42 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 980ff9b81ebc9d16f2af7c199a92d303b7b81122..15d36968948fb71e2b0c918a10112d0a8010d761 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 91c2d57ec98b4412f705c3c0645d8eaf5299d0fc..e29896f5623c9a75c1068e1a0f20ebf39c8cc7d8 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 584b4405f440e23e55cd208beafa87182f589768..59da296e0c9a79647630c7f041e783f0bc4f8f50 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 107e8e693a9ec2dca1009b8775fceb2eb671fcf2..badc2a625c3a400117f14b59d557a6e79e4f0a2a 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 9f5ae9cedfcbf4301c7c67fc6b8eed01483e88a5..5d97bf72bd619f4a12bea8b2d174fe8a51d52224 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 d663d7a9af83b286f841f05c0e3f8b0e21707b19..3c06b3fbd86ef4f38b1032c037d05c71d80b5f42 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 3be628e1c319381706bcc89b506df06843c59a81..043af95f673920aa890586f549ca18b5091f5e7a 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 a46298144c1d7f1203c65c85cc563c8dc3f22278..27d8037dc58183586e89ea8292eed1556d646c7a 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 f682d66dc59051aa827f7628006d87824a476c33..a95a50cc242715ea0eb07912aa6a12415fe93738 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 2b57e7521576b23ba834d277e88ec387dfa5aac4..9d4e26f1c6433e2595e5764fbf907117cc7a03eb 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 d356781b29207d09b226e58711ab7a06ba4eef70..5990dc9a1991247e561f82a9b9ee1b91281c4c9d 100644 --- a/java/com/android/dialer/app/res/values/colors.xml +++ b/java/com/android/dialer/app/res/values/colors.xml @@ -16,7 +16,6 @@ #80000000 - ?colorIcon #8a000000 @@ -27,12 +26,18 @@ @*android:color/system_accent2_200 @color/e_background - @*android:color/background_device_default_light - #FAFAFA - @*android:color/surface_header_light - #de000000 - #99000000 - @*android:color/accent_device_default_light - @*android:color/background_floating_device_default_light - #14212121 + + @android:color/system_accent3_100 + + + @android:color/black + + + @color/dialer_background_color + + + @color/dialer_theme_color + + + @android:color/system_neutral2_500 diff --git a/java/com/android/dialer/app/res/values/dimens.xml b/java/com/android/dialer/app/res/values/dimens.xml index fb68e684e2b0fab1199e6efb757b6735f2869aae..22730fd49b642ed596e4c8dc3bee4dad24269d8c 100644 --- a/java/com/android/dialer/app/res/values/dimens.xml +++ b/java/com/android/dialer/app/res/values/dimens.xml @@ -37,4 +37,6 @@ 48dp 12dp + + 48dp diff --git a/java/com/android/dialer/app/res/values/strings.xml b/java/com/android/dialer/app/res/values/strings.xml index e8f52779679fd91ca2274350f5cec1a3c80736f8..7800d41c5d81171f5e8c5c752a0dd1622789d01e 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 154c8f43ca4deb984dca55d8c900647ce4a85c26..7e73dc0c9274470bb019afc89384cd068bb32cb9 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 - - - - - - - - - @@ -53,4 +56,22 @@ true true + + + + + + diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml index 2b5f04af564d85786630df2cf3a7b71f22569a4f..736a05b2565755d85d0cbf4f6ee297901b6ed240 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml @@ -25,8 +25,8 @@ 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 18f6db3310be312b179b39ea74ee828fc7f01662..1309cd0905b290e1a2ec9dfe326d35dc2e01a36b 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 @@ -52,7 +52,7 @@ @color/dialer_primary_text_color - @color/dialer_secondary_text_color + @color/e_secondary_text_color @color/google_grey_300 @color/google_grey_400 @color/google_grey_600 @@ -69,11 +69,10 @@ ?android:attr/colorAccent - @color/google_grey_700 + @color/e_secondary_text_color @color/google_grey_400 @*android:color/system_neutral1_0 @*android:color/system_neutral1_0 - @color/dialer_theme_color_20pct @*android:color/system_accent1_600 @@ -94,4 +93,10 @@ ?android:attr/colorPrimary + + diff --git a/java/com/android/dialer/theme/common/AndroidManifest.xml b/java/com/android/dialer/theme/common/AndroidManifest.xml deleted file mode 100644 index 51e532e2a39f065b9f80f06e88ff34e0ab7ff1b2..0000000000000000000000000000000000000000 --- a/java/com/android/dialer/theme/common/AndroidManifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - 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 4c2edb48a1f0f955659518a7e87e4c65586b5834..f1c4051be6c13ba500b6899b07ec3d47c243e7ec 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/AndroidManifest.xml b/java/com/android/dialer/theme/hidden/AndroidManifest.xml deleted file mode 100644 index ec46a3a9584c0975a8ee79ae7fd03eebb10f0361..0000000000000000000000000000000000000000 --- a/java/com/android/dialer/theme/hidden/AndroidManifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - 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 e48474e9f3e4a589d7c9f36fac2e51cdd21ee46c..41c5fd1c56e0c4e70fe29923a48b4e6f3f3aa559 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 8fb90dbcb9ece9fdc87bcda504eee82ace004136..c2d2652b8c5addd27d215dfd2c3225c652b735b9 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,11 +19,10 @@ #332A56C6 @color/dialer_background_color @color/e_action_bar - @android:color/system_accent3_400 #1f000000 @color/e_background @color/e_floating_background - @color/e_background_variant + @color/e_floating_background_variant @color/e_action_bar @android:color/system_neutral1_900 @color/e_accent 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 c909281a4a2fbf1344795585d0fc3ee769e8bfc4..e9c127e432de51e96c9053c7bbfac7864e418460 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 bbed6d1e91e3f3c640620d381e334c66c5c91113..af8f90e969321b6ebba483a1021cacf526c68bf8 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/util/AndroidManifest.xml b/java/com/android/dialer/util/AndroidManifest.xml deleted file mode 100644 index ba22c178140da04391161f05cc7e1facb628bfdc..0000000000000000000000000000000000000000 --- a/java/com/android/dialer/util/AndroidManifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - diff --git a/java/com/android/dialer/util/CallUtil.java b/java/com/android/dialer/util/CallUtil.java index dd509aaaea0ab7ce88dee3256f608c2cd4c78058..3c46170490752b77eec9f5eef74d650f66da8b2d 100644 --- a/java/com/android/dialer/util/CallUtil.java +++ b/java/com/android/dialer/util/CallUtil.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. @@ -96,6 +97,7 @@ public class CallUtil { /** * Returns a list of phone accounts that are able to call to numbers with the supplied scheme */ + @SuppressLint("MissingPermission") public static List getCallCapablePhoneAccounts(Context context, String scheme) { if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE)) { return null; diff --git a/java/com/android/dialer/util/DialerUtils.java b/java/com/android/dialer/util/DialerUtils.java index 13c4929594c90266cfdf22c36c34f51ed4943bdd..0b9b8e549fb2bfd62f4021f1484b23d7b360d4f8 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. @@ -19,8 +20,6 @@ import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.res.TypedArray; import android.graphics.Point; @@ -39,6 +38,7 @@ import androidx.annotation.ColorInt; import com.android.dialer.R; import com.android.dialer.common.LogUtil; import com.android.dialer.telecom.TelecomUtil; + import java.util.Iterator; /** General purpose utility methods for the Dialer. */ @@ -80,7 +80,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(); } @@ -95,13 +96,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 { @@ -133,11 +128,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/DrawableConverter.java b/java/com/android/dialer/util/DrawableConverter.java index 03c9b67ffbbc277357cefd5b5255a9767d22c830..22fe22c8bb59a0055daf4d56f6cb1a0d79bd96b9 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/EmergencyCallUtil.java b/java/com/android/dialer/util/EmergencyCallUtil.java index cbcddee2f7510f402bbd5a9706462b200058032e..ed0b18ad502eb36fb3f01da7851f338c2f4d75d9 100644 --- a/java/com/android/dialer/util/EmergencyCallUtil.java +++ b/java/com/android/dialer/util/EmergencyCallUtil.java @@ -56,7 +56,7 @@ public class EmergencyCallUtil { return false; } - Long lastEmergencyCallTime = getLastEmergencyCallTimeMillis(context); + long lastEmergencyCallTime = getLastEmergencyCallTimeMillis(context); if (lastEmergencyCallTime == 0) { return false; } diff --git a/java/com/android/dialer/util/ExpirableCache.java b/java/com/android/dialer/util/ExpirableCache.java index a1b0afd7494d9918a9a224c3cbedf356db62a3fd..2e6de2d77a12b22fe9c8ae16567bb126380749a7 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. @@ -17,7 +18,9 @@ package com.android.dialer.util; import android.util.LruCache; + import java.util.concurrent.atomic.AtomicInteger; + import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.ThreadSafe; @@ -100,7 +103,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; @@ -119,7 +122,7 @@ public class ExpirableCache { * @throws IllegalArgumentException if the cache is not empty */ public static ExpirableCache create(LruCache> cache) { - return new ExpirableCache(cache); + return new ExpirableCache<>(cache); } /** @@ -130,7 +133,7 @@ public class ExpirableCache { * @return the newly created expirable cache */ public static ExpirableCache create(int maxSize) { - return create(new LruCache>(maxSize)); + return create(new LruCache<>(maxSize)); } /** @@ -210,7 +213,7 @@ public class ExpirableCache { *

Implementation of {@link LruCache#create(K)} can use this method to create a new entry. */ public CachedValue newCachedValue(V value) { - return new GenerationalCachedValue(value, generation); + return new GenerationalCachedValue<>(value, generation); } /** diff --git a/java/com/android/dialer/util/PermissionsUtil.java b/java/com/android/dialer/util/PermissionsUtil.java index 76bc5b1758c6c1de7126f05854ece015e7beb5a5..3844380b699ad114d13d73f4432c9564bd52a4c9 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; @@ -88,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); } @@ -226,7 +232,7 @@ public class PermissionsUtil { permissionsCurrentlyDenied.add(permission); } } - return permissionsCurrentlyDenied.toArray(new String[permissionsCurrentlyDenied.size()]); + return permissionsCurrentlyDenied.toArray(new String[0]); } /** diff --git a/java/com/android/dialer/util/SettingsUtil.java b/java/com/android/dialer/util/SettingsUtil.java index 5043c3d562be694073bcf29f16ca4e67a889facc..ceaa0f092ae04816a8c371b043c15e74f5c74112 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/TouchPointManager.java b/java/com/android/dialer/util/TouchPointManager.java index ad5b007761fc6f820e8eddb4710bf61c601a849e..625558d3037b86b22a39dac0484c2820fbbf4bc1 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/util/TransactionSafeActivity.java b/java/com/android/dialer/util/TransactionSafeActivity.java index aa472493b6a2a91a713b99509bd348cbb4a780de..9ea1a9b75bb30cf1614ccbde7907c8df844527f1 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/util/UriUtils.java b/java/com/android/dialer/util/UriUtils.java index c4308a83545c5378530a19ef30b551506ea066a1..b1a02f775924d34418f86e47748c1a6b6f12a513 100644 --- a/java/com/android/dialer/util/UriUtils.java +++ b/java/com/android/dialer/util/UriUtils.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. @@ -18,6 +19,7 @@ package com.android.dialer.util; import android.net.Uri; import android.provider.ContactsContract; + import java.util.List; /** Utility methods for dealing with URIs. */ diff --git a/java/com/android/dialer/voicemail/listui/AndroidManifest.xml b/java/com/android/dialer/voicemail/listui/AndroidManifest.xml deleted file mode 100644 index ae807bb628efd1ed251d4d7bcf4a6b81476302bb..0000000000000000000000000000000000000000 --- a/java/com/android/dialer/voicemail/listui/AndroidManifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - \ No newline at end of file diff --git a/java/com/android/dialer/voicemail/listui/error/AndroidManifest.xml b/java/com/android/dialer/voicemail/listui/error/AndroidManifest.xml deleted file mode 100644 index 07cb77f584b2a284b4acfaa322601ed607def3d3..0000000000000000000000000000000000000000 --- a/java/com/android/dialer/voicemail/listui/error/AndroidManifest.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - diff --git a/java/com/android/dialer/voicemail/listui/error/OmtpVoicemailMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/OmtpVoicemailMessageCreator.java index 03ec86a094e85425f5a4f1d0c1c73b29aee065fe..edeb5f69b8a42c067a2ec95788deac5f0f77f3dc 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/VoicemailErrorAlert.java b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorAlert.java index 7e0ad37be8a6ab8d353b4ece676aad0b4e6d0700..98b5690594793447390b3521ef646526fa2bb120 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailErrorAlert.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorAlert.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,12 @@ import android.text.method.LinkMovementMethod; import android.view.View; import android.widget.ImageView; import android.widget.TextView; + import com.android.dialer.app.alert.AlertManager; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.voicemail.listui.error.VoicemailErrorMessage.Action; + import java.util.List; /** diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java index cb1c32934bdf8e381c05c63b0d9d88623af57c14..469a9de00710b72d65120698ada8f16867920046 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; @@ -36,6 +36,7 @@ import com.android.dialer.precall.PreCall; import com.android.dialer.voicemail.settings.VoicemailChangePinActivity; import com.android.voicemail.VoicemailClient; import com.android.voicemail.VoicemailComponent; + import java.util.Arrays; import java.util.List; @@ -130,13 +131,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 +142,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 +154,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 +191,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 +212,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/VoicemailStatus.java b/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java index 148d350d88055f57c817c3e9f690bd000babee72..ccf631a3d8f11c620049c63f67b85d35e89b4f4b 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java +++ b/java/com/android/dialer/voicemail/listui/error/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. @@ -16,6 +17,7 @@ package com.android.dialer.voicemail.listui.error; +import android.annotation.SuppressLint; import android.content.ComponentName; import android.content.Context; import android.database.Cursor; @@ -122,6 +124,7 @@ public class VoicemailStatus { isAirplaneMode = builder.isAirplaneMode; } + @SuppressLint("MissingPermission") private static int getNotificationChannelStateFormTelephony( Context context, PhoneAccountHandle phoneAccountHandle) { TelephonyManager telephonyManager = diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java index 5096da2d0738f03a9c4406e246e95b17dc91a64c..4466409fa6e767be40385ca8c1214fd5dcdecd76 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.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,6 +27,7 @@ import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.voicemailstatus.VoicemailStatusQuery; import com.android.voicemail.VoicemailComponent; + import java.util.ArrayList; import java.util.List; @@ -55,7 +57,7 @@ public class VoicemailStatusWorker implements Worker { + 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); @@ -172,28 +165,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(); @@ -204,23 +184,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 84bbe6034ec9dc697c628e181411da44a70c8b77..c4910ae06161211a56c355996830740d44facea8 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. @@ -20,8 +21,6 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.VoicemailContract.Status; -import android.view.View; -import android.view.View.OnClickListener; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -288,18 +287,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/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 dab2f211375089fee92b806cd638dbdbd0c0ddb9..e70e74925550e2aa0a6560b49ea944ea9d37d8e9 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 17a1f74b61ade18d8be71c3561856f93c2a93425..2ecc14355c30e393d88654185583640cc36805a7 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 @@ - - - - - - - - - - - - - - - - diff --git a/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java index 3bddd96fc95c344b616cbed2430eb2d9aa1a325e..5a73c03719255070947c8a1ebb68608e78365203 100644 --- a/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java +++ b/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.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,37 +18,35 @@ 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 android.support.v4.app.ActivityCompat; import android.view.View; -import android.view.View.OnClickListener; -import android.widget.ImageButton; import android.widget.TextView; -import androidx.annotation.NonNull; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; +import androidx.appcompat.app.AppCompatActivity; import com.android.dialer.R; import com.android.dialer.common.LogUtil; import com.android.dialer.widget.DialerToolbar; + import java.io.IOException; import java.util.Locale; /** Activity to display current voicemail greeting and allow user to navigate to record a new one */ -public class CurrentVoicemailGreetingActivity extends Activity { +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 ImageButton changeGreetingButton; - private ImageButton playButton; - - private DialerToolbar currentVoicemailGreetingDialerToolbar; + private final ActivityResultLauncher audioPermissionLauncher = registerForActivityResult( + new ActivityResultContracts.RequestPermission(), granted -> { + if (!granted) { + LogUtil.w( + "CurrentVoicemailGreetingActivity.onRequestPermissionsResult", + "permissionToRecordAccepted = false."); + } + }); private int greetingDuration = -1; @@ -64,37 +63,18 @@ public class CurrentVoicemailGreetingActivity extends Activity { setContentView(R.layout.activity_current_voicemail_greeting); playbackDisplay = findViewById(R.id.current_voicemail_greeting_recording_display); - playbackProgressLabel = (TextView) findViewById(R.id.playback_progress_text_view); - currentVoicemailGreetingDialerToolbar = (DialerToolbar) findViewById(R.id.toolbar); + playbackProgressLabel = findViewById(R.id.playback_progress_text_view); + DialerToolbar currentVoicemailGreetingDialerToolbar = findViewById(R.id.toolbar); currentVoicemailGreetingDialerToolbar.setTitle( R.string.voicemail_change_greeting_preference_title); - changeGreetingButton = (ImageButton) findViewById(R.id.change_greeting_button); - changeGreetingButton.setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - // TODO(sabowitz): Implement this in CL child beta01. - } - }); - - playButton = (ImageButton) findViewById(R.id.play_button); - playButton.setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - // TODO(sabowitz): Finish implementing this in CL child beta02. - } - }); - displayCurrentVoicemailGreetingStatus(); } @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(); @@ -119,22 +99,6 @@ public class CurrentVoicemailGreetingActivity extends Activity { 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/dialer/voicemail/settings/RecordButton.java b/java/com/android/dialer/voicemail/settings/RecordButton.java index ac64cde3487ecbf3b8e0dccf255a64fd0c3a84b8..6409dd4c885cc7906f7555af5d06aef4488055f1 100644 --- a/java/com/android/dialer/voicemail/settings/RecordButton.java +++ b/java/com/android/dialer/voicemail/settings/RecordButton.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. @@ -24,13 +25,16 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; -import android.support.v4.content.ContextCompat; 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/voicemail/settings/RecordVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java index d72f3c879a6bdcd7bd36299024353b5125c23ad5..f2a7ce7a0c1f0cf33f7197187dcf2d1d043c70f4 100644 --- a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java +++ b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.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,13 +17,13 @@ package com.android.dialer.voicemail.settings; -import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import androidx.annotation.IntDef; +import androidx.appcompat.app.AppCompatActivity; import com.android.dialer.R; @@ -30,7 +31,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** Activity for recording a new voicemail greeting */ -public class RecordVoicemailGreetingActivity extends Activity implements OnClickListener { +public class RecordVoicemailGreetingActivity extends AppCompatActivity implements OnClickListener { /** Possible states of RecordButton and RecordVoicemailGreetingActivity */ @Retention(RetentionPolicy.SOURCE) diff --git a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java index 8b061972c2b7b561fff08e5d8d77eaf600bd3fdc..67caa41490e0f9cc96f779e3f46676063db495b1 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.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,14 +17,13 @@ package com.android.dialer.voicemail.settings; -import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; -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; @@ -43,6 +43,7 @@ import android.widget.TextView.OnEditorActionListener; import android.widget.Toast; import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; import com.android.dialer.R; import com.android.dialer.common.LogUtil; @@ -54,6 +55,7 @@ import com.android.voicemail.PinChanger.ChangePinResult; import com.android.voicemail.PinChanger.PinSpecification; import com.android.voicemail.VoicemailClient; import com.android.voicemail.VoicemailComponent; + import java.lang.ref.WeakReference; /** @@ -61,7 +63,7 @@ import java.lang.ref.WeakReference; * traditional voicemail through phone call. The intent to launch this activity must contain {@link * VoicemailClient#PARAM_PHONE_ACCOUNT_HANDLE} */ -public class VoicemailChangePinActivity extends Activity +public class VoicemailChangePinActivity extends AppCompatActivity implements OnClickListener, OnEditorActionListener, TextWatcher { private static final String TAG = "VmChangePinActivity"; @@ -96,7 +98,7 @@ public class VoicemailChangePinActivity extends Activity 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 { /** @@ -164,12 +166,7 @@ public class VoicemailChangePinActivity extends Activity .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 @@ -241,7 +238,7 @@ public class VoicemailChangePinActivity extends Activity 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 @@ -324,7 +321,8 @@ public class VoicemailChangePinActivity extends Activity 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() @@ -355,7 +353,7 @@ public class VoicemailChangePinActivity extends Activity changePinExecutor = DialerExecutorComponent.get(this) .dialerExecutorFactory() - .createUiTaskBuilder(getFragmentManager(), "changePin", new ChangePinWorker()) + .createUiTaskBuilder(getSupportFragmentManager(), "changePin", new ChangePinWorker()) .onSuccess(this::sendResult) .onFailure((tr) -> sendResult(PinChanger.CHANGE_PIN_SYSTEM_ERROR)) .build(); @@ -564,6 +562,7 @@ public class VoicemailChangePinActivity extends Activity private final WeakReference activityWeakReference; private ChangePinHandler(WeakReference activityWeakReference) { + super(Looper.getMainLooper()); this.activityWeakReference = activityWeakReference; } diff --git a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java index 25b34d20d4db08adf23abe3f8a02e439818eb0dc..a0cfc82e7a6055389388536f4710dab9f3b1f8e6 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java @@ -1,26 +1,25 @@ -/** +/* * 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 + * 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.dialer.voicemail.settings; import android.app.AlertDialog; -import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.preference.Preference; -import android.preference.Preference.OnPreferenceClickListener; -import android.preference.PreferenceScreen; -import android.preference.SwitchPreference; import android.provider.Settings; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; @@ -30,9 +29,12 @@ import android.telephony.TelephonyManager; import androidx.annotation.IntDef; import androidx.annotation.Nullable; +import androidx.preference.Preference; +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; @@ -40,15 +42,16 @@ import com.android.dialer.telecom.TelecomUtil; import com.android.voicemail.VoicemailClient; import com.android.voicemail.VoicemailClient.ActivationStateListener; import com.android.voicemail.VoicemailComponent; -import com.google.common.base.Optional; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.Optional; /** * 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, @@ -67,8 +70,8 @@ public class VoicemailSettingsFragment extends DialerPreferenceFragment private Preference voicemailNotificationPreference; private PreferenceScreen advancedSettingsPreference; // Settings that are supported by dialer only if the carrier configurations are valid. - private SwitchPreference visualVoicemailPreference; - private SwitchPreference voicemailAutoArchivePreference; + private SwitchPreferenceCompat visualVoicemailPreference; + private SwitchPreferenceCompat voicemailAutoArchivePreference; private Preference voicemailChangePinPreference; @Override @@ -79,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(); @@ -150,11 +158,11 @@ public class VoicemailSettingsFragment extends DialerPreferenceFragment advancedSettingsPreference.setOrder(VMSettingOrdering.ADVANCED_SETTING); visualVoicemailPreference = - (SwitchPreference) findPreference(getString(R.string.voicemail_visual_voicemail_key)); + (SwitchPreferenceCompat) findPreference(getString(R.string.voicemail_visual_voicemail_key)); visualVoicemailPreference.setOrder(VMSettingOrdering.VISUAL_VOICEMAIL); voicemailAutoArchivePreference = - (SwitchPreference) + (SwitchPreferenceCompat) findPreference(getString(R.string.voicemail_visual_voicemail_archive_key)); voicemailAutoArchivePreference.setOrder(VMSettingOrdering.VOICEMAIL_AUTO_ARCHIVE); @@ -298,26 +306,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/dialer/voicemail/settings/res/layout/voicemail_change_pin.xml b/java/com/android/dialer/voicemail/settings/res/layout/voicemail_change_pin.xml index 304bd37eca5ff684775eaee5af8dba15ae3ffae4..9ca6708cb48576f73daa2fd158ff0e50631cc536 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"/>