Check if boxes still available when restoring state

Apparently when the device is idle long enough the system will clean
up the dialog view for the hotspot band preference. This will cause
restore state to fail once it decides to pause the activity. To avoid
this we should make sure the boxes are not null.

Test: robotest
Bug: 78445411
Change-Id: I2a82b01f894f62be6c5209c78faddc4089aa6301
This commit is contained in:
Salvador Martinez
2018-04-23 16:52:25 -07:00
parent ac951a69aa
commit be6a844a06
2 changed files with 17 additions and 2 deletions

View File

@@ -118,8 +118,8 @@ public class HotspotApBandSelectionPreference extends CustomDialogPreference imp
SavedState myState = new SavedState(superState);
myState.shouldRestore = getDialog() != null;
myState.enabled2G = mBox2G.isChecked();
myState.enabled5G = mBox5G.isChecked();
myState.enabled2G = mBox2G != null && mBox2G.isChecked();
myState.enabled5G = mBox5G != null && mBox5G.isChecked();
return myState;
}