diff options
author | Stuart Scott <stuartscott@google.com> | 2015-01-29 01:55:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-01-29 01:55:50 +0000 |
commit | cdec2562d8c41b7f503b79fde55f1a45057981c6 (patch) | |
tree | 67dcfb9db9a600d610ee3c4603cb2ab6b9efab99 | |
parent | 409cde85e5cda5cbef3399ce78fa494a0d8bf2ef (diff) | |
parent | 5f8c9d88fe53b4b5fa9497a90302280e1b45ac3f (diff) | |
download | telephony-cdec2562d8c41b7f503b79fde55f1a45057981c6.tar.gz |
Merge "Change getDeviceId to take phoneId." into lmp-mr1-dev
-rw-r--r-- | src/java/com/android/internal/telephony/PhoneSubInfoController.java | 29 | ||||
-rwxr-xr-x | src/java/com/android/internal/telephony/PhoneSubInfoProxy.java | 4 |
2 files changed, 16 insertions, 17 deletions
diff --git a/src/java/com/android/internal/telephony/PhoneSubInfoController.java b/src/java/com/android/internal/telephony/PhoneSubInfoController.java index a7ef212578..7ff70ffac4 100644 --- a/src/java/com/android/internal/telephony/PhoneSubInfoController.java +++ b/src/java/com/android/internal/telephony/PhoneSubInfoController.java @@ -44,16 +44,15 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub { public String getDeviceId() { - return getDeviceIdForSubscriber(getDefaultSubscription()); + return getDeviceIdForPhone(SubscriptionManager.getPhoneId(getDefaultSubscription())); } - public String getDeviceIdForSubscriber(int subId) { - PhoneSubInfoProxy phoneSubInfoProxy = getPhoneSubInfoProxy(subId); - if (phoneSubInfoProxy != null) { - return phoneSubInfoProxy.getDeviceId(); + public String getDeviceIdForPhone(int phoneId) { + Phone phone = getPhone(phoneId); + if (phone != null) { + return phone.getDeviceId(); } else { - Rlog.e(TAG,"getDeviceId phoneSubInfoProxy is null" + - " for Subscription:" + subId); + Rlog.e(TAG,"getDeviceIdForPhone phone " + phoneId + " is null"); return null; } } @@ -223,23 +222,23 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub { private PhoneSubInfoProxy getPhoneSubInfoProxy(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); - if (phoneId < 0 || phoneId >= TelephonyManager.getDefault().getPhoneCount()) { - phoneId = 0; - } try { - return ((PhoneProxy)mPhone[(int)phoneId]).getPhoneSubInfoProxy(); + return getPhone(phoneId).getPhoneSubInfoProxy(); } catch (NullPointerException e) { Rlog.e(TAG, "Exception is :" + e.toString() + " For subId :" + subId); e.printStackTrace(); return null; - } catch (ArrayIndexOutOfBoundsException e) { - Rlog.e(TAG, "Exception is :" + e.toString() + " For subId :" + subId); - e.printStackTrace(); - return null; } } + private PhoneProxy getPhone(int phoneId) { + if (phoneId < 0 || phoneId >= TelephonyManager.getDefault().getPhoneCount()) { + phoneId = 0; + } + return (PhoneProxy) mPhone[phoneId]; + } + private int getDefaultSubscription() { return PhoneFactory.getDefaultSubscription(); } diff --git a/src/java/com/android/internal/telephony/PhoneSubInfoProxy.java b/src/java/com/android/internal/telephony/PhoneSubInfoProxy.java index 36bfab28fc..cedc0dca0e 100755 --- a/src/java/com/android/internal/telephony/PhoneSubInfoProxy.java +++ b/src/java/com/android/internal/telephony/PhoneSubInfoProxy.java @@ -152,8 +152,8 @@ public class PhoneSubInfoProxy extends IPhoneSubInfo.Stub { } @Override - public String getDeviceIdForSubscriber(int subId) throws RemoteException { - // FIXME: getDeviceIdForSubscriber + public String getDeviceIdForPhone(int phoneId) throws RemoteException { + // FIXME: getDeviceIdForPhone return null; } |