summaryrefslogtreecommitdiffstats
path: root/telephony/java/android
diff options
context:
space:
mode:
authorSanket Padawe <sanketpadawe@google.com>2015-06-18 12:08:01 -0700
committerSanket Padawe <sanketpadawe@google.com>2015-06-18 12:08:01 -0700
commit330dcac0cb9412b7a856a99ce3ea94d2ebba330a (patch)
treefa3d25164b620c68f082f0e9b701d2ea238b28c0 /telephony/java/android
parent91870fa281c736b59fb8481e4469da51397c586d (diff)
downloadframeworks_base-330dcac0cb9412b7a856a99ce3ea94d2ebba330a.zip
frameworks_base-330dcac0cb9412b7a856a99ce3ea94d2ebba330a.tar.gz
frameworks_base-330dcac0cb9412b7a856a99ce3ea94d2ebba330a.tar.bz2
SubscriptionManager: Fix NPE in getSimStateForSlotIdx
bug: 21915589 Change-Id: If703baff6408a0d7ba7c8b02bfd2427b64cda963
Diffstat (limited to 'telephony/java/android')
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index e085d89..fa1ed54 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -1124,13 +1124,14 @@ public class SubscriptionManager {
* {@hide}
*/
public static int getSimStateForSlotIdx(int slotIdx) {
- int simState;
+ int simState = TelephonyManager.SIM_STATE_UNKNOWN;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
- simState = iSub.getSimStateForSlotIdx(slotIdx);
+ if (iSub != null) {
+ simState = iSub.getSimStateForSlotIdx(slotIdx);
+ }
} catch (RemoteException ex) {
- simState = TelephonyManager.SIM_STATE_UNKNOWN;
}
logd("getSimStateForSubscriber: simState=" + simState + " slotIdx=" + slotIdx);
return simState;
@@ -1144,7 +1145,9 @@ public class SubscriptionManager {
public boolean isActiveSubId(int subId) {
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
- return iSub.isActiveSubId(subId);
+ if (iSub != null) {
+ return iSub.isActiveSubId(subId);
+ }
} catch (RemoteException ex) {
}
return false;