Loading src/com/android/settings/fuelgauge/BatteryInfoLoader.java +6 −1 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -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); } } src/com/android/settings/slices/SlicesDatabaseHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading tests/robotests/Android.mk +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ LOCAL_JAVA_LIBRARIES := \ junit \ platform-robolectric-3.5.1-prebuilt \ platform-robolectric-3.6.1-prebuilt \ telephony-common LOCAL_INSTRUMENTATION_FOR := Settings Loading Loading @@ -42,4 +42,4 @@ LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src LOCAL_ROBOTEST_TIMEOUT := 36000 include prebuilts/misc/common/robolectric/3.5.1/run_robotests.mk include prebuilts/misc/common/robolectric/3.6.1/run_robotests.mk tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ public class BluetoothPairingPreferenceControllerTest { Preference pref = mController.createBluetoothPairingPreference(ORDER); assertThat(pref.getKey()).isEqualTo(BluetoothPairingPreferenceController.KEY_PAIRING); assertThat(pref.getIcon()).isEqualTo(mContext.getDrawable(R.drawable.ic_add)); assertThat(pref.getIcon()).isEqualTo(mContext.getDrawable(R.drawable.ic_menu_add)); assertThat(pref.getOrder()).isEqualTo(ORDER); assertThat(pref.getTitle()).isEqualTo( mContext.getString(R.string.bluetooth_pairing_pref_title)); Loading tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoLoaderTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public class BatteryInfoLoaderTest { @Test public void test_loadInBackground_dischargingOldEstimate_dischargingLabelNotNull() { BatteryInfoLoader loader = new BatteryInfoLoader(mContext, mHelper); loader.batteryUtils = new BatteryUtils(mContext); BatteryInfo info = loader.loadInBackground(); Loading Loading
src/com/android/settings/fuelgauge/BatteryInfoLoader.java +6 −1 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -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); } }
src/com/android/settings/slices/SlicesDatabaseHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading
tests/robotests/Android.mk +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ LOCAL_JAVA_LIBRARIES := \ junit \ platform-robolectric-3.5.1-prebuilt \ platform-robolectric-3.6.1-prebuilt \ telephony-common LOCAL_INSTRUMENTATION_FOR := Settings Loading Loading @@ -42,4 +42,4 @@ LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src LOCAL_ROBOTEST_TIMEOUT := 36000 include prebuilts/misc/common/robolectric/3.5.1/run_robotests.mk include prebuilts/misc/common/robolectric/3.6.1/run_robotests.mk
tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ public class BluetoothPairingPreferenceControllerTest { Preference pref = mController.createBluetoothPairingPreference(ORDER); assertThat(pref.getKey()).isEqualTo(BluetoothPairingPreferenceController.KEY_PAIRING); assertThat(pref.getIcon()).isEqualTo(mContext.getDrawable(R.drawable.ic_add)); assertThat(pref.getIcon()).isEqualTo(mContext.getDrawable(R.drawable.ic_menu_add)); assertThat(pref.getOrder()).isEqualTo(ORDER); assertThat(pref.getTitle()).isEqualTo( mContext.getString(R.string.bluetooth_pairing_pref_title)); Loading
tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoLoaderTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public class BatteryInfoLoaderTest { @Test public void test_loadInBackground_dischargingOldEstimate_dischargingLabelNotNull() { BatteryInfoLoader loader = new BatteryInfoLoader(mContext, mHelper); loader.batteryUtils = new BatteryUtils(mContext); BatteryInfo info = loader.loadInBackground(); Loading