mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 768532 - Use profile database path on Android 2.2. r=lucasr,gbrown
This commit is contained in:
parent
a28afc521c
commit
dd04fd27b6
@ -1675,16 +1675,20 @@ public class BrowserProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
String databasePath = getDatabasePath(profile, isTest);
|
||||
|
||||
// Before bug 768532, the database was located outside if the
|
||||
// profile on Android 2.2. Make sure it is moved inside the profile
|
||||
// directory.
|
||||
if (Build.VERSION.SDK_INT == 8) {
|
||||
File oldPath = mContext.getDatabasePath("browser-" + profile + ".db");
|
||||
if (oldPath.exists()) {
|
||||
oldPath.renameTo(new File(databasePath));
|
||||
}
|
||||
}
|
||||
|
||||
dbHelper = new DatabaseHelper(getContext(), databasePath);
|
||||
mDatabasePerProfile.put(profile, dbHelper);
|
||||
|
||||
// When running inside a test or 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 (isTest || Build.VERSION.SDK_INT <= 8) {
|
||||
databasePath = mContext.getDatabasePath(databasePath).getAbsolutePath();
|
||||
}
|
||||
|
||||
DBUtils.ensureDatabaseIsNotLocked(dbHelper, databasePath);
|
||||
}
|
||||
|
||||
@ -1695,13 +1699,8 @@ public class BrowserProvider extends ContentProvider {
|
||||
public String getDatabasePath(String profile, boolean isTest) {
|
||||
trace("Getting database path for profile: " + profile);
|
||||
|
||||
// On Android releases older than 2.3, it's not possible to use
|
||||
// SQLiteOpenHelper with a full path. Fallback to using separate
|
||||
// db files per profile in the app directory.
|
||||
if (isTest) {
|
||||
return DATABASE_NAME;
|
||||
} else if(Build.VERSION.SDK_INT <= 8) {
|
||||
return "browser-" + profile + ".db";
|
||||
}
|
||||
|
||||
File profileDir = GeckoProfile.get(mContext, profile).getDir();
|
||||
|
@ -236,16 +236,20 @@ public class TabsProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
String databasePath = getDatabasePath(profile);
|
||||
|
||||
// Before bug 768532, the database was located outside if the
|
||||
// profile on Android 2.2. Make sure it is moved inside the profile
|
||||
// directory.
|
||||
if (Build.VERSION.SDK_INT == 8) {
|
||||
File oldPath = mContext.getDatabasePath("tabs-" + profile + ".db");
|
||||
if (oldPath.exists()) {
|
||||
oldPath.renameTo(new File(databasePath));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -256,13 +260,6 @@ public class TabsProvider extends ContentProvider {
|
||||
private String getDatabasePath(String profile) {
|
||||
trace("Getting database path for profile: " + profile);
|
||||
|
||||
// On Android releases older than 2.3, it's not possible to use
|
||||
// SQLiteOpenHelper with a full path. Fallback to using separate
|
||||
// db files per profile in the app directory.
|
||||
if (Build.VERSION.SDK_INT <= 8) {
|
||||
return "tabs-" + profile + ".db";
|
||||
}
|
||||
|
||||
File profileDir = GeckoProfile.get(mContext, profile).getDir();
|
||||
if (profileDir == null) {
|
||||
debug("Couldn't find directory for profile: " + profile);
|
||||
|
Loading…
Reference in New Issue
Block a user