From 2e202a066384abe5ad6f75e0436b39ab01101325 Mon Sep 17 00:00:00 2001 From: Cristian Monforte Date: Sun, 2 Mar 2025 22:15:07 +0100 Subject: [PATCH 1/4] moves autofill service (and activities) to its own process --- .../app/global/DuckDuckGoApplication.kt | 9 +++++++++ .../src/main/AndroidManifest.xml | 19 +++++++++++++++++++ .../src/main/res/values/donottranslate.xml | 1 + .../src/main/AndroidManifest.xml | 13 ------------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt b/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt index 7a273d9b518e..15518c1d6de1 100644 --- a/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt +++ b/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt @@ -39,6 +39,7 @@ import kotlinx.coroutines.* import timber.log.Timber private const val VPN_PROCESS_NAME = "vpn" +private const val AUTOFILL_SERVICE_PROCESS_NAME = "autofill" open class DuckDuckGoApplication : HasDaggerInjector, MultiProcessApplication() { @@ -114,6 +115,14 @@ open class DuckDuckGoApplication : HasDaggerInjector, MultiProcessApplication() } } } + + runInSecondaryProcessNamed(AUTOFILL_SERVICE_PROCESS_NAME) { + configureLogging() + configureStrictMode() + Timber.d("Init for secondary process $shortProcessName with pid=${android.os.Process.myPid()}") + configureDependencyInjection() + configureUncaughtExceptionHandler() + } } private fun setupActivityLifecycleCallbacks() { diff --git a/autofill/autofill-impl/src/main/AndroidManifest.xml b/autofill/autofill-impl/src/main/AndroidManifest.xml index 89b1e658d48e..51aa7cda8280 100644 --- a/autofill/autofill-impl/src/main/AndroidManifest.xml +++ b/autofill/autofill-impl/src/main/AndroidManifest.xml @@ -24,17 +24,36 @@ android:configChanges="orientation|screenSize" android:exported="false" android:windowSoftInputMode="adjustResize" /> + + + + + + + + + \ No newline at end of file diff --git a/autofill/autofill-impl/src/main/res/values/donottranslate.xml b/autofill/autofill-impl/src/main/res/values/donottranslate.xml index 422374b935c0..13804d3db44e 100644 --- a/autofill/autofill-impl/src/main/res/values/donottranslate.xml +++ b/autofill/autofill-impl/src/main/res/values/donottranslate.xml @@ -15,6 +15,7 @@ --> + DuckDuckGo Open Passwords Select a Saved Password \ No newline at end of file diff --git a/autofill/autofill-internal/src/main/AndroidManifest.xml b/autofill/autofill-internal/src/main/AndroidManifest.xml index d06161ef7e98..b3239403ce7a 100644 --- a/autofill/autofill-internal/src/main/AndroidManifest.xml +++ b/autofill/autofill-internal/src/main/AndroidManifest.xml @@ -22,18 +22,5 @@ android:exported="true" android:label="@string/autofillDevSettingsTitle" android:parentActivityName="com.duckduckgo.app.settings.SettingsActivity" /> - - - - - - \ No newline at end of file From 10c5838c4a668584a08d902a02de007c2e04347a Mon Sep 17 00:00:00 2001 From: Cristian Monforte Date: Sun, 2 Mar 2025 22:51:52 +0100 Subject: [PATCH 2/4] don't send crash pixel for coroutine cancellation exception --- .../duckduckgo/autofill/impl/service/RealAutofillService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/RealAutofillService.kt b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/RealAutofillService.kt index bc6f6cb81730..6c7e794578a0 100644 --- a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/RealAutofillService.kt +++ b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/RealAutofillService.kt @@ -102,7 +102,9 @@ class RealAutofillService : AutofillService() { callback.onSuccess(response) }.onFailure { - pixel.fire(AutofillPixelNames.AUTOFILL_SERVICE_CRASH, mapOf("message" to it.extractExceptionCause())) + if (it !is kotlinx.coroutines.CancellationException) { + pixel.fire(AutofillPixelNames.AUTOFILL_SERVICE_CRASH, mapOf("message" to it.extractExceptionCause())) + } callback.onSuccess(null) } } From 4e22b667791e22e5c122d3478dc3eb2f97e1b6f9 Mon Sep 17 00:00:00 2001 From: Cristian Monforte Date: Tue, 4 Mar 2025 12:30:05 +0100 Subject: [PATCH 3/4] removes init block from DDGApplication after restack onto develop. re:PIR multiprocess changes --- .../com/duckduckgo/app/global/DuckDuckGoApplication.kt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt b/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt index 15518c1d6de1..7a273d9b518e 100644 --- a/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt +++ b/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt @@ -39,7 +39,6 @@ import kotlinx.coroutines.* import timber.log.Timber private const val VPN_PROCESS_NAME = "vpn" -private const val AUTOFILL_SERVICE_PROCESS_NAME = "autofill" open class DuckDuckGoApplication : HasDaggerInjector, MultiProcessApplication() { @@ -115,14 +114,6 @@ open class DuckDuckGoApplication : HasDaggerInjector, MultiProcessApplication() } } } - - runInSecondaryProcessNamed(AUTOFILL_SERVICE_PROCESS_NAME) { - configureLogging() - configureStrictMode() - Timber.d("Init for secondary process $shortProcessName with pid=${android.os.Process.myPid()}") - configureDependencyInjection() - configureUncaughtExceptionHandler() - } } private fun setupActivityLifecycleCallbacks() { From 9bba2372cb0447847c4ac25c74e3b899f3892f51 Mon Sep 17 00:00:00 2001 From: Cristian Monforte Date: Tue, 4 Mar 2025 12:41:48 +0100 Subject: [PATCH 4/4] init repository cache on autofill process created --- .../autofill/impl/service/store/AutofillFeatureRepository.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/store/AutofillFeatureRepository.kt b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/store/AutofillFeatureRepository.kt index 551ecc4661ff..e1e0562d3d56 100644 --- a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/store/AutofillFeatureRepository.kt +++ b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/store/AutofillFeatureRepository.kt @@ -51,7 +51,7 @@ class RealAutofillFeatureRepository @Inject constructor( init { appCoroutineScope.launch(dispatcherProvider.io()) { Timber.i("DDGAutofillService: Init AutofillFeatureRepository from $processName") - if (isMainProcess || processName == "autofill") { // TODO: Revisit this after merging autofill process PR + if (isMainProcess || processName == ":autofill") { loadToMemory() } }