Add a periodic check of the tethering provisioning

Add a service that handles the check through broadcasts which are
defined through configs, similar to the previous configs for the
activity.

Depends on I1f6e2d954562c5a16a0de60dac625005ec3e5c50

Bug: 18453076
Change-Id: I515d72706e9ca37877e67c44427af1b75b146390
This commit is contained in:
Jason Monk
2014-12-10 17:21:51 -05:00
parent f84c6ee01c
commit 37832d661a
6 changed files with 366 additions and 91 deletions

View File

@@ -68,15 +68,16 @@ public class WifiApEnabler {
} else if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(action)) {
enableWifiSwitch();
}
}
};
public WifiApEnabler(Context context, SwitchPreference switchPreference) {
mContext = context;
mSwitch = switchPreference;
mOriginalSummary = switchPreference.getSummary();
switchPreference.setPersistent(false);
mOriginalSummary = switchPreference != null ? switchPreference.getSummary() : "";
if (switchPreference != null) {
switchPreference.setPersistent(false);
}
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
mCm = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
@@ -121,10 +122,14 @@ public class WifiApEnabler {
}
if (mWifiManager.setWifiApEnabled(null, enable)) {
/* Disable here, enabled on receiving success broadcast */
mSwitch.setEnabled(false);
if (mSwitch != null) {
/* Disable here, enabled on receiving success broadcast */
mSwitch.setEnabled(false);
}
} else {
mSwitch.setSummary(R.string.wifi_error);
if (mSwitch != null) {
mSwitch.setSummary(R.string.wifi_error);
}
}
/**