diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2013-09-06 18:04:26 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2013-11-15 02:38:36 +0900 |
commit | deb8f08ace7e255939d793c8a5a0006d424734bc (patch) | |
tree | 89d92998181abb97f1b1414faff046e8e790d6bf /src/com/android/settings/wifi/AdvancedWifiSettings.java | |
parent | 6eb6a908217e080aea43406028be491d269bdbb0 (diff) | |
download | packages_apps_Settings-deb8f08ace7e255939d793c8a5a0006d424734bc.tar.gz packages_apps_Settings-deb8f08ace7e255939d793c8a5a0006d424734bc.tar.bz2 packages_apps_Settings-deb8f08ace7e255939d793c8a5a0006d424734bc.zip |
Dynamically update connectivity and IP address.
The settings status page dynamically updates mobile network
status (in/out of service, signal strength, network type, etc.)
but not IP address and connectivity information. Dynamically
update that information as well, for consistency.
For consistency, also update the advanced wifi settings page.
Bug: 10232006
Change-Id: I3a292d8bd9e36ab16c37e107eefff4b37d884a4c
Diffstat (limited to 'src/com/android/settings/wifi/AdvancedWifiSettings.java')
-rw-r--r-- | src/com/android/settings/wifi/AdvancedWifiSettings.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/settings/wifi/AdvancedWifiSettings.java b/src/com/android/settings/wifi/AdvancedWifiSettings.java index 766305876..bbcd50d5a 100644 --- a/src/com/android/settings/wifi/AdvancedWifiSettings.java +++ b/src/com/android/settings/wifi/AdvancedWifiSettings.java @@ -16,8 +16,10 @@ package com.android.settings.wifi; +import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.content.IntentFilter; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.net.wifi.WifiWatchdogStateMachine; @@ -53,6 +55,18 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment private WifiManager mWifiManager; + private IntentFilter mFilter; + private final BroadcastReceiver mReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (action.equals(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION) || + action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) { + refreshWifiInfo(); + } + } + }; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -63,15 +77,26 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); + mFilter = new IntentFilter(); + mFilter.addAction(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION); + mFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); } @Override public void onResume() { super.onResume(); initPreferences(); + getActivity().registerReceiver(mReceiver, mFilter, + android.Manifest.permission.CHANGE_NETWORK_STATE, null); refreshWifiInfo(); } + @Override + public void onPause() { + super.onPause(); + getActivity().unregisterReceiver(mReceiver); + } + private void initPreferences() { CheckBoxPreference notifyOpenNetworks = (CheckBoxPreference) findPreference(KEY_NOTIFY_OPEN_NETWORKS); |