Fix Settings app crash cause by BadParcelableException

Bug: 279391146
Test: make SettingsLibRoboTests
Change-Id: I32dd0aa87c405786fe28b15721e4edbcb4d73a98
This commit is contained in:
Wesley Wang
2023-04-25 17:49:12 +08:00
parent a958fc79c8
commit a4bafafb21
3 changed files with 45 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.fuelgauge.batterytip.tips;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.os.Parcel;
import android.util.Log;
import androidx.preference.Preference;
@@ -43,6 +44,10 @@ public class DockDefenderTip extends BatteryTip {
mMode = mode;
}
private DockDefenderTip(Parcel in) {
super(in);
}
public int getMode() {
return mMode;
}
@@ -157,4 +162,14 @@ public class DockDefenderTip extends BatteryTip {
Log.i(TAG, "send resume charging broadcast intent=" + intent);
}
public static final Creator CREATOR = new Creator() {
public BatteryTip createFromParcel(Parcel in) {
return new DockDefenderTip(in);
}
public BatteryTip[] newArray(int size) {
return new DockDefenderTip[size];
}
};
}