PM-24090: Remove ChromeAutofill feature flag (#5567)

This commit is contained in:
David Perez 2025-07-24 09:49:02 -05:00 committed by GitHub
parent bb950c8c59
commit c60f3131b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 6 additions and 102 deletions

View File

@ -24,7 +24,6 @@ import com.x8bit.bitwarden.data.autofill.processor.AutofillProcessor
import com.x8bit.bitwarden.data.autofill.processor.AutofillProcessorImpl
import com.x8bit.bitwarden.data.autofill.provider.AutofillCipherProvider
import com.x8bit.bitwarden.data.autofill.provider.AutofillCipherProviderImpl
import com.x8bit.bitwarden.data.platform.manager.FeatureFlagManager
import com.x8bit.bitwarden.data.platform.manager.PolicyManager
import com.x8bit.bitwarden.data.platform.manager.ciphermatching.CipherMatchingManager
import com.x8bit.bitwarden.data.platform.manager.clipboard.BitwardenClipboardManager
@ -59,12 +58,8 @@ object AutofillModule {
@Singleton
@Provides
fun providesBrowserAutofillEnabledManager(
featureFlagManager: FeatureFlagManager,
): BrowserThirdPartyAutofillEnabledManager =
BrowserThirdPartyAutofillEnabledManagerImpl(
featureFlagManager = featureFlagManager,
)
fun providesBrowserAutofillEnabledManager(): BrowserThirdPartyAutofillEnabledManager =
BrowserThirdPartyAutofillEnabledManagerImpl()
@Singleton
@Provides

View File

@ -2,19 +2,14 @@ package com.x8bit.bitwarden.data.autofill.manager.browser
import com.x8bit.bitwarden.data.autofill.model.browser.BrowserThirdPartyAutoFillData
import com.x8bit.bitwarden.data.autofill.model.browser.BrowserThirdPartyAutofillStatus
import com.x8bit.bitwarden.data.platform.manager.FeatureFlagManager
import com.x8bit.bitwarden.data.platform.manager.model.FlagKey
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.update
/**
* Default implementation of [BrowserThirdPartyAutofillEnabledManager].
*/
class BrowserThirdPartyAutofillEnabledManagerImpl(
private val featureFlagManager: FeatureFlagManager,
) : BrowserThirdPartyAutofillEnabledManager {
class BrowserThirdPartyAutofillEnabledManagerImpl : BrowserThirdPartyAutofillEnabledManager {
override var browserThirdPartyAutofillStatus: BrowserThirdPartyAutofillStatus = DEFAULT_STATUS
set(value) {
field = value
@ -29,15 +24,6 @@ class BrowserThirdPartyAutofillEnabledManagerImpl(
override val browserThirdPartyAutofillStatusFlow: Flow<BrowserThirdPartyAutofillStatus>
get() = mutableBrowserThirdPartyAutofillStatusStateFlow
.combine(
featureFlagManager.getFeatureFlagFlow(FlagKey.ChromeAutofill),
) { data, enabled ->
if (enabled) {
data
} else {
DEFAULT_STATUS
}
}
}
private val DEFAULT_STATUS = BrowserThirdPartyAutofillStatus(

View File

@ -29,7 +29,6 @@ sealed class FlagKey<out T : Any> {
SingleTapPasskeyAuthentication,
AnonAddySelfHostAlias,
SimpleLoginSelfHostAlias,
ChromeAutofill,
RestrictCipherItemDeletion,
UserManagedPrivilegedApps,
RemoveCardPolicy,
@ -112,15 +111,6 @@ sealed class FlagKey<out T : Any> {
override val defaultValue: Boolean = false
}
/**
* Data object holding the feature flag key to enable the checking for Chrome's third party
* autofill.
*/
data object ChromeAutofill : FlagKey<Boolean>() {
override val keyName: String = "android-chrome-autofill"
override val defaultValue: Boolean = false
}
/**
* Data object holding the feature flag key to enable the restriction of cipher item deletion
*/

View File

@ -34,7 +34,6 @@ fun <T : Any> FlagKey<T>.ListItemContent(
FlagKey.SingleTapPasskeyAuthentication,
FlagKey.AnonAddySelfHostAlias,
FlagKey.SimpleLoginSelfHostAlias,
FlagKey.ChromeAutofill,
FlagKey.RestrictCipherItemDeletion,
FlagKey.UserManagedPrivilegedApps,
FlagKey.RemoveCardPolicy,
@ -91,7 +90,6 @@ private fun <T : Any> FlagKey<T>.getDisplayLabel(): String = when (this) {
FlagKey.AnonAddySelfHostAlias -> stringResource(R.string.anon_addy_self_hosted_aliases)
FlagKey.SimpleLoginSelfHostAlias -> stringResource(R.string.simple_login_self_hosted_aliases)
FlagKey.ChromeAutofill -> stringResource(R.string.enable_chrome_autofill)
FlagKey.RestrictCipherItemDeletion -> stringResource(R.string.restrict_item_deletion)
FlagKey.UserManagedPrivilegedApps -> {
stringResource(R.string.user_trusted_privileged_app_management)

View File

@ -22,7 +22,6 @@
<string name="reset_coach_mark_tour_status">Reset all coach mark tours</string>
<string name="anon_addy_self_hosted_aliases">AnonAddy self-hosted aliases</string>
<string name="simple_login_self_hosted_aliases">SimpleLogin self-hosted aliases</string>
<string name="enable_chrome_autofill">Enable chrome autofill</string>
<string name="restrict_item_deletion">Restrict item deletion</string>
<string name="generate_crash">Generate crash</string>
<string name="generate_error_report">Generate error report</string>

View File

@ -9,9 +9,7 @@ import com.x8bit.bitwarden.data.autofill.manager.browser.BrowserThirdPartyAutofi
import com.x8bit.bitwarden.data.autofill.model.browser.BrowserThirdPartyAutoFillData
import com.x8bit.bitwarden.data.autofill.model.browser.BrowserThirdPartyAutofillStatus
import com.x8bit.bitwarden.data.platform.manager.AppStateManager
import com.x8bit.bitwarden.data.platform.manager.FeatureFlagManager
import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState
import com.x8bit.bitwarden.data.platform.manager.model.FlagKey
import io.mockk.every
import io.mockk.just
import io.mockk.mockk
@ -48,11 +46,8 @@ class AutofillActivityManagerTest {
every { betaChromeAutofillStatus } returns DEFAULT_BROWSER_AUTOFILL_DATA
}
private val featureFlagManager = mockk<FeatureFlagManager> {
every { getFeatureFlagFlow(FlagKey.ChromeAutofill) } returns MutableStateFlow(true)
}
private val browserThirdPartyAutofillEnabledManager: BrowserThirdPartyAutofillEnabledManager =
BrowserThirdPartyAutofillEnabledManagerImpl(featureFlagManager = featureFlagManager)
BrowserThirdPartyAutofillEnabledManagerImpl()
// We will construct an instance here just to hook the various dependencies together internally
@Suppress("unused")

View File

@ -3,25 +3,13 @@ package com.x8bit.bitwarden.data.autofill.manager.browser
import app.cash.turbine.test
import com.x8bit.bitwarden.data.autofill.model.browser.BrowserThirdPartyAutoFillData
import com.x8bit.bitwarden.data.autofill.model.browser.BrowserThirdPartyAutofillStatus
import com.x8bit.bitwarden.data.platform.manager.FeatureFlagManager
import com.x8bit.bitwarden.data.platform.manager.model.FlagKey
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
class BrowserThirdPartyAutofillEnabledManagerTest {
private val mutableChromeAutofillFeatureFlow = MutableStateFlow(true)
private val featureFlagManager = mockk<FeatureFlagManager> {
every {
getFeatureFlagFlow(FlagKey.ChromeAutofill)
} returns mutableChromeAutofillFeatureFlow
}
private val browserThirdPartyAutofillEnabledManager =
BrowserThirdPartyAutofillEnabledManagerImpl(featureFlagManager = featureFlagManager)
private val browserThirdPartyAutofillEnabledManager: BrowserThirdPartyAutofillEnabledManager =
BrowserThirdPartyAutofillEnabledManagerImpl()
@Suppress("MaxLineLength")
@Test
@ -61,46 +49,6 @@ class BrowserThirdPartyAutofillEnabledManagerTest {
)
}
}
@Suppress("MaxLineLength")
@Test
fun `browserThirdPartyAutofillStatusFlow should not emit whenever isAutofillEnabled is set to a unique value if the feature is off`() =
runTest {
mutableChromeAutofillFeatureFlow.update { false }
browserThirdPartyAutofillEnabledManager.browserThirdPartyAutofillStatusFlow.test {
assertEquals(
DEFAULT_EXPECTED_AUTOFILL_STATUS,
awaitItem(),
)
val firstExpectedStatusChange = DEFAULT_EXPECTED_AUTOFILL_STATUS.copy(
chromeStableStatusData = DEFAULT_BROWSER_AUTOFILL_DATA.copy(isAvailable = true),
)
browserThirdPartyAutofillEnabledManager.browserThirdPartyAutofillStatus =
firstExpectedStatusChange
assertEquals(
DEFAULT_EXPECTED_AUTOFILL_STATUS,
awaitItem(),
)
browserThirdPartyAutofillEnabledManager.browserThirdPartyAutofillStatus =
firstExpectedStatusChange.copy()
expectNoEvents()
val secondExpectedStatusChange = firstExpectedStatusChange
.copy(
chromeBetaChannelStatusData = DEFAULT_BROWSER_AUTOFILL_DATA.copy(
isThirdPartyEnabled = true,
),
)
browserThirdPartyAutofillEnabledManager.browserThirdPartyAutofillStatus =
secondExpectedStatusChange
assertEquals(
DEFAULT_EXPECTED_AUTOFILL_STATUS,
awaitItem(),
)
}
}
}
private val DEFAULT_BROWSER_AUTOFILL_DATA = BrowserThirdPartyAutoFillData(

View File

@ -41,10 +41,6 @@ class FlagKeyTest {
FlagKey.AnonAddySelfHostAlias.keyName,
"anon-addy-self-host-alias",
)
assertEquals(
FlagKey.ChromeAutofill.keyName,
"android-chrome-autofill",
)
assertEquals(
FlagKey.RestrictCipherItemDeletion.keyName,
"pm-15493-restrict-item-deletion-to-can-manage-permission",
@ -72,7 +68,6 @@ class FlagKeyTest {
FlagKey.AnonAddySelfHostAlias,
FlagKey.SimpleLoginSelfHostAlias,
FlagKey.CipherKeyEncryption,
FlagKey.ChromeAutofill,
FlagKey.RestrictCipherItemDeletion,
FlagKey.UserManagedPrivilegedApps,
FlagKey.RemoveCardPolicy,

View File

@ -152,7 +152,6 @@ private val DEFAULT_MAP_VALUE: ImmutableMap<FlagKey<Any>, Any> = persistentMapOf
FlagKey.SingleTapPasskeyAuthentication to true,
FlagKey.AnonAddySelfHostAlias to true,
FlagKey.SimpleLoginSelfHostAlias to true,
FlagKey.ChromeAutofill to true,
FlagKey.RestrictCipherItemDeletion to true,
FlagKey.UserManagedPrivilegedApps to true,
FlagKey.RemoveCardPolicy to true,
@ -167,7 +166,6 @@ private val UPDATED_MAP_VALUE: ImmutableMap<FlagKey<Any>, Any> = persistentMapOf
FlagKey.SingleTapPasskeyAuthentication to false,
FlagKey.AnonAddySelfHostAlias to false,
FlagKey.SimpleLoginSelfHostAlias to false,
FlagKey.ChromeAutofill to false,
FlagKey.RestrictCipherItemDeletion to false,
FlagKey.UserManagedPrivilegedApps to false,
FlagKey.RemoveCardPolicy to false,