Bug 741224 - Force unlock on tabs.db file when database is opened in read-only mode (r=blassey)

This commit is contained in:
Lucas Rocha 2012-04-25 17:24:48 -04:00
Родитель 220c51d4be
Коммит af531971c9
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -206,8 +206,19 @@ public class TabsProvider extends ContentProvider {
if (dbHelper != null) { if (dbHelper != null) {
return dbHelper; return dbHelper;
} }
dbHelper = new DatabaseHelper(getContext(), getDatabasePath(profile));
String databasePath = getDatabasePath(profile);
dbHelper = new DatabaseHelper(getContext(), databasePath);
mDatabasePerProfile.put(profile, dbHelper); mDatabasePerProfile.put(profile, dbHelper);
// When running on Android releases older than 8, the returned
// database path is just filename, not the full path. We need
// the full path when unlocking the database.
if (Build.VERSION.SDK_INT <= 8) {
databasePath = mContext.getDatabasePath(databasePath).getAbsolutePath();
}
DBUtils.ensureDatabaseIsNotLocked(dbHelper, databasePath);
} }
debug("Created database helper for profile: " + profile); debug("Created database helper for profile: " + profile);