Merge "Hide BatteryManagerPreference if there is no adaptive charging" into udc-dev am: 4f98350ba3 am: 78be1d4dee
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/21736487 Change-Id: Ibffa6745725db3cca8d4005b0d3c1a5f842f5fae Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -61,12 +61,6 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailabilityStatus_unsupportedWhenSet() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertClassPathToComponentName_nullInput_returnsNull() {
|
||||
assertThat(mController.convertClassPathToComponentName(null)).isNull();
|
||||
@@ -118,4 +112,4 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
assertThat(mController.getSummary())
|
||||
.isEqualTo(mContext.getString(R.string.battery_missing_message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ public class BatteryManagerPreferenceControllerTest {
|
||||
@Test
|
||||
public void getAvailabilityStatus_supportBatteryManager_showPrefPage() {
|
||||
when(mPowerUsageFeatureProvider.isBatteryManagerSupported()).thenReturn(true);
|
||||
when(mPowerUsageFeatureProvider.isAdaptiveChargingSupported()).thenReturn(true);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BatteryManagerPreferenceController.AVAILABLE_UNSEARCHABLE);
|
||||
@@ -98,4 +99,13 @@ public class BatteryManagerPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BatteryManagerPreferenceController.UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_supportBatteryManagerWithoutAC_notShowPrefPage() {
|
||||
when(mPowerUsageFeatureProvider.isBatteryManagerSupported()).thenReturn(true);
|
||||
when(mPowerUsageFeatureProvider.isAdaptiveChargingSupported()).thenReturn(false);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BatteryManagerPreferenceController.UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user