Verify and reset invalid battery setting in the data restore stage
Verify and reset invalid battery setting configuration in the data restore stage to avoid resoring invalid configuration from other devices Bug: 258243197 Test: make RunSettingsRoboTests Change-Id: I1a0febd2ad527147e4e9e9c77734c4b51963263a
This commit is contained in:
@@ -51,6 +51,7 @@ import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import com.android.settings.TestUtils;
|
||||
import com.android.settings.fuelgauge.BatteryOptimizeHistoricalLogEntry.Action;
|
||||
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
|
||||
|
||||
@@ -290,6 +291,16 @@ public final class BatteryBackupHelperTest {
|
||||
assertThat(captor.getValue().length).isEqualTo(dataSize);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void restoreEntity_verifyConfiguration() {
|
||||
final int invalidScheduledLevel = 5;
|
||||
TestUtils.setScheduledLevel(mContext, invalidScheduledLevel);
|
||||
|
||||
mBatteryBackupHelper.restoreEntity(mBackupDataInputStream);
|
||||
|
||||
assertThat(TestUtils.getScheduledLevel(mContext)).isNotEqualTo(invalidScheduledLevel);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void restoreOptimizationMode_nullBytesData_skipRestore() throws Exception {
|
||||
mBatteryBackupHelper.restoreOptimizationMode(new byte[0]);
|
||||
|
Reference in New Issue
Block a user