Fix regression of wrong min value on night display slice
The min value of NightDisplayIntensityPreferenceController should always be 0 (which is the old value we used before ag/7062353). The range is cacluated from the relative value to MinimumColorTemperature, which means the min value should always be 0. Test: atest NightDisplayIntensityPreferenceControllerTest Fixes:130758028 Change-Id: Ica75672dda6a9ee0c6013f1c903611263b7d133f
This commit is contained in:
@@ -82,7 +82,8 @@ public class NightDisplayIntensityPreferenceController extends SliderPreferenceC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMin() {
|
public int getMin() {
|
||||||
return ColorDisplayManager.getMinimumColorTemperature(mContext);
|
// The min should always be 0 in this case.
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -84,11 +84,25 @@ public class NightDisplayIntensityPreferenceControllerTest {
|
|||||||
.isEqualTo(3030);
|
.isEqualTo(3030);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void rangeOfSlider_staysWithinValidRange() {
|
||||||
|
SettingsShadowResources.overrideResource(
|
||||||
|
com.android.internal.R.integer.config_nightDisplayColorTemperatureMin, 2950);
|
||||||
|
SettingsShadowResources.overrideResource(
|
||||||
|
com.android.internal.R.integer.config_nightDisplayColorTemperatureMax, 3050);
|
||||||
|
|
||||||
|
assertThat(mPreferenceController.getMax() - mPreferenceController.getMin())
|
||||||
|
.isGreaterThan(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getMin_alwaysReturnsZero() {
|
||||||
|
assertThat(mPreferenceController.getMin()).isEqualTo(0);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isSliceableCorrectKey_returnsTrue() {
|
public void isSliceableCorrectKey_returnsTrue() {
|
||||||
final NightDisplayIntensityPreferenceController controller =
|
assertThat(mPreferenceController.isSliceable()).isTrue();
|
||||||
new NightDisplayIntensityPreferenceController(mContext, "night_display_temperature");
|
|
||||||
assertThat(controller.isSliceable()).isTrue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user