Cache preferences and services in status dialog.

Currently, the status dialog fetches the preferences and system
services that it uses to display connectivity information (e.g.,
IP and MAC addresses) only when the dialog is first opened. This
is fine because the connectivity information is only filled in
once and never updated.

In order to have this information update dynamically (like the
rest of the dialog), fetch and cache these objects in onCreate.
The next change will actually make this information update on
network changes.

Bug: 10232006
Change-Id: Ib4072674543e517cf6935e3e03f35090e728090a
This commit is contained in:
Lorenzo Colitti
2013-11-08 03:53:29 +09:00
parent 1af7627d3c
commit 6eb6a90821
2 changed files with 64 additions and 43 deletions

View File

@@ -345,9 +345,7 @@ public class Utils {
* @param context the application context
* @return the formatted and newline-separated IP addresses, or null if none.
*/
public static String getDefaultIpAddresses(Context context) {
ConnectivityManager cm = (ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
public static String getDefaultIpAddresses(ConnectivityManager cm) {
LinkProperties prop = cm.getActiveLinkProperties();
return formatIpAddresses(prop);
}