diff --git a/app/build.gradle b/app/build.gradle index 54e1ea7b52..8090f300b4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -466,6 +466,7 @@ dependencies { implementation Deps.mozilla_feature_accounts implementation Deps.mozilla_feature_app_links + implementation Deps.mozilla_feature_autofill implementation Deps.mozilla_feature_awesomebar implementation Deps.mozilla_feature_contextmenu implementation Deps.mozilla_feature_customtabs diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml index 3d25c0db6b..0b66b4956c 100644 --- a/app/src/debug/AndroidManifest.xml +++ b/app/src/debug/AndroidManifest.xml @@ -18,6 +18,25 @@ + android:name="org.mozilla.fenix.DebugFenixApplication"> + + + + + + + + + + + + diff --git a/app/src/main/java/org/mozilla/fenix/autofill/AutofillConfirmActivity.kt b/app/src/main/java/org/mozilla/fenix/autofill/AutofillConfirmActivity.kt new file mode 100644 index 0000000000..219fe95c87 --- /dev/null +++ b/app/src/main/java/org/mozilla/fenix/autofill/AutofillConfirmActivity.kt @@ -0,0 +1,19 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.fenix.autofill + +import android.os.Build +import androidx.annotation.RequiresApi +import mozilla.components.feature.autofill.AutofillConfiguration +import mozilla.components.feature.autofill.ui.AbstractAutofillConfirmActivity +import org.mozilla.fenix.ext.components + +/** + * Activity responsible for asking the user to confirm before auto-filling a third-party app. + */ +@RequiresApi(Build.VERSION_CODES.O) +class AutofillConfirmActivity : AbstractAutofillConfirmActivity() { + override val configuration: AutofillConfiguration by lazy { components.autofillConfiguration } +} diff --git a/app/src/main/java/org/mozilla/fenix/autofill/AutofillService.kt b/app/src/main/java/org/mozilla/fenix/autofill/AutofillService.kt new file mode 100644 index 0000000000..9ec8acf5e5 --- /dev/null +++ b/app/src/main/java/org/mozilla/fenix/autofill/AutofillService.kt @@ -0,0 +1,19 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.fenix.autofill + +import android.os.Build +import androidx.annotation.RequiresApi +import mozilla.components.feature.autofill.AbstractAutofillService +import mozilla.components.feature.autofill.AutofillConfiguration +import org.mozilla.fenix.ext.components + +/** + * Service responsible for implementing Android's Autofill framework. + */ +@RequiresApi(Build.VERSION_CODES.O) +class AutofillService : AbstractAutofillService() { + override val configuration: AutofillConfiguration by lazy { components.autofillConfiguration } +} diff --git a/app/src/main/java/org/mozilla/fenix/autofill/AutofillUnlockActivity.kt b/app/src/main/java/org/mozilla/fenix/autofill/AutofillUnlockActivity.kt new file mode 100644 index 0000000000..2e3a1a389c --- /dev/null +++ b/app/src/main/java/org/mozilla/fenix/autofill/AutofillUnlockActivity.kt @@ -0,0 +1,19 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.fenix.autofill + +import android.os.Build +import androidx.annotation.RequiresApi +import mozilla.components.feature.autofill.AutofillConfiguration +import mozilla.components.feature.autofill.ui.AbstractAutofillUnlockActivity +import org.mozilla.fenix.ext.components + +/** + * Activity responsible for unlocking the autofill service by asking the user to verify. + */ +@RequiresApi(Build.VERSION_CODES.O) +class AutofillUnlockActivity : AbstractAutofillUnlockActivity() { + override val configuration: AutofillConfiguration by lazy { components.autofillConfiguration } +} diff --git a/app/src/main/java/org/mozilla/fenix/components/Components.kt b/app/src/main/java/org/mozilla/fenix/components/Components.kt index fbfe5ed3fc..031b61e744 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Components.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Components.kt @@ -14,12 +14,15 @@ import mozilla.components.feature.addons.migration.DefaultSupportedAddonsChecker import mozilla.components.feature.addons.migration.SupportedAddonsChecker import mozilla.components.feature.addons.update.AddonUpdater import mozilla.components.feature.addons.update.DefaultAddonUpdater +import mozilla.components.feature.autofill.AutofillConfiguration import mozilla.components.feature.sitepermissions.SitePermissionsStorage import mozilla.components.lib.publicsuffixlist.PublicSuffixList import mozilla.components.support.migration.state.MigrationStore import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.Config import org.mozilla.fenix.HomeActivity +import org.mozilla.fenix.R +import org.mozilla.fenix.autofill.AutofillUnlockActivity import org.mozilla.fenix.perf.StrictModeManager import org.mozilla.fenix.components.metrics.AppStartupTelemetry import org.mozilla.fenix.ext.components @@ -155,4 +158,15 @@ class Components(private val context: Context) { FenixReviewSettings(settings) ) } + + val autofillConfiguration by lazyMonitored { + AutofillConfiguration( + storage = core.passwordsStorage, + publicSuffixList = publicSuffixList, + unlockActivity = AutofillUnlockActivity::class.java, + confirmActivity = AutofillConfiguration::class.java, + applicationName = context.getString(R.string.app_name), + httpClient = core.client + ) + } } diff --git a/app/src/nightly/AndroidManifest.xml b/app/src/nightly/AndroidManifest.xml index 5fdb32de41..3aaf3d6a27 100644 --- a/app/src/nightly/AndroidManifest.xml +++ b/app/src/nightly/AndroidManifest.xml @@ -4,6 +4,24 @@ + + + + + + + + + + + diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 44e5323a62..c28def1366 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -98,6 +98,7 @@ object Deps { const val mozilla_feature_accounts = "org.mozilla.components:feature-accounts:${Versions.mozilla_android_components}" const val mozilla_feature_app_links = "org.mozilla.components:feature-app-links:${Versions.mozilla_android_components}" + const val mozilla_feature_autofill = "org.mozilla.components:feature-autofill:${Versions.mozilla_android_components}" const val mozilla_feature_awesomebar = "org.mozilla.components:feature-awesomebar:${Versions.mozilla_android_components}" const val mozilla_feature_contextmenu = "org.mozilla.components:feature-contextmenu:${Versions.mozilla_android_components}" const val mozilla_feature_customtabs = "org.mozilla.components:feature-customtabs:${Versions.mozilla_android_components}"