am 5b930c49
: Merge "SIP: add config flag for wifi-only configuration." into gingerbread
Merge commit '5b930c49b12bdb1461a18491db768c642c38d498' into gingerbread-plus-aosp * commit '5b930c49b12bdb1461a18491db768c642c38d498': SIP: add config flag for wifi-only configuration.
This commit is contained in:
@ -357,4 +357,6 @@
|
||||
<!-- 2 means give warning -->
|
||||
<integer name="config_datause_notification_type">2</integer>
|
||||
|
||||
<!-- Enables SIP on WIFI only -->
|
||||
<bool name="config_sip_wifi_only">false</bool>
|
||||
</resources>
|
||||
|
@ -71,6 +71,7 @@ public final class SipService extends ISipService.Stub {
|
||||
private boolean mConnected;
|
||||
private WakeupTimer mTimer;
|
||||
private WifiManager.WifiLock mWifiLock;
|
||||
private boolean mWifiOnly;
|
||||
|
||||
// SipProfile URI --> group
|
||||
private Map<String, SipSessionGroupExt> mSipGroups =
|
||||
@ -99,6 +100,7 @@ public final class SipService extends ISipService.Stub {
|
||||
new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
|
||||
|
||||
mTimer = new WakeupTimer(context);
|
||||
mWifiOnly = SipManager.isSipWifiOnly(context);
|
||||
}
|
||||
|
||||
public synchronized SipProfile[] getListOfProfiles() {
|
||||
@ -774,6 +776,15 @@ public final class SipService extends ISipService.Stub {
|
||||
String type = netInfo.getTypeName();
|
||||
NetworkInfo.State state = netInfo.getState();
|
||||
|
||||
if (mWifiOnly && (netInfo.getType() !=
|
||||
ConnectivityManager.TYPE_WIFI)) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Wifi only, other connectivity ignored: "
|
||||
+ type);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkInfo activeNetInfo = getActiveNetworkInfo();
|
||||
if (DEBUG) {
|
||||
if (activeNetInfo != null) {
|
||||
|
@ -97,6 +97,14 @@ public class SipManager {
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if SIP is only available on WIFI.
|
||||
*/
|
||||
public static boolean isSipWifiOnly(Context context) {
|
||||
return context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_sip_wifi_only);
|
||||
}
|
||||
|
||||
private SipManager() {
|
||||
createSipService();
|
||||
}
|
||||
|
Reference in New Issue
Block a user