Skip to content

Commit f297d5b

Browse files
authored
Autofill: move store module as package inside impl (#6142)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1149059203486286/task/1210382174098207?focus=true ### Description Moves store module inside impl as package ### Steps to test this PR Smoke testing ### UI changes | Before | After | | ------ | ----- | !(Upload before screenshot)|(Upload after screenshot)|
1 parent 124384e commit f297d5b

File tree

40 files changed

+162
-379
lines changed

40 files changed

+162
-379
lines changed

app/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ dependencies {
249249

250250
implementation project(':autofill-api')
251251
implementation project(':autofill-impl')
252-
implementation project(':autofill-store')
253252
internalImplementation project(':autofill-internal')
254253
testImplementation project(':autofill-test')
255254

autofill/autofill-impl/build.gradle

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ dependencies {
3737
implementation project(path: ':common-ui')
3838
implementation project(path: ':autofill-api')
3939
implementation project(path: ':browser-api')
40-
implementation project(path: ':autofill-store')
4140
implementation project(path: ':statistics-api')
4241
testImplementation project(path: ':autofill-test')
4342
implementation project(path: ':sync-api')
@@ -51,6 +50,9 @@ dependencies {
5150
anvil project(path: ':anvil-compiler')
5251
implementation project(path: ':anvil-annotations')
5352

53+
implementation AndroidX.security.crypto
54+
implementation Square.okio
55+
5456
implementation AndroidX.appCompat
5557
implementation Google.android.material
5658
implementation AndroidX.constraintLayout
@@ -125,6 +127,13 @@ android {
125127
buildConfigField "boolean", "AUTH_REQUIRED", "true"
126128
}
127129
}
130+
sourceSets {
131+
test.assets.srcDirs += files("$projectDir/schemas".toString())
132+
}
133+
}
134+
135+
ksp {
136+
arg("room.schemaLocation", "$projectDir/schemas")
128137
}
129138

130139
tasks.register('installForAutofillTesting', Exec) {

autofill/autofill-store/schemas/com.duckduckgo.autofill.store.AutofillDatabase/2.json renamed to autofill/autofill-impl/schemas/com.duckduckgo.autofill.store.AutofillDatabase/3.json

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11
{
22
"formatVersion": 1,
33
"database": {
4-
"version": 2,
5-
"identityHash": "025eaf40dbcd2c5d766b24582f9babdb",
4+
"version": 3,
5+
"identityHash": "6e4ce864e6a439ea004eb5e040763b1f",
66
"entities": [
7-
{
8-
"tableName": "autofill_exceptions",
9-
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`domain` TEXT NOT NULL, `reason` TEXT NOT NULL, PRIMARY KEY(`domain`))",
10-
"fields": [
11-
{
12-
"fieldPath": "domain",
13-
"columnName": "domain",
14-
"affinity": "TEXT",
15-
"notNull": true
16-
},
17-
{
18-
"fieldPath": "reason",
19-
"columnName": "reason",
20-
"affinity": "TEXT",
21-
"notNull": true
22-
}
23-
],
24-
"primaryKey": {
25-
"autoGenerate": false,
26-
"columnNames": [
27-
"domain"
28-
]
29-
},
30-
"indices": [],
31-
"foreignKeys": []
32-
},
337
{
348
"tableName": "credentials_sync_meta",
359
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`syncId` TEXT NOT NULL, `localId` INTEGER NOT NULL, `deleted_at` TEXT, `modified_at` TEXT, PRIMARY KEY(`localId`))",
@@ -82,7 +56,7 @@
8256
"views": [],
8357
"setupQueries": [
8458
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
85-
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '025eaf40dbcd2c5d766b24582f9babdb')"
59+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '6e4ce864e6a439ea004eb5e040763b1f')"
8660
]
8761
}
8862
}
Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"formatVersion": 1,
33
"database": {
4-
"version": 3,
5-
"identityHash": "6d7867da68af318934933f9a3133ced0",
4+
"version": 5,
5+
"identityHash": "0323e58313087918319e41165a1814a6",
66
"entities": [
77
{
88
"tableName": "website_login_credentials",
9-
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `domain` TEXT, `username` TEXT, `password` TEXT, `passwordIv` TEXT, `notes` TEXT, `notesIv` TEXT, `domainTitle` TEXT, `lastUpdatedInMillis` INTEGER)",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `domain` TEXT, `username` TEXT, `password` TEXT, `passwordIv` TEXT, `notes` TEXT, `notesIv` TEXT, `domainTitle` TEXT, `lastUpdatedInMillis` INTEGER, `lastUsedInMillis` INTEGER)",
1010
"fields": [
1111
{
1212
"fieldPath": "id",
@@ -61,22 +61,64 @@
6161
"columnName": "lastUpdatedInMillis",
6262
"affinity": "INTEGER",
6363
"notNull": false
64+
},
65+
{
66+
"fieldPath": "lastUsedInMillis",
67+
"columnName": "lastUsedInMillis",
68+
"affinity": "INTEGER",
69+
"notNull": false
6470
}
6571
],
6672
"primaryKey": {
73+
"autoGenerate": true,
6774
"columnNames": [
6875
"id"
69-
],
70-
"autoGenerate": true
76+
]
7177
},
7278
"indices": [],
7379
"foreignKeys": []
80+
},
81+
{
82+
"tableName": "never_saved_sites",
83+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `domain` TEXT)",
84+
"fields": [
85+
{
86+
"fieldPath": "id",
87+
"columnName": "id",
88+
"affinity": "INTEGER",
89+
"notNull": true
90+
},
91+
{
92+
"fieldPath": "domain",
93+
"columnName": "domain",
94+
"affinity": "TEXT",
95+
"notNull": false
96+
}
97+
],
98+
"primaryKey": {
99+
"autoGenerate": true,
100+
"columnNames": [
101+
"id"
102+
]
103+
},
104+
"indices": [
105+
{
106+
"name": "index_never_saved_sites_domain",
107+
"unique": true,
108+
"columnNames": [
109+
"domain"
110+
],
111+
"orders": [],
112+
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_never_saved_sites_domain` ON `${TABLE_NAME}` (`domain`)"
113+
}
114+
],
115+
"foreignKeys": []
74116
}
75117
],
76118
"views": [],
77119
"setupQueries": [
78120
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
79-
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '6d7867da68af318934933f9a3133ced0')"
121+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '0323e58313087918319e41165a1814a6')"
80122
]
81123
}
82124
}
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,35 @@
22
"formatVersion": 1,
33
"database": {
44
"version": 1,
5-
"identityHash": "a58b879e646ff3c65d5a2cd977ddd177",
5+
"identityHash": "5b095ae2906214905cfb733c43c9f6e9",
66
"entities": [
77
{
8-
"tableName": "emailInContext_exceptions",
9-
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`domain` TEXT NOT NULL, `reason` TEXT NOT NULL, PRIMARY KEY(`domain`))",
8+
"tableName": "autofill_engagement",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`date` TEXT NOT NULL, `autofilled` INTEGER NOT NULL, `searched` INTEGER NOT NULL, PRIMARY KEY(`date`))",
1010
"fields": [
1111
{
12-
"fieldPath": "domain",
13-
"columnName": "domain",
12+
"fieldPath": "date",
13+
"columnName": "date",
1414
"affinity": "TEXT",
1515
"notNull": true
1616
},
1717
{
18-
"fieldPath": "reason",
19-
"columnName": "reason",
20-
"affinity": "TEXT",
18+
"fieldPath": "autofilled",
19+
"columnName": "autofilled",
20+
"affinity": "INTEGER",
21+
"notNull": true
22+
},
23+
{
24+
"fieldPath": "searched",
25+
"columnName": "searched",
26+
"affinity": "INTEGER",
2127
"notNull": true
2228
}
2329
],
2430
"primaryKey": {
2531
"autoGenerate": false,
2632
"columnNames": [
27-
"domain"
33+
"date"
2834
]
2935
},
3036
"indices": [],
@@ -34,7 +40,7 @@
3440
"views": [],
3541
"setupQueries": [
3642
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
37-
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'a58b879e646ff3c65d5a2cd977ddd177')"
43+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '5b095ae2906214905cfb733c43c9f6e9')"
3844
]
3945
}
4046
}

autofill/autofill-store/schemas/com.duckduckgo.securestorage.store.db.SecureStorageDatabase/1.json renamed to autofill/autofill-impl/schemas/com.duckduckgo.autofill.store.targets.DomainTargetAppsDatabase/1.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"formatVersion": 1,
33
"database": {
44
"version": 1,
5-
"identityHash": "6eff46e8b88d118afafca4fbadf6620f",
5+
"identityHash": "2b3b7a84576e125ceeb7d62532b4e0ff",
66
"entities": [
77
{
8-
"tableName": "website_login_credentials",
9-
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `domain` TEXT, `username` TEXT, `password` TEXT, `iv` TEXT)",
8+
"tableName": "autofill_domain_target_apps_mapping",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `domain` TEXT NOT NULL, `dataExpiryInMillis` INTEGER NOT NULL, `app_package` TEXT NOT NULL, `app_fingerprint` TEXT NOT NULL)",
1010
"fields": [
1111
{
1212
"fieldPath": "id",
@@ -18,32 +18,32 @@
1818
"fieldPath": "domain",
1919
"columnName": "domain",
2020
"affinity": "TEXT",
21-
"notNull": false
21+
"notNull": true
2222
},
2323
{
24-
"fieldPath": "username",
25-
"columnName": "username",
26-
"affinity": "TEXT",
27-
"notNull": false
24+
"fieldPath": "dataExpiryInMillis",
25+
"columnName": "dataExpiryInMillis",
26+
"affinity": "INTEGER",
27+
"notNull": true
2828
},
2929
{
30-
"fieldPath": "password",
31-
"columnName": "password",
30+
"fieldPath": "targetApp.packageName",
31+
"columnName": "app_package",
3232
"affinity": "TEXT",
33-
"notNull": false
33+
"notNull": true
3434
},
3535
{
36-
"fieldPath": "iv",
37-
"columnName": "iv",
36+
"fieldPath": "targetApp.sha256CertFingerprints",
37+
"columnName": "app_fingerprint",
3838
"affinity": "TEXT",
39-
"notNull": false
39+
"notNull": true
4040
}
4141
],
4242
"primaryKey": {
43+
"autoGenerate": true,
4344
"columnNames": [
4445
"id"
45-
],
46-
"autoGenerate": true
46+
]
4747
},
4848
"indices": [],
4949
"foreignKeys": []
@@ -52,7 +52,7 @@
5252
"views": [],
5353
"setupQueries": [
5454
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
55-
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '6eff46e8b88d118afafca4fbadf6620f')"
55+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2b3b7a84576e125ceeb7d62532b4e0ff')"
5656
]
5757
}
5858
}

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/securestorage/RealSecureStorageRepositoryFactory.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package com.duckduckgo.autofill.impl.securestorage
1818

19+
import com.duckduckgo.autofill.store.RealSecureStorageRepository
20+
import com.duckduckgo.autofill.store.SecureStorageRepository
21+
import com.duckduckgo.autofill.store.db.SecureStorageDatabase
1922
import com.duckduckgo.di.scopes.AppScope
20-
import com.duckduckgo.securestorage.store.RealSecureStorageRepository
21-
import com.duckduckgo.securestorage.store.SecureStorageRepository
22-
import com.duckduckgo.securestorage.store.db.SecureStorageDatabase
2323
import com.squareup.anvil.annotations.ContributesBinding
2424
import javax.inject.Inject
2525
import kotlinx.coroutines.flow.firstOrNull

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/securestorage/SecureStorage.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ package com.duckduckgo.autofill.impl.securestorage
1818

1919
import com.duckduckgo.app.di.AppCoroutineScope
2020
import com.duckduckgo.autofill.impl.securestorage.encryption.EncryptionHelper.EncryptedString
21+
import com.duckduckgo.autofill.store.SecureStorageRepository
22+
import com.duckduckgo.autofill.store.db.WebsiteLoginCredentialsEntity
2123
import com.duckduckgo.common.utils.DispatcherProvider
2224
import com.duckduckgo.di.scopes.AppScope
23-
import com.duckduckgo.securestorage.store.SecureStorageRepository
24-
import com.duckduckgo.securestorage.store.db.WebsiteLoginCredentialsEntity
2525
import com.squareup.anvil.annotations.ContributesBinding
2626
import dagger.SingleInstanceIn
2727
import javax.inject.Inject

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/securestorage/SecureStorageDatabaseFactory.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ package com.duckduckgo.autofill.impl.securestorage
1919
import android.content.Context
2020
import androidx.room.Room
2121
import com.duckduckgo.autofill.api.AutofillFeature
22+
import com.duckduckgo.autofill.store.db.ALL_MIGRATIONS
23+
import com.duckduckgo.autofill.store.db.SecureStorageDatabase
2224
import com.duckduckgo.di.scopes.AppScope
23-
import com.duckduckgo.securestorage.store.db.ALL_MIGRATIONS
24-
import com.duckduckgo.securestorage.store.db.SecureStorageDatabase
2525
import com.squareup.anvil.annotations.ContributesBinding
2626
import dagger.SingleInstanceIn
2727
import javax.inject.Inject

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/securestorage/SecureStorageKeyProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ package com.duckduckgo.autofill.impl.securestorage
1919
import com.duckduckgo.autofill.api.AutofillFeature
2020
import com.duckduckgo.autofill.impl.securestorage.encryption.EncryptionHelper
2121
import com.duckduckgo.autofill.impl.securestorage.encryption.EncryptionHelper.EncryptedBytes
22+
import com.duckduckgo.autofill.store.SecureStorageKeyRepository
2223
import com.duckduckgo.di.scopes.AppScope
2324
import com.duckduckgo.securestorage.impl.encryption.RandomBytesGenerator
24-
import com.duckduckgo.securestorage.store.SecureStorageKeyRepository
2525
import com.squareup.anvil.annotations.ContributesBinding
2626
import java.security.Key
2727
import javax.inject.Inject

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/securestorage/di/SecureStorageModule.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import com.duckduckgo.app.di.AppCoroutineScope
2121
import com.duckduckgo.autofill.api.AutofillFeature
2222
import com.duckduckgo.autofill.impl.securestorage.DerivedKeySecretFactory
2323
import com.duckduckgo.autofill.impl.securestorage.RealDerivedKeySecretFactory
24+
import com.duckduckgo.autofill.store.RealSecureStorageKeyRepository
25+
import com.duckduckgo.autofill.store.SecureStorageKeyRepository
26+
import com.duckduckgo.autofill.store.keys.RealSecureStorageKeyStore
2427
import com.duckduckgo.common.utils.DispatcherProvider
2528
import com.duckduckgo.di.scopes.AppScope
26-
import com.duckduckgo.securestorage.store.RealSecureStorageKeyRepository
27-
import com.duckduckgo.securestorage.store.SecureStorageKeyRepository
28-
import com.duckduckgo.securestorage.store.keys.RealSecureStorageKeyStore
2929
import com.squareup.anvil.annotations.ContributesTo
3030
import dagger.Module
3131
import dagger.Provides

autofill/autofill-store/src/main/java/com/duckduckgo/autofill/store/AutofillDatabase.kt renamed to autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/store/AutofillDatabase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 DuckDuckGo
2+
* Copyright (c) 2025 DuckDuckGo
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

autofill/autofill-store/src/main/java/com/duckduckgo/autofill/store/AutofillPrefsStore.kt renamed to autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/store/AutofillPrefsStore.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022 DuckDuckGo
2+
* Copyright (c) 2025 DuckDuckGo
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package com.duckduckgo.autofill.store
1818

19+
import android.annotation.SuppressLint
1920
import android.content.Context
2021
import android.content.SharedPreferences
2122
import androidx.core.content.edit
@@ -47,6 +48,7 @@ interface AutofillPrefsStore {
4748
fun resetAllValues()
4849
}
4950

51+
@SuppressLint("DenyListedApi")
5052
class RealAutofillPrefsStore(
5153
private val applicationContext: Context,
5254
private val defaultStateDecider: AutofillDefaultStateDecider,

0 commit comments

Comments
 (0)