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
parent 822a6bc976
commit 7a440a1f47

View File

@ -206,8 +206,19 @@ public class TabsProvider extends ContentProvider {
if (dbHelper != null) {
return dbHelper;
}
dbHelper = new DatabaseHelper(getContext(), getDatabasePath(profile));
String databasePath = getDatabasePath(profile);
dbHelper = new DatabaseHelper(getContext(), databasePath);
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);