Replacing SubscriptionManagerFacade hidden APIs
Using systemAPIs instead of hidden APIs for SubscriptionManager
API calls
Test: Yes, locally
Bug: 146482984
Change-Id: I6d396bbdf8d30d017d7391ce4a31f7644f2d4672
diff --git a/Common/src/com/googlecode/android_scripting/facade/telephony/SubscriptionManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/telephony/SubscriptionManagerFacade.java
index f277a49..a91ccc6 100644
--- a/Common/src/com/googlecode/android_scripting/facade/telephony/SubscriptionManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/telephony/SubscriptionManagerFacade.java
@@ -75,7 +75,7 @@
public void subscriptionSetDefaultVoiceSubId(
@RpcParameter(name = "subId")
Integer subId) {
- mSubscriptionManager.setDefaultVoiceSubId(subId);
+ mSubscriptionManager.setDefaultVoiceSubscriptionId(subId);
}
@Rpc(description = "Return the default sms subscription ID")
@@ -90,9 +90,13 @@
mSubscriptionManager.setDefaultSmsSubId(subId);
}
- @Rpc(description = "Return a List of all Subscription Info Records")
+ /**
+ * Get list of all available subscriptions details
+ *
+ */
+ @Rpc(description = "Return a List of available Subscription Info Records")
public List<SubscriptionInfo> subscriptionGetAllSubInfoList() {
- return mSubscriptionManager.getAllSubscriptionInfoList();
+ return mSubscriptionManager.getAvailableSubscriptionInfoList();
}
@Rpc(description = "Return a List of all Active Subscription Info Records")
diff --git a/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
index 8f1db85..a338402 100644
--- a/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
@@ -25,8 +25,9 @@
import android.net.TrafficStats;
import android.net.Uri;
import android.os.RemoteException;
-import android.os.SystemProperties;
import android.provider.Telephony;
+import android.sysprop.TelephonyProperties;
+import android.telephony.AvailableNetworkInfo;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.NeighboringCellInfo;
@@ -35,10 +36,8 @@
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
-import android.telephony.AvailableNetworkInfo;
import com.android.internal.telephony.RILConstants;
-import com.android.internal.telephony.TelephonyProperties;
import com.google.common.io.BaseEncoding;
import com.googlecode.android_scripting.Log;
@@ -46,10 +45,10 @@
import com.googlecode.android_scripting.facade.EventFacade;
import com.googlecode.android_scripting.facade.FacadeManager;
import com.googlecode.android_scripting.facade.telephony.TelephonyStateListeners
- .CallStateChangeListener;
-import com.googlecode.android_scripting.facade.telephony.TelephonyStateListeners
.ActiveDataSubIdChangeListener;
import com.googlecode.android_scripting.facade.telephony.TelephonyStateListeners
+ .CallStateChangeListener;
+import com.googlecode.android_scripting.facade.telephony.TelephonyStateListeners
.CellInfoChangeListener;
import com.googlecode.android_scripting.facade.telephony.TelephonyStateListeners
.DataConnectionRealTimeInfoChangeListener;
@@ -67,8 +66,8 @@
import com.googlecode.android_scripting.rpc.RpcOptional;
import com.googlecode.android_scripting.rpc.RpcParameter;
-import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Executor;
@@ -753,6 +752,25 @@
mTelephonyManager.getPhoneType());
}
+ @Rpc(description = "Return if setAlwaysAllowMMSData is set correctly")
+ public boolean telephonySetAlwaysAllowMmsData(
+ @RpcParameter(name = "subId") Integer subId,
+ @RpcParameter(name = "alwaysAllow") Boolean alwaysAllow) {
+ return mTelephonyManager.createForSubscriptionId(subId).setAlwaysAllowMmsData(alwaysAllow);
+ }
+
+ /**
+ * Sets Data Roaming flag for a particular sub Id
+ * @param subId the subscriber id
+ * @param isEnabled can you set to true or false
+ */
+ @Rpc(description = "Sets data roaming for a sub Id")
+ public void telephonySetDataRoamingEnabled(
+ @RpcParameter(name = "subId") Integer subId,
+ @RpcParameter(name = "isEnabled") Boolean isEnabled) {
+ mTelephonyManager.createForSubscriptionId(subId).setDataRoamingEnabled(isEnabled);
+ }
+
@Rpc(description = "Returns preferred opportunistic data subscription Id")
public Integer telephonyGetPreferredOpportunisticDataSubscription() {
return mTelephonyManager.getPreferredOpportunisticDataSubscription();
@@ -1206,7 +1224,8 @@
String mcc = "";
String mnc = "";
- String numeric = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC);
+ List<String> numerics = TelephonyProperties.icc_operator_numeric();
+ String numeric = numerics.isEmpty() ? null : numerics.get(0);
// MCC is first 3 chars and then in 2 - 3 chars of MNC
if (numeric != null && numeric.length() > 4) {
// Country code