fix DatabaseIndexingManagerTest hanging in tests

Test: make RunSettingsRoboTests -j40
Change-Id: I755c04daadcb8804d97f72521d84573d80b4ff19
This commit is contained in:
jeffreyhuang
2017-12-01 10:14:24 -08:00
parent 7ec34c1781
commit 387bffcd46
2 changed files with 3 additions and 2 deletions

View File

@@ -293,7 +293,8 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper {
}
static void setBuildIndexed(Context context, String buildNo) {
context.getSharedPreferences(SHARED_PREFS_TAG, 0).edit().putBoolean(buildNo, true).commit();
// Use #apply() instead of #commit() since #commit() Robolectric loop indefinitely in sdk 26
context.getSharedPreferences(SHARED_PREFS_TAG, 0).edit().putBoolean(buildNo, true).apply();
}
private void dropTables(SQLiteDatabase db) {