Get auto-battery saver threshold max from global setting

Bug: 74351418
Test: Manual test with "settings put global low_power_trigger_level_max 100"
Test: m ROBOTEST_FILTER=AutoBatterySeekBarPreferenceControllerTest RunSettingsRoboTests
Change-Id: Ice25835f36e7855e3ed665cd780d7eb1a26acd27
This commit is contained in:
Makoto Onuki
2018-03-07 14:03:55 -08:00
parent 59520b028a
commit 113e3d5cc0
2 changed files with 41 additions and 1 deletions

View File

@@ -99,4 +99,24 @@ public class AutoBatterySeekBarPreferenceControllerTest {
assertThat(Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0)).isEqualTo(TRIGGER_LEVEL);
}
@Test
public void testOnPreferenceChange_changeMax() {
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL_MAX, 50);
mController.updateState(mPreference);
assertThat(mPreference.getMax()).isEqualTo(50);
}
@Test
public void testOnPreferenceChange_noChangeMax() {
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL_MAX, 0);
mController.updateState(mPreference);
assertThat(mPreference.getMax()).isEqualTo(100);
}
}