Don't add wifi entries twice, when returning from another activity.
Bug: 3209730 Change-Id: I7408a56fc10359e508be5a1d27492da2227335ce
This commit is contained in:
@@ -168,12 +168,15 @@ public class WifiSettings extends SettingsPreferenceFragment
|
|||||||
// state, start it off in the right state
|
// state, start it off in the right state
|
||||||
mEnableNextOnConnection = intent.getBooleanExtra(EXTRA_ENABLE_NEXT_ON_CONNECT, false);
|
mEnableNextOnConnection = intent.getBooleanExtra(EXTRA_ENABLE_NEXT_ON_CONNECT, false);
|
||||||
|
|
||||||
|
// Avoid re-adding on returning from an overlapping activity/fragment.
|
||||||
|
if (getPreferenceScreen() == null || getPreferenceScreen().getPreferenceCount() < 2) {
|
||||||
if (mEnableNextOnConnection) {
|
if (mEnableNextOnConnection) {
|
||||||
if (mEnableNextOnConnection && hasNextButton()) {
|
if (mEnableNextOnConnection && hasNextButton()) {
|
||||||
final ConnectivityManager connectivity = (ConnectivityManager)
|
final ConnectivityManager connectivity = (ConnectivityManager)
|
||||||
getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
|
getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
if (connectivity != null) {
|
if (connectivity != null) {
|
||||||
NetworkInfo info = connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
NetworkInfo info = connectivity.getNetworkInfo(
|
||||||
|
ConnectivityManager.TYPE_WIFI);
|
||||||
changeNextButtonState(info.isConnected());
|
changeNextButtonState(info.isConnected());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,10 +195,6 @@ public class WifiSettings extends SettingsPreferenceFragment
|
|||||||
mNotifyOpenNetworks.setChecked(Secure.getInt(getContentResolver(),
|
mNotifyOpenNetworks.setChecked(Secure.getInt(getContentResolver(),
|
||||||
Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
|
Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// After confirming PreferenceScreen is available, we call super.
|
|
||||||
super.onActivityCreated(savedInstanceState);
|
|
||||||
|
|
||||||
// This may be either ProgressCategory or AccessPointCategoryForXL.
|
// This may be either ProgressCategory or AccessPointCategoryForXL.
|
||||||
final ProgressCategoryBase preference =
|
final ProgressCategoryBase preference =
|
||||||
(ProgressCategoryBase) findPreference("access_points");
|
(ProgressCategoryBase) findPreference("access_points");
|
||||||
@@ -207,6 +206,11 @@ public class WifiSettings extends SettingsPreferenceFragment
|
|||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After confirming PreferenceScreen is available, we call super.
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
Reference in New Issue
Block a user