From 389daf02ffbc9ff40f6ada9f34881fe5736da194 Mon Sep 17 00:00:00 2001 From: Eric Schwarzenbach Date: Tue, 10 Oct 2017 15:22:56 -0700 Subject: [PATCH] Show updated Speed Label on Wifi detail page. Fixes a bug where the detail page sometimes doesn't show a speed label even when WifiSettings shows it. WifiSettings stores its connected AccessPoint in a bundle on page load and connect. If that AccessPoint's score cache doesn't have a score yet, it won't (can't) store it in the bundle. If the score cache is then updated, it will display a score in WifiSettings, but since the bundle has already been saved, the AccessPoint that WifiNetworkDetailPage receives will not have a score. This change modifies the preference to store the bundle only once the user clicks the preference, so the detail page will be in sync with WifiSettings. Bug: 67607122 Test: manual Change-Id: I6b33129b5a03b0e3e6d6e48ea48726e8dbe840b9 --- src/com/android/settings/wifi/WifiSettings.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index 98af552fa8c..10001825ee1 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -870,12 +870,12 @@ public class WifiSettings extends RestrictedSettingsFragment private void addConnectedAccessPointPreference(AccessPoint connectedAp) { final LongPressAccessPointPreference pref = getOrCreatePreference(connectedAp); - // Save the state of the current access point in the bundle so that we can restore it - // in the Wifi Network Details Fragment - pref.getAccessPoint().saveWifiState(pref.getExtras()); - // Launch details page on click. pref.setOnPreferenceClickListener(preference -> { + // Save the state of the current access point in the bundle so that we can restore it + // in the Wifi Network Details Fragment + pref.getAccessPoint().saveWifiState(pref.getExtras()); + SettingsActivity activity = (SettingsActivity) WifiSettings.this.getActivity(); activity.startPreferencePanel(this, WifiNetworkDetailsFragment.class.getName(), pref.getExtras(),