Update battery saver schedule to show warning

If a user tries to enable a battery saver schedule we want
to show them the battery saver warning if they haven't seen it.
This CL does that.

Test: robotests pass, manual verification
Bug: 128924009
Change-Id: I683279716ac7700043b1a01f88bdf2ae716eeece
This commit is contained in:
Salvador Martinez
2019-03-26 15:14:46 -07:00
parent 12256ca49f
commit c4d86b081b
2 changed files with 40 additions and 18 deletions

View File

@@ -7,6 +7,7 @@ import android.content.Context;
import android.os.PowerManager;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.provider.Settings.Secure;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -54,4 +55,13 @@ public class BatterySaverScheduleRadioButtonsControllerTest {
assertThat(mController.getDefaultKey())
.isEqualTo(BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE);
}
@Test
public void setDefaultKey_any_defaultsToNoScheduleIfWarningNotSeen() {
Secure.putString(
mContext.getContentResolver(), Secure.LOW_POWER_WARNING_ACKNOWLEDGED, "null");
mController.setDefaultKey(BatterySaverScheduleRadioButtonsController.KEY_ROUTINE);
assertThat(mController.getDefaultKey())
.isEqualTo(BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE);
}
}