summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiangyu/Malcolm Chen <refuhoo@google.com>2019-01-18 22:20:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-01-18 22:20:14 +0000
commit5837dcdbb5ef4b5882bb5debb53ffcbe1a117ce3 (patch)
tree12391793b5e1b8d84b8edb3fae13b6887a6b0e8b
parent5d5e98271ce23ea8c3e7a39af9ff0b8dae6b2113 (diff)
parentcf21ad751a1f87ad17c110dd83ede2cb866909f6 (diff)
Merge "Add System API to enable / disable a logical modem."
-rw-r--r--api/system-current.txt1
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java29
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl5
-rw-r--r--telephony/java/com/android/internal/telephony/RILConstants.java1
4 files changed, 36 insertions, 0 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index a59b325acf6e..d179bdedaf07 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6892,6 +6892,7 @@ package android.telephony {
method public void dial(java.lang.String);
method public boolean disableDataConnectivity();
method public boolean enableDataConnectivity();
+ method public boolean enableModemForSlot(int, boolean);
method public void enableVideoCalling(boolean);
method public java.lang.String getAidForAppType(int);
method public deprecated java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 75b117792844..80533535017e 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -10074,4 +10074,33 @@ public class TelephonyManager {
}
return ret;
}
+
+ /**
+ * Enable or disable a logical modem stack. When a logical modem is disabled, the corresponding
+ * SIM will still be visible to the user but its mapping modem will not have any radio activity.
+ * For example, we will disable a modem when user or system believes the corresponding SIM
+ * is temporarily not needed (e.g. out of coverage), and will enable it back on when needed.
+ *
+ * Requires that the calling app has permission
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
+ * @param slotIndex which corresponding modem will operate on.
+ * @param enable whether to enable or disable the modem stack.
+ * @return whether the operation is successful.
+ *
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ public boolean enableModemForSlot(int slotIndex, boolean enable) {
+ boolean ret = false;
+ try {
+ ITelephony telephony = getITelephony();
+ if (telephony != null) {
+ ret = telephony.enableModemForSlot(slotIndex, enable);
+ }
+ } catch (RemoteException ex) {
+ Log.e(TAG, "enableModem RemoteException", ex);
+ }
+ return ret;
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 62b9d363e35e..5736a465d449 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1793,4 +1793,9 @@ interface ITelephony {
* Get the full emergency number list for Test Mode.
*/
List<String> getEmergencyNumberListTestMode();
+
+ /**
+ * Enable or disable a logical modem stack associated with the slotIndex.
+ */
+ boolean enableModemForSlot(int slotIndex, boolean enable);
}
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 1c103a9fc747..930003462110 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -489,6 +489,7 @@ public interface RILConstants {
int RIL_REQUEST_STOP_NETWORK_SCAN = 143;
int RIL_REQUEST_START_KEEPALIVE = 144;
int RIL_REQUEST_STOP_KEEPALIVE = 145;
+ int RIL_REQUEST_ENABLE_MODEM = 146;
/* The following requests are not defined in RIL.h */
int RIL_REQUEST_HAL_NON_RIL_BASE = 200;