Fix Java crash problem

- Returns the BaseSavedState.EMPTY_STATE to avoid the exception.

Fixes: 312585313
Test: manual test
Change-Id: If21ca5e914a5ee5aff3fbeeee9595bb77a8fc3d0
This commit is contained in:
sunnyshao
2023-12-14 17:21:25 +08:00
parent 303abbc3cc
commit 40d9abb773

View File

@@ -81,7 +81,8 @@ public class SpinnerPreference extends Preference {
return;
}
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
// To avoid the IllegalArgumentException, return the BaseSavedState.EMPTY_STATE.
super.onRestoreInstanceState(BaseSavedState.EMPTY_STATE);
return;
}
SavedState savedState = (SavedState) state;