Fix crash issue when NetworkSelectSettings UI goes OFF and then ON

When updating selected preference instance by index, since
mPreferenceCategory hasn't been updated yet, and then there is a
possibility that the index is over the size of preference, so this
would result to Settings crash because IndexOutOfBoundsException
was detected in NetworkSelectSettings.
After updating the network preferences of mPreferenceCategory, update
the selected preference.

Test: manual - Checked that crash does not occur when
NetworkSelectSettings UI goes OFF and then ON.
Test: auto - Passed NetworkSelectSettingsTest.
Bug: 179754915

Change-Id: Ib736fe8fdcc82c3ac01ad1828d0f2a1c24610f2b
1 file changed