Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b930c49 authored by Hung-ying Tyan's avatar Hung-ying Tyan Committed by Android (Google) Code Review
Browse files

Merge "SIP: add config flag for wifi-only configuration." into gingerbread

parents ba56dfce c4b87477
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -342,4 +342,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>
+11 −0
Original line number Diff line number Diff line
@@ -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) {
+8 −0
Original line number Diff line number Diff line
@@ -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();
    }