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

Commit 1bc8fc3d authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Creating database without localized collators on NYC and above" into ub-launcher3-calgary

parents c5b31965 bf67f3b1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.launcher3.compat.UserHandleCompat;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.util.ManagedProfileHeuristic;
import com.android.launcher3.util.NoLocaleSqliteContext;
import com.android.launcher3.util.Thunk;

import java.net.URISyntaxException;
@@ -526,7 +527,8 @@ public class LauncherProvider extends ContentProvider {
        private long mMaxScreenId = -1;

        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;
            mProvider = provider;

@@ -556,7 +558,7 @@ public class LauncherProvider extends ContentProvider {
         * Constructor used only in tests.
         */
        public DatabaseHelper(Context context, LauncherProvider provider, String tableName) {
            super(context, tableName, null, DATABASE_VERSION);
            super(new NoLocaleSqliteContext(context), tableName, null, DATABASE_VERSION);
            mContext = context;
            mProvider = provider;

+27 −0
Original line number Diff line number Diff line
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);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ public abstract class SQLiteCacheHelper {
    private class MySQLiteOpenHelper extends SQLiteOpenHelper {

        public MySQLiteOpenHelper(Context context, String name, int version) {
            super(context, name, null, version);
            super(new NoLocaleSqliteContext(context), name, null, version);
        }

        @Override