Wifi details: minor ordering fixes.
1. Set mNetwork before the NetworkCallbacks can be delivered. Previously, the code would set mNetwork in updateInfo, relying on the fact that the BroadcastReceiver registered in onResume is immediately invoked. However, this races with the callbacks, which are also immediately invoked. If the callbacks won the race, mNetwork would not be set and they would be ignored. 2. Call updateInfo in onResume instead of in displayPreference. This ensures that it's always called exactly once before the activity starts running, regardless of whether it's being displayed the first time (i.e., after onStart) or resumed by switching from another app. displayPreference is only called in the former case. 3. Don't call getLinkProperties and getNetworkCapabilities in updateInfo. These calls are superfluous, because this information is update by the NetworkCallbacks, and they can cause jank because updateInfo is called on the UI thread. This requires that the tests be changed so they always call onResume, since no UI elements are populated until onResume is called. Bug: 62209358 Test: make -j64 RunSettingsRoboTests Change-Id: Iccb1b9ae51188755d890a6df83004dbe9bec565e
Loading
Please register or sign in to comment