From 6a04ccb2850c727eb2ad2b660efe76599cfa9f0b Mon Sep 17 00:00:00 2001 From: Tangem Date: Sun, 1 Mar 2026 13:55:27 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../core/ui/security/DisableAutofill.kt | 31 +++++++++++++++++++ .../ui/MultiWalletSeedPhraseImport.kt | 3 ++ 2 files changed, 34 insertions(+) create mode 100644 core/ui/src/main/java/com/tangem/core/ui/security/DisableAutofill.kt diff --git a/core/ui/src/main/java/com/tangem/core/ui/security/DisableAutofill.kt b/core/ui/src/main/java/com/tangem/core/ui/security/DisableAutofill.kt new file mode 100644 index 0000000000..8693a0ea3e --- /dev/null +++ b/core/ui/src/main/java/com/tangem/core/ui/security/DisableAutofill.kt @@ -0,0 +1,31 @@ +package com.tangem.core.ui.security + +import android.os.Build +import android.view.View +import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect +import androidx.compose.ui.platform.LocalView + +/** + * Disables autofill for the current Compose view hierarchy. + * + * This prevents password managers and other autofill services from accessing + * sensitive content (e.g., seed phrases, private keys) entered in text fields. + * + * Must be called within a Composable scope before the text fields that need protection. + * + * The original autofill setting is restored when this composable leaves the composition. + */ +@Composable +fun DisableAutofillEffect() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + val view = LocalView.current + DisposableEffect(view) { + val previousValue = view.importantForAutofill + view.importantForAutofill = View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS + onDispose { + view.importantForAutofill = previousValue + } + } + } +} \ No newline at end of file diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseImport.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseImport.kt index 8779ab378a..a5fda3ab83 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseImport.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseImport.kt @@ -28,6 +28,7 @@ import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.extensions.stringResourceSafe import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemThemePreview +import com.tangem.core.ui.security.DisableAutofillEffect import com.tangem.features.onboarding.v2.impl.R import com.tangem.features.onboarding.v2.multiwallet.impl.child.seedphrase.ui.state.MultiWalletSeedPhraseUM import com.tangem.features.onboarding.v2.multiwallet.impl.child.seedphrase.ui.utils.InvalidWordsColorTransformation @@ -53,6 +54,8 @@ internal fun MultiWalletSeedPhraseImport(state: MultiWalletSeedPhraseUM.Import, ) } + DisableAutofillEffect() + Box(modifier.fillMaxSize()) { Column( modifier = Modifier