Merge "Add protection for the BadParcelableException" into udc-dev am: 54f39ec271
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23279576 Change-Id: Ic0b1e0cd1ceeea19b5539da15e189806dfe25565 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -18,7 +18,9 @@ package com.android.settings.fuelgauge.batterytip;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.os.BadParcelableException;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
@@ -142,14 +144,26 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
|
||||
}
|
||||
|
||||
public void restoreInstanceState(Bundle bundle) {
|
||||
if (bundle != null) {
|
||||
if (bundle == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
List<BatteryTip> batteryTips = bundle.getParcelableArrayList(KEY_BATTERY_TIPS);
|
||||
updateBatteryTips(batteryTips);
|
||||
} catch (BadParcelableException e) {
|
||||
Log.e(TAG, "failed to invoke restoreInstanceState()", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveInstanceState(Bundle outState) {
|
||||
outState.putParcelableList(KEY_BATTERY_TIPS, mBatteryTips);
|
||||
public void saveInstanceState(Bundle bundle) {
|
||||
if (bundle == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
bundle.putParcelableList(KEY_BATTERY_TIPS, mBatteryTips);
|
||||
} catch (BadParcelableException e) {
|
||||
Log.e(TAG, "failed to invoke saveInstanceState()", e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean needUpdate() {
|
||||
|
Reference in New Issue
Block a user