Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15e7c62e authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Use SQLiteDatabase.deleteDatabase to delete a temp database

Deleting individual files wasn't guaranteed to work.
And with Compatibility WAL undeleted -wal file can affect the
state of the database created later.

Test: manual
Bug: 72457712
Change-Id: I1bbc3fb0d67846ceff690cbdf1268b34c71d0f4f
parent 683f590c
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ class DatabaseHelper extends SQLiteOpenHelper {

    private static final HashSet<String> mValidTables = new HashSet<String>();

    private static final String DATABASE_JOURNAL_SUFFIX = "-journal";
    private static final String DATABASE_BACKUP_SUFFIX = "-backup";

    private static final String TABLE_SYSTEM = "system";
@@ -148,12 +147,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
        }
        File databaseFile = mContext.getDatabasePath(getDatabaseName());
        if (databaseFile.exists()) {
            databaseFile.delete();
        }
        File databaseJournalFile = mContext.getDatabasePath(getDatabaseName()
                + DATABASE_JOURNAL_SUFFIX);
        if (databaseJournalFile.exists()) {
            databaseJournalFile.delete();
            SQLiteDatabase.deleteDatabase(databaseFile);
        }
    }