Reindex on OTA and locale change
When the user gets an OTA or changes language, settings will clear the database and reindex it. Test: make RunSettingsRoboTests Change-Id: I379ece86b2d41d673bbbffbcf947774f3ccd4cb9 Fixes: 36859162
This commit is contained in:
@@ -245,7 +245,7 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static void clearLocalesIndexed(Context context) {
|
||||
public static void clearCachedIndexed(Context context) {
|
||||
context.getSharedPreferences(INDEX, 0).edit().clear().commit();
|
||||
}
|
||||
|
||||
@@ -257,8 +257,16 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper {
|
||||
return context.getSharedPreferences(INDEX, 0).getBoolean(locale, false);
|
||||
}
|
||||
|
||||
public static boolean isBuildIndexed(Context context, String buildNo) {
|
||||
return context.getSharedPreferences(INDEX, 0).getBoolean(buildNo, false);
|
||||
}
|
||||
|
||||
public static void setBuildIndexed(Context context, String buildNo) {
|
||||
context.getSharedPreferences(INDEX, 0).edit().putBoolean(buildNo, true).commit();
|
||||
}
|
||||
|
||||
private void dropTables(SQLiteDatabase db) {
|
||||
clearLocalesIndexed(mContext);
|
||||
clearCachedIndexed(mContext);
|
||||
db.execSQL("DROP TABLE IF EXISTS " + Tables.TABLE_META_INDEX);
|
||||
db.execSQL("DROP TABLE IF EXISTS " + Tables.TABLE_PREFS_INDEX);
|
||||
db.execSQL("DROP TABLE IF EXISTS " + Tables.TABLE_SAVED_QUERIES);
|
||||
|
||||
Reference in New Issue
Block a user