Merge "Adopt robolectric 3.6.1"

This commit is contained in:
TreeHugger Robot
2018-01-13 11:32:30 +00:00
committed by Android (Google) Code Review
8 changed files with 55 additions and 78 deletions

View File

@@ -20,6 +20,8 @@ import android.content.Context;
import com.android.internal.os.BatteryStatsHelper;
import com.android.settingslib.utils.AsyncLoader;
import com.android.internal.annotations.VisibleForTesting;
/**
* Loader that can be used by classes to load BatteryInfo in a background thread. This loader will
* automatically grab enhanced battery estimates if available or fall back to the system estimate
@@ -30,9 +32,13 @@ public class BatteryInfoLoader extends AsyncLoader<BatteryInfo>{
BatteryStatsHelper mStatsHelper;
private static final String LOG_TAG = "BatteryInfoLoader";
@VisibleForTesting
BatteryUtils batteryUtils;
public BatteryInfoLoader(Context context, BatteryStatsHelper batteryStatsHelper) {
super(context);
mStatsHelper = batteryStatsHelper;
batteryUtils = BatteryUtils.getInstance(context);
}
@Override
@@ -42,7 +48,6 @@ public class BatteryInfoLoader extends AsyncLoader<BatteryInfo>{
@Override
public BatteryInfo loadInBackground() {
final BatteryUtils batteryUtils = BatteryUtils.getInstance(getContext());
return batteryUtils.getBatteryInfo(mStatsHelper, LOG_TAG);
}
}

View File

@@ -136,7 +136,7 @@ public class SlicesDatabaseHelper extends SQLiteOpenHelper {
mContext.getSharedPreferences(SHARED_PREFS_TAG, Context.MODE_PRIVATE)
.edit()
.clear()
.commit();
.apply();
dropTables(db);
createDatabases(db);
}