Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moves autofill service (and activities) to its own process #5720

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions autofill/autofill-impl/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,36 @@
android:configChanges="orientation|screenSize"
android:exported="false"
android:windowSoftInputMode="adjustResize" />

<!-- Autofill Service runs on its own process https://app.asana.com/0/72649045549333/1209537052601451 -->
<activity
android:name=".service.AutofillProviderFillSuggestionActivity"
android:configChanges="orientation|screenSize"
android:exported="false"
android:process=":autofill"
android:theme="@style/Theme.AppCompat.Transparent.NoActionBar"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".service.AutofillProviderChooseActivity"
android:configChanges="orientation|screenSize"
android:exported="false"
android:process=":autofill"
android:windowSoftInputMode="adjustResize" />
<service
android:name="com.duckduckgo.autofill.impl.service.RealAutofillService"
android:exported="true"
android:label="@string/serviceName"
android:enabled="false"
android:process=":autofill"
android:permission="android.permission.BIND_AUTOFILL_SERVICE">
<intent-filter>
<action android:name="android.service.autofill.AutofillService" />
</intent-filter>
<meta-data
android:name="android.autofill"
android:resource="@xml/service_configuration" />
</service>
<!-- Autofill Service -->
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Contributor Author

@cmonfortep cmonfortep Mar 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While testing I've noticed some crash pixels related when the coroutine is cancelled (before completion). That doesn't represent a crash, so skipping if that's the case.

pixel.fire(AutofillPixelNames.AUTOFILL_SERVICE_CRASH, mapOf("message" to it.extractExceptionCause()))
}
callback.onSuccess(null)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
-->

<resources>
<string name="serviceName" translatable="false">DuckDuckGo</string>
<string name="autofill_service_suggestion_open_passwords">Open Passwords</string>
<string name="autofill_service_select_password_activity">Select a Saved Password</string>
</resources>
13 changes: 0 additions & 13 deletions autofill/autofill-internal/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,5 @@
android:exported="true"
android:label="@string/autofillDevSettingsTitle"
android:parentActivityName="com.duckduckgo.app.settings.SettingsActivity" />
<service
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it deliberate to also move this outside of internal as part of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as part of the final prep, including moving this to the actual manifest.

android:name="com.duckduckgo.autofill.impl.service.RealAutofillService"
android:exported="true"
android:label="@string/appName"
android:enabled="false"
android:permission="android.permission.BIND_AUTOFILL_SERVICE">
<intent-filter>
<action android:name="android.service.autofill.AutofillService" />
</intent-filter>
<meta-data
android:name="android.autofill"
android:resource="@xml/service_configuration" />
</service>
</application>
</manifest>
Loading