From 0ced792cd69ff4e78b3ea84e6b38c1f1fddce82e Mon Sep 17 00:00:00 2001 From: Shishir Agrawal Date: Wed, 10 Dec 2014 10:20:39 -0800 Subject: [PATCH] Fail SmsManager requests if SubId is not active. If subId is not active, expected subIds can be assigned to the messages being processed due to SmsManager calls. The change will fail any SmsManager calls if SubId is not active. Bug: 18629526 Change-Id: I8da1b1e2c477f32dcbaff417fc4e14ba2a225414 --- .../android/telephony/SubscriptionManager.java | 14 ++++++++++++++ .../java/com/android/internal/telephony/ISub.aidl | 1 + 2 files changed, 15 insertions(+) diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index aca94e9e0fc7c..88ca8a4378413 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -1133,5 +1133,19 @@ public class SubscriptionManager { logd("getSimStateForSubscriber: simState=" + simState + " subId=" + subId); return simState; } + + /** + * @return true if the sub ID is active. i.e. The sub ID corresponds to a known subscription + * and the SIM providing the subscription is present in a slot and in "LOADED" state. + * @hide + */ + public boolean isActiveSubId(int subId) { + try { + ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); + return iSub.isActiveSubId(subId); + } catch (RemoteException ex) { + } + return false; + } } diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index acbc0aa1c556f..c12137d6fa3c4 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -171,4 +171,5 @@ interface ISub { */ int getSimStateForSubscriber(int subId); + boolean isActiveSubId(int subId); }