diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-01-30 11:16:20 -0800 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2012-01-30 11:21:35 -0800 |
commit | 5e61331da59921413a8e2a144146a8451a054020 (patch) | |
tree | b8526bf1c683e0910c69580560e16bdfc702781e /services/java/com/android/server/NetworkTimeUpdateService.java | |
parent | d53da8efa7a618562615df35ffc674620cbe2b26 (diff) |
Move away from deprecated NetworkInfo extra.
Because the NetworkInfo included in CONNECTIVITY_ACTION broadcast
extra does not reflect the state applicable to the calling UID, and
the last sticky broadcast may have stale state, transition to calling
ConnectivityManager.getActiveNetworkInfo() directly.
Change-Id: I86b316fbedd0273585ad5f1248b091bc3a3a5520
Diffstat (limited to 'services/java/com/android/server/NetworkTimeUpdateService.java')
-rw-r--r-- | services/java/com/android/server/NetworkTimeUpdateService.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/services/java/com/android/server/NetworkTimeUpdateService.java b/services/java/com/android/server/NetworkTimeUpdateService.java index f7fe39ecfd68..a7d19929133b 100644 --- a/services/java/com/android/server/NetworkTimeUpdateService.java +++ b/services/java/com/android/server/NetworkTimeUpdateService.java @@ -234,8 +234,9 @@ public class NetworkTimeUpdateService { String action = intent.getAction(); if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) { // There is connectivity - NetworkInfo netInfo = (NetworkInfo)intent.getParcelableExtra( - ConnectivityManager.EXTRA_NETWORK_INFO); + final ConnectivityManager connManager = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + final NetworkInfo netInfo = connManager.getActiveNetworkInfo(); if (netInfo != null) { // Verify that it's a WIFI connection if (netInfo.getState() == NetworkInfo.State.CONNECTED && |