Settings: Fix NPE FC when access saved wifi p2p device after screen rotation

Rotating screen, wifi p2p setting fragement will be re-created and the selected wifi p2p device will be saved in onSaveInstanceState. However, now this saved wifi p2p device is restored in onActivityCreated, this is too late. So when getting this saved wifi p2p device return NULL in onCreateDialog and leads to NPE force close.

Restore the saved wifi p2p device in onCreateView instead of onActivityCreated.

Bug: 220025725
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=WifiP2pSettingsTest

Change-Id: I9b746e21f7f3651c69b1445f2389c089ec19319c
2 files changed