• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.launcher3.util;
2 
3 import android.content.Context;
4 import android.content.ContextWrapper;
5 import android.database.DatabaseErrorHandler;
6 import android.database.sqlite.SQLiteDatabase;
7 import android.database.sqlite.SQLiteDatabase.CursorFactory;
8 
9 /**
10  * A context wrapper which creates databases without support for localized collators.
11  */
12 public class NoLocaleSqliteContext extends ContextWrapper {
13 
14     // TODO: Use the flag defined in Context when the new SDK is available
15     private static final int MODE_NO_LOCALIZED_COLLATORS = 0x0010;
16 
NoLocaleSqliteContext(Context context)17     public NoLocaleSqliteContext(Context context) {
18         super(context);
19     }
20 
21     @Override
openOrCreateDatabase( String name, int mode, CursorFactory factory, DatabaseErrorHandler errorHandler)22     public SQLiteDatabase openOrCreateDatabase(
23             String name, int mode, CursorFactory factory, DatabaseErrorHandler errorHandler) {
24         return super.openOrCreateDatabase(
25                 name, mode | MODE_NO_LOCALIZED_COLLATORS, factory, errorHandler);
26     }
27 }
28