OSDN Git Service

Add Wi-Fi calling state setting to telephony interfaces
authorIhab Awad <ihab@google.com>
Mon, 25 Nov 2013 19:31:46 +0000 (11:31 -0800)
committerIhab Awad <ihab@google.com>
Mon, 25 Nov 2013 19:31:46 +0000 (11:31 -0800)
Change-Id: I73e643c00c7c00182cc4650053d098b6e40a8a5f

core/java/android/provider/Settings.java
telephony/java/android/telephony/TelephonyManager.java
telephony/java/com/android/internal/telephony/ITelephony.aidl

index 0dffc17..69ab166 100644 (file)
@@ -2483,6 +2483,14 @@ public final class Settings {
             NOTIFICATION_SOUND
         };
 
+        /**
+         * When to use Wi-Fi calling
+         *
+         * @see android.telephony.TelephonyManager.WifiCallingChoices
+         * @hide
+         */
+        public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls";
+
         // Settings moved to Settings.Secure
 
         /**
index 42b2b8c..37cd4f8 100644 (file)
@@ -24,7 +24,6 @@ import android.os.Bundle;
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.SystemProperties;
-import android.telephony.Rlog;
 
 import com.android.internal.telephony.IPhoneSubInfo;
 import com.android.internal.telephony.ITelephony;
@@ -63,6 +62,20 @@ public class TelephonyManager {
     private static ITelephonyRegistry sRegistry;
     private final Context mContext;
 
+    /**
+     * The allowed states of Wi-Fi calling.
+     *
+     * @hide
+     */
+    public interface WifiCallingChoices {
+        /** Always use Wi-Fi calling */
+        static final int ALWAYS_USE = 0;
+        /** Never use Wi-Fi calling */
+        static final int NEVER_USE = 1;
+        /** Ask the user whether to use Wi-Fi on every call */
+        static final int ASK_EVERY_TIME = 2;
+    }
+
     /** @hide */
     public TelephonyManager(Context context) {
         Context appContext = context.getApplicationContext();
@@ -1458,4 +1471,31 @@ public class TelephonyManager {
         return mContext.getResources().getString(
                 com.android.internal.R.string.config_mms_user_agent_profile_url);
     }
+
+    /**
+     * Obtain the current state of Wi-Fi calling.
+     *
+     * @hide
+     * @see android.telephony.TelephonyManager.WifiCallingChoices
+     */
+    public int getWhenToMakeWifiCalls() {
+        try {
+            return getITelephony().getWhenToMakeWifiCalls();
+        } catch (RemoteException ex) {
+            return WifiCallingChoices.NEVER_USE;
+        }
+    }
+
+    /**
+     * Set the current state of Wi-Fi calling.
+     *
+     * @hide
+     * @see android.telephony.TelephonyManager.WifiCallingChoices
+     */
+    public void setWhenToMakeWifiCalls(int state) {
+        try {
+            getITelephony().setWhenToMakeWifiCalls(state);
+        } catch (RemoteException ex) {
+        }
+    }
 }
index d81cab3..caa7ff4 100644 (file)
@@ -337,4 +337,18 @@ interface ITelephony {
      */
     void newIncomingThirdPartyCall(in ComponentName component, String callId,
             String callerDisplayName);
+
+    /**
+     * Obtain the current state of Wi-Fi calling.
+     *
+     * @see android.telephony.TelephonyManager.WifiCallingChoices
+     */
+    int getWhenToMakeWifiCalls();
+
+    /**
+     * Set the current state of Wi-Fi calling.
+     *
+     * @see android.telephony.TelephonyManager.WifiCallingChoices
+     */
+    void setWhenToMakeWifiCalls(int state);
 }