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:
ykhung
2022-11-11 13:46:49 +08:00
committed by YK Hung
parent df25b72044
commit d66fd82c35
5 changed files with 64 additions and 9 deletions

View File

@@ -88,6 +88,7 @@ public final class BatteryBackupHelper implements BackupHelper {
@Override
public void restoreEntity(BackupDataInputStream data) {
BatterySettingsMigrateChecker.verifyConfiguration(mContext);
if (!isOwner() || data == null || data.size() == 0) {
Log.w(TAG, "ignore restoreEntity() for non-owner or empty data");
return;