Remove wifi scan-always dialog.
When wifi is switched off we no longer want a notification dialog about scan-always, instead using in-panel text. bug:8907190 Change-Id: I707f306a056068d92f69070873f1e6330b598b1e
This commit is contained in:
@@ -40,7 +40,6 @@ public class WifiEnabler implements CompoundButton.OnCheckedChangeListener {
|
||||
private final Context mContext;
|
||||
private Switch mSwitch;
|
||||
private AtomicBoolean mConnected = new AtomicBoolean(false);
|
||||
private AtomicBoolean mNotifyScanMode = new AtomicBoolean(true);
|
||||
|
||||
private final WifiManager mWifiManager;
|
||||
private boolean mStateMachineEvent;
|
||||
@@ -75,7 +74,6 @@ public class WifiEnabler implements CompoundButton.OnCheckedChangeListener {
|
||||
// The order matters! We really should not depend on this. :(
|
||||
mIntentFilter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
|
||||
mIntentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
|
||||
registerForNotifyUserOnScanModeChange();
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
@@ -102,29 +100,6 @@ public class WifiEnabler implements CompoundButton.OnCheckedChangeListener {
|
||||
mSwitch.setEnabled(isEnabled || isDisabled);
|
||||
}
|
||||
|
||||
private void getPersistedNotifyScanMode() {
|
||||
mNotifyScanMode.set(Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.WIFI_NOTIFY_SCAN_ALWAYS_AVAILABLE, 1) == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Observes settings changes to notify the user when scan mode is active and
|
||||
* Wi-Fi is turned off
|
||||
*/
|
||||
private void registerForNotifyUserOnScanModeChange() {
|
||||
ContentObserver contentObserver = new ContentObserver(null) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
getPersistedNotifyScanMode();
|
||||
}
|
||||
};
|
||||
|
||||
mContext.getContentResolver().registerContentObserver(
|
||||
Settings.Global.getUriFor(Settings.Global.WIFI_NOTIFY_SCAN_ALWAYS_AVAILABLE),
|
||||
false, contentObserver);
|
||||
getPersistedNotifyScanMode();
|
||||
}
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
//Do nothing if called as a result of a state machine event
|
||||
if (mStateMachineEvent) {
|
||||
@@ -144,13 +119,6 @@ public class WifiEnabler implements CompoundButton.OnCheckedChangeListener {
|
||||
mWifiManager.setWifiApEnabled(null, false);
|
||||
}
|
||||
|
||||
if (isChecked == false) {
|
||||
if (mWifiManager.isScanAlwaysAvailable() && mNotifyScanMode.get()) {
|
||||
Intent intent = new Intent(WifiManager.ACTION_NOTIFY_SCAN_ALWAYS_AVAILABLE);
|
||||
mContext.startActivityAsUser(intent, null, UserHandle.CURRENT);
|
||||
}
|
||||
}
|
||||
|
||||
if (mWifiManager.setWifiEnabled(isChecked)) {
|
||||
// Intent has been taken into account, disable until new state is active
|
||||
mSwitch.setEnabled(false);
|
||||
|
Reference in New Issue
Block a user