diff options
5 files changed, 5 insertions, 31 deletions
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java index f0737566fd66..24dbce49eace 100644 --- a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java +++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java @@ -128,18 +128,14 @@ public class RecoverableKeyStoreManager { public static synchronized RecoverableKeyStoreManager getInstance(Context context) { if (mInstance == null) { - RecoverableKeyStoreDb db; + RecoverableKeyStoreDb db = RecoverableKeyStoreDb.newInstance(context); RemoteLockscreenValidationSessionStorage lockscreenCheckSessions; if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_ENABLE_LOCKSCREEN_TRANSFER_API)) { - // TODO(b/254335492): Remove flag check when feature is launched. - db = RecoverableKeyStoreDb.newInstance(context, 7); lockscreenCheckSessions = new RemoteLockscreenValidationSessionStorage(); } else { - db = RecoverableKeyStoreDb.newInstance(context); lockscreenCheckSessions = null; } - PlatformKeyManager platformKeyManager; ApplicationKeyStorage applicationKeyStorage; try { diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDb.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDb.java index 4a17e9a9242e..d881769ca380 100644 --- a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDb.java +++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDb.java @@ -78,18 +78,6 @@ public class RecoverableKeyStoreDb { return new RecoverableKeyStoreDb(helper); } - /** - * A new instance, storing the database in the user directory of {@code context}. - * - * @hide - */ - public static RecoverableKeyStoreDb newInstance(Context context, int version) { - RecoverableKeyStoreDbHelper helper = new RecoverableKeyStoreDbHelper(context, version); - helper.setWriteAheadLoggingEnabled(true); - helper.setIdleConnectionTimeout(IDLE_TIMEOUT_SECONDS); - return new RecoverableKeyStoreDb(helper); - } - private RecoverableKeyStoreDb(RecoverableKeyStoreDbHelper keyStoreDbHelper) { this.mKeyStoreDbHelper = keyStoreDbHelper; this.mTestOnlyInsecureCertificateHelper = new TestOnlyInsecureCertificateHelper(); diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelper.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelper.java index 0e5e55c2d7b0..386655ae41d0 100644 --- a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelper.java +++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelper.java @@ -34,7 +34,6 @@ class RecoverableKeyStoreDbHelper extends SQLiteOpenHelper { private static final String TAG = "RecoverableKeyStoreDbHp"; // v6 - added user id serial number. - static final int DATABASE_VERSION = 6; // v7 - added bad guess counter for remote LSKF check; static final int DATABASE_VERSION_7 = 7; private static final String DATABASE_NAME = "recoverablekeystore.db"; @@ -118,23 +117,14 @@ class RecoverableKeyStoreDbHelper extends SQLiteOpenHelper { super(context, DATABASE_NAME, null, getDbVersion(context)); } - RecoverableKeyStoreDbHelper(Context context, int version) { - super(context, DATABASE_NAME, null, version); - } - private static int getDbVersion(Context context) { - // TODO(b/254335492): Update to version 7 and clean up code. - return DATABASE_VERSION; + return DATABASE_VERSION_7; } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(SQL_CREATE_KEYS_ENTRY); - if (db.getVersion() == 6) { // always false - db.execSQL(SQL_CREATE_USER_METADATA_ENTRY); - } else { - db.execSQL(SQL_CREATE_USER_METADATA_ENTRY_FOR_V7); - } + db.execSQL(SQL_CREATE_USER_METADATA_ENTRY_FOR_V7); db.execSQL(SQL_CREATE_RECOVERY_SERVICE_METADATA_ENTRY); db.execSQL(SQL_CREATE_ROOT_OF_TRUST_ENTRY); } diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java index 2a9c18c55035..bbd9223718ae 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java @@ -104,7 +104,7 @@ public class RecoverableKeyStoreDbHelperTest { @Before public void setUp() throws Exception { Context context = InstrumentationRegistry.getTargetContext(); - mDatabaseHelper = new RecoverableKeyStoreDbHelper(context, 7); + mDatabaseHelper = new RecoverableKeyStoreDbHelper(context); mDatabase = SQLiteDatabase.create(null); } diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java index e223a97d53f7..8bc14fc54ae1 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java @@ -67,7 +67,7 @@ public class RecoverableKeyStoreDbTest { public void setUp() { Context context = InstrumentationRegistry.getTargetContext(); mDatabaseFile = context.getDatabasePath(DATABASE_FILE_NAME); - mRecoverableKeyStoreDb = RecoverableKeyStoreDb.newInstance(context, 7); + mRecoverableKeyStoreDb = RecoverableKeyStoreDb.newInstance(context); } @After |