am b366a286
: am 5a528b27
: Merge "Listen for CONNECTIVITY_ACTION broadcasts in WifiSetupActivity" into lmp-mr1-dev
automerge: 7a3b253
* commit '7a3b253f086150ab030db967862002795a29bb83':
Listen for CONNECTIVITY_ACTION broadcasts in WifiSetupActivity
This commit is contained in:
@@ -68,13 +68,14 @@ public class WifiSetupActivity extends WifiPickerActivity
|
|||||||
|
|
||||||
private SetupWizardNavBar mNavigationBar;
|
private SetupWizardNavBar mNavigationBar;
|
||||||
|
|
||||||
private final IntentFilter mFilter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
|
private IntentFilter mFilter = new IntentFilter();
|
||||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
// Refresh the connection state with the latest connection info. Use the connection info
|
// Refresh the connection state with the latest connection info. Use the connection info
|
||||||
// from ConnectivityManager instead of the one attached in the intent to make sure
|
// from ConnectivityManager instead of the one attached in the intent to make sure
|
||||||
// we have the most up-to-date connection state. b/17511772
|
// we have the most up-to-date connection state. b/17511772
|
||||||
|
|
||||||
refreshConnectionState();
|
refreshConnectionState();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -84,6 +85,8 @@ public class WifiSetupActivity extends WifiPickerActivity
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
final Intent intent = getIntent();
|
final Intent intent = getIntent();
|
||||||
|
mFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
|
||||||
|
mFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||||
|
|
||||||
mAutoFinishOnConnection = intent.getBooleanExtra(EXTRA_AUTO_FINISH_ON_CONNECT, false);
|
mAutoFinishOnConnection = intent.getBooleanExtra(EXTRA_AUTO_FINISH_ON_CONNECT, false);
|
||||||
mAllowSkip = intent.getBooleanExtra(EXTRA_ALLOW_SKIP, true);
|
mAllowSkip = intent.getBooleanExtra(EXTRA_ALLOW_SKIP, true);
|
||||||
@@ -108,6 +111,7 @@ public class WifiSetupActivity extends WifiPickerActivity
|
|||||||
getSystemService(Context.CONNECTIVITY_SERVICE);
|
getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
boolean connected = connectivity != null &&
|
boolean connected = connectivity != null &&
|
||||||
connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected();
|
connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected();
|
||||||
|
|
||||||
refreshConnectionState(connected);
|
refreshConnectionState(connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user