Merge "Creating database without localized collators on NYC and above" into ub-launcher3-calgary
This commit is contained in:
@@ -54,6 +54,7 @@ import com.android.launcher3.compat.UserHandleCompat;
|
|||||||
import com.android.launcher3.compat.UserManagerCompat;
|
import com.android.launcher3.compat.UserManagerCompat;
|
||||||
import com.android.launcher3.config.ProviderConfig;
|
import com.android.launcher3.config.ProviderConfig;
|
||||||
import com.android.launcher3.util.ManagedProfileHeuristic;
|
import com.android.launcher3.util.ManagedProfileHeuristic;
|
||||||
|
import com.android.launcher3.util.NoLocaleSqliteContext;
|
||||||
import com.android.launcher3.util.Thunk;
|
import com.android.launcher3.util.Thunk;
|
||||||
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
@@ -526,7 +527,8 @@ public class LauncherProvider extends ContentProvider {
|
|||||||
private long mMaxScreenId = -1;
|
private long mMaxScreenId = -1;
|
||||||
|
|
||||||
DatabaseHelper(Context context, LauncherProvider provider) {
|
DatabaseHelper(Context context, LauncherProvider provider) {
|
||||||
super(context, LauncherFiles.LAUNCHER_DB, null, DATABASE_VERSION);
|
super(new NoLocaleSqliteContext(context), LauncherFiles.LAUNCHER_DB,
|
||||||
|
null, DATABASE_VERSION);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mProvider = provider;
|
mProvider = provider;
|
||||||
|
|
||||||
@@ -556,7 +558,7 @@ public class LauncherProvider extends ContentProvider {
|
|||||||
* Constructor used only in tests.
|
* Constructor used only in tests.
|
||||||
*/
|
*/
|
||||||
public DatabaseHelper(Context context, LauncherProvider provider, String tableName) {
|
public DatabaseHelper(Context context, LauncherProvider provider, String tableName) {
|
||||||
super(context, tableName, null, DATABASE_VERSION);
|
super(new NoLocaleSqliteContext(context), tableName, null, DATABASE_VERSION);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mProvider = provider;
|
mProvider = provider;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.android.launcher3.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.ContextWrapper;
|
||||||
|
import android.database.DatabaseErrorHandler;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A context wrapper which creates databases without support for localized collators.
|
||||||
|
*/
|
||||||
|
public class NoLocaleSqliteContext extends ContextWrapper {
|
||||||
|
|
||||||
|
// TODO: Use the flag defined in Context when the new SDK is available
|
||||||
|
private static final int MODE_NO_LOCALIZED_COLLATORS = 0x0010;
|
||||||
|
|
||||||
|
public NoLocaleSqliteContext(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SQLiteDatabase openOrCreateDatabase(
|
||||||
|
String name, int mode, CursorFactory factory, DatabaseErrorHandler errorHandler) {
|
||||||
|
return super.openOrCreateDatabase(
|
||||||
|
name, mode | MODE_NO_LOCALIZED_COLLATORS, factory, errorHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -98,7 +98,7 @@ public abstract class SQLiteCacheHelper {
|
|||||||
private class MySQLiteOpenHelper extends SQLiteOpenHelper {
|
private class MySQLiteOpenHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
public MySQLiteOpenHelper(Context context, String name, int version) {
|
public MySQLiteOpenHelper(Context context, String name, int version) {
|
||||||
super(context, name, null, version);
|
super(new NoLocaleSqliteContext(context), name, null, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user