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:
@@ -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;
|
||||
|
@@ -31,7 +31,14 @@ public final class BatterySettingsMigrateChecker extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
verifySaverConfiguration(context.getApplicationContext());
|
||||
if (intent != null && Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
||||
verifyConfiguration(context);
|
||||
}
|
||||
}
|
||||
|
||||
static void verifyConfiguration(Context context) {
|
||||
context = context.getApplicationContext();
|
||||
verifySaverConfiguration(context);
|
||||
}
|
||||
|
||||
private static void verifySaverConfiguration(Context context) {
|
||||
|
Reference in New Issue
Block a user