diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 0d585c7..f3db5e5 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -269,16 +269,19 @@
         mForgetButton = (Button) mButtonsPref.findViewById(R.id.forget_button);
         mForgetButton.setText(R.string.forget);
         mForgetButton.setOnClickListener(view -> forgetNetwork());
-        updateInfo();
     }
 
     @Override
     public void onResume() {
+        // Ensure mNetwork is set before any callbacks above are delivered, since our
+        // NetworkCallback only looks at changes to mNetwork.
+        mNetwork = mWifiManager.getCurrentNetwork();
+        mLinkProperties = mConnectivityManager.getLinkProperties(mNetwork);
+        mNetworkCapabilities = mConnectivityManager.getNetworkCapabilities(mNetwork);
+        updateInfo();
+        mContext.registerReceiver(mReceiver, mFilter);
         mConnectivityManagerWrapper.registerNetworkCallback(mNetworkRequest, mNetworkCallback,
                 mHandler);
-        // updateInfo() will be called during registration because NETWORK_STATE_CHANGED_ACTION is
-        // a sticky broadcast.
-        mContext.registerReceiver(mReceiver, mFilter);
     }
 
     @Override
@@ -293,9 +296,8 @@
     }
 
     private void updateInfo() {
-        mNetwork = mWifiManager.getCurrentNetwork();
-        mLinkProperties = mConnectivityManager.getLinkProperties(mNetwork);
-        mNetworkCapabilities = mConnectivityManager.getNetworkCapabilities(mNetwork);
+        // No need to fetch LinkProperties and NetworkCapabilities, they are updated by the
+        // callbacks. mNetwork doesn't change except in onResume.
         mNetworkInfo = mConnectivityManager.getNetworkInfo(mNetwork);
         mWifiInfo = mWifiManager.getConnectionInfo();
         if (mNetwork == null || mNetworkInfo == null || mWifiInfo == null) {
diff --git a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
index 18cfa4e..2aa338c 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
@@ -265,6 +265,11 @@
                 .thenReturn(mockIpv6AddressesPref);
     }
 
+    private void displayAndResume() {
+        mController.displayPreference(mockScreen);
+        mController.onResume();
+    }
+
     @Test
     public void isAvailable_shouldAlwaysReturnTrue() {
         mController.displayPreference(mockScreen);
@@ -274,28 +279,28 @@
 
     @Test
     public void securityPreference_stringShouldBeSet() {
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockSecurityPref).setDetailText(SECURITY);
     }
 
     @Test
     public void latestWifiInfo_shouldBeFetchedInDisplayPreference() {
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockWifiManager, times(1)).getConnectionInfo();
     }
 
     @Test
     public void latestNetworkInfo_shouldBeFetchedInDisplayPreference() {
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockConnectivityManager, times(1)).getNetworkInfo(any(Network.class));
     }
 
     @Test
     public void networkCallback_shouldBeRegisteredOnResume() {
-        mController.onResume();
+        displayAndResume();
 
         verify(mockConnectivityManagerWrapper, times(1)).registerNetworkCallback(
                 any(NetworkRequest.class), mCallbackCaptor.capture(), any(Handler.class));
@@ -303,7 +308,7 @@
 
     @Test
     public void networkCallback_shouldBeUnregisteredOnPause() {
-        mController.onResume();
+        displayAndResume();
         mController.onPause();
 
         verify(mockConnectivityManager, times(1)).unregisterNetworkCallback(
@@ -315,7 +320,7 @@
         Drawable expectedIcon =
                 NetworkBadging.getWifiIcon(LEVEL, NetworkBadging.BADGING_NONE, mContext.getTheme());
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockConnectionDetailPref).setIcon(expectedIcon);
     }
@@ -325,14 +330,14 @@
         String summary = "summary";
         when(mockAccessPoint.getSettingsSummary()).thenReturn(summary);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockConnectionDetailPref).setTitle(summary);
     }
 
     @Test
     public void signalStrengthPref_shouldHaveIconSet() {
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockSignalStrengthPref).setIcon(any(Drawable.class));
     }
@@ -342,7 +347,7 @@
         String expectedStrength =
                 mContext.getResources().getStringArray(R.array.wifi_signal)[LEVEL];
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockSignalStrengthPref).setDetailText(expectedStrength);
     }
@@ -351,7 +356,7 @@
     public void linkSpeedPref_shouldHaveDetailTextSet() {
         String expectedLinkSpeed = mContext.getString(R.string.link_speed, LINK_SPEED);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockLinkSpeedPref).setDetailText(expectedLinkSpeed);
     }
@@ -360,14 +365,14 @@
     public void linkSpeedPref_shouldNotShowIfNotSet() {
         when(mockWifiInfo.getLinkSpeed()).thenReturn(-1);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockLinkSpeedPref).setVisible(false);
     }
 
     @Test
     public void macAddressPref_shouldHaveDetailTextSet() {
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockMacAddressPref).setDetailText(MAC_ADDRESS);
     }
@@ -376,7 +381,7 @@
     public void ipAddressPref_shouldHaveDetailTextSet() {
         mLinkProperties.addLinkAddress(Constants.IPV4_ADDR);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockIpAddressPref).setDetailText(Constants.IPV4_ADDR.getAddress().getHostAddress());
     }
@@ -387,7 +392,7 @@
         mLinkProperties.addRoute(Constants.IPV4_DEFAULT);
         mLinkProperties.addRoute(Constants.IPV4_SUBNET);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockSubnetPref).setDetailText("255.255.255.128");
         verify(mockGatewayPref).setDetailText("192.0.2.127");
@@ -398,7 +403,7 @@
         mLinkProperties.addDnsServer(InetAddress.getByAddress(new byte[]{8,8,4,4}));
         mLinkProperties.addDnsServer(InetAddress.getByAddress(new byte[]{8,8,8,8}));
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockDnsPref).setDetailText("8.8.4.4,8.8.8.8");
     }
@@ -409,7 +414,7 @@
         // nor connecting and WifiStateMachine has not reached L2ConnectedState.
         when(mockWifiManager.getCurrentNetwork()).thenReturn(null);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockActivity).finish();
     }
@@ -420,7 +425,7 @@
         reset(mockIpv6Category, mockIpAddressPref, mockSubnetPref, mockGatewayPref,
                 mockDnsPref);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockIpv6Category).setVisible(false);
         verify(mockIpAddressPref).setVisible(false);
@@ -465,8 +470,7 @@
 
     @Test
     public void onLinkPropertiesChanged_updatesFields() {
-        mController.displayPreference(mockScreen);
-        mController.onResume();
+        displayAndResume();
 
         InOrder inOrder = inOrder(mockIpAddressPref, mockGatewayPref, mockSubnetPref,
                 mockDnsPref, mockIpv6Category, mockIpv6AddressesPref);
@@ -528,8 +532,7 @@
         when(mockAccessPoint.getSettingsSummary()).thenReturn(summary);
 
         InOrder inOrder = inOrder(mockConnectionDetailPref);
-        mController.displayPreference(mockScreen);
-        mController.onResume();
+        displayAndResume();
         inOrder.verify(mockConnectionDetailPref).setTitle(summary);
 
         // Check that an irrelevant capability update does not update the access point summary, as
@@ -562,7 +565,7 @@
         when(mockAccessPoint.getConfig()).thenReturn(null);
 
         mController = newWifiDetailPreferenceController();
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockForgetButton).setVisibility(View.INVISIBLE);
     }
@@ -572,14 +575,14 @@
         when(mockWifiInfo.isEphemeral()).thenReturn(true);
         when(mockAccessPoint.getConfig()).thenReturn(null);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockForgetButton).setVisibility(View.VISIBLE);
     }
 
     @Test
     public void canForgetNetwork_saved() {
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockForgetButton).setVisibility(View.VISIBLE);
     }
@@ -590,7 +593,7 @@
         when(mockWifiInfo.isEphemeral()).thenReturn(true);
         when(mockWifiInfo.getSSID()).thenReturn(ssid);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
         mForgetClickListener.getValue().onClick(null);
 
         verify(mockWifiManager).disableEphemeralNetwork(ssid);
@@ -612,8 +615,7 @@
 
     @Test
     public void networkStateChangedIntent_shouldRefetchInfo() {
-        mController.displayPreference(mockScreen);
-        mController.onResume();
+        displayAndResume();
 
         verify(mockConnectivityManager, times(1)).getNetworkInfo(any(Network.class));
         verify(mockWifiManager, times(1)).getConnectionInfo();
@@ -626,8 +628,7 @@
 
     @Test
     public void rssiChangedIntent_shouldRefetchInfo() {
-        mController.displayPreference(mockScreen);
-        mController.onResume();
+        displayAndResume();
 
         verify(mockConnectivityManager, times(1)).getNetworkInfo(any(Network.class));
         verify(mockWifiManager, times(1)).getConnectionInfo();
@@ -640,7 +641,7 @@
 
     @Test
     public void networkDisconnectedState_shouldFinishActivity() {
-        mController.onResume();
+        displayAndResume();
 
         when(mockConnectivityManager.getNetworkInfo(any(Network.class))).thenReturn(null);
         mContext.sendBroadcast(new Intent(WifiManager.NETWORK_STATE_CHANGED_ACTION));
@@ -650,8 +651,7 @@
 
     @Test
     public void networkOnLost_shouldFinishActivity() {
-        mController.displayPreference(mockScreen);
-        mController.onResume();
+        displayAndResume();
 
         mCallbackCaptor.getValue().onLost(mockNetwork);
 
@@ -664,7 +664,7 @@
         mLinkProperties.addLinkAddress(Constants.IPV6_GLOBAL1);
         mLinkProperties.addLinkAddress(Constants.IPV6_GLOBAL2);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         List <Preference> addrs = mIpv6AddressCaptor.getAllValues();
 
@@ -680,7 +680,7 @@
     public void ipv6AddressPref_shouldNotBeSelectable() {
         mLinkProperties.addLinkAddress(Constants.IPV6_GLOBAL2);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         assertThat(mockIpv6AddressesPref.isSelectable()).isFalse();
     }
@@ -689,8 +689,7 @@
     public void captivePortal_shouldShowSignInButton() {
         InOrder inOrder = inOrder(mockSignInButton);
 
-        mController.displayPreference(mockScreen);
-        mController.onResume();
+        displayAndResume();
 
         inOrder.verify(mockSignInButton).setVisibility(View.INVISIBLE);
 
@@ -709,7 +708,7 @@
 
     @Test
     public void testSignInButton_shouldStartCaptivePortalApp() {
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         ArgumentCaptor<OnClickListener> captor = ArgumentCaptor.forClass(OnClickListener.class);
         verify(mockSignInButton).setOnClickListener(captor.capture());
@@ -722,7 +721,7 @@
         when(mockSignInButton.getVisibility()).thenReturn(View.VISIBLE);
         when(mockForgetButton.getVisibility()).thenReturn(View.INVISIBLE);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockButtonsPref).setVisible(true);
     }
@@ -732,7 +731,7 @@
         when(mockSignInButton.getVisibility()).thenReturn(View.INVISIBLE);
         when(mockForgetButton.getVisibility()).thenReturn(View.VISIBLE);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockButtonsPref).setVisible(true);
     }
@@ -742,7 +741,7 @@
         when(mockSignInButton.getVisibility()).thenReturn(View.INVISIBLE);
         when(mockForgetButton.getVisibility()).thenReturn(View.INVISIBLE);
 
-        mController.displayPreference(mockScreen);
+        displayAndResume();
 
         verify(mockButtonsPref).setVisible(false);
     }
