From 0183fb5394f105d544472a52b2b4ba628e01da92 Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Sat, 22 Nov 2014 10:11:39 -0800 Subject: Additional changes to SubscriptionManager API as per API council. bug: 17575308 Change-Id: Idd98aa46c15a9219ccf28091c62602ac8bf16c62 --- src/com/android/settings/deviceinfo/ImeiInformation.java | 13 ++++++++----- src/com/android/settings/deviceinfo/SimStatus.java | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/com/android/settings/deviceinfo') diff --git a/src/com/android/settings/deviceinfo/ImeiInformation.java b/src/com/android/settings/deviceinfo/ImeiInformation.java index 921ef8e90..72d315870 100644 --- a/src/com/android/settings/deviceinfo/ImeiInformation.java +++ b/src/com/android/settings/deviceinfo/ImeiInformation.java @@ -42,9 +42,12 @@ public class ImeiInformation extends PreferenceActivity { private static final String KEY_IMEI = "imei"; private static final String KEY_IMEI_SV = "imei_sv"; + private SubscriptionManager mSubscriptionManager; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + mSubscriptionManager = SubscriptionManager.from(this); final TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); initPreferenceScreen(telephonyManager.getSimCount()); @@ -100,17 +103,17 @@ public class ImeiInformation extends PreferenceActivity { } } - private Phone getPhoneFromSlotId(int slotId) { - final List subInfos = SubscriptionManager.getSubscriptionInfoUsingSlotId(slotId); + private Phone getPhoneFromSlotId(int slotIdx) { + final SubscriptionInfo subInfo = + mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(slotIdx); - if (subInfos == null || subInfos.size() < 1) { + if (subInfo == null) { return null; } final Phone[] phones = PhoneFactory.getPhones(); for (int i = 0; i < phones.length; i++) { - // Currently we only operate with the first subscription of a SIM. - if (phones[i].getSubId() == subInfos.get(0).getSubscriptionId()) { + if (phones[i].getSubId() == subInfo.getSubscriptionId()) { return phones[i]; } } diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java index 46addf3f3..11daf0c38 100644 --- a/src/com/android/settings/deviceinfo/SimStatus.java +++ b/src/com/android/settings/deviceinfo/SimStatus.java @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and -* limitations under the License. + * limitations under the License. */ package com.android.settings.deviceinfo; @@ -143,7 +143,7 @@ public class SimStatus extends PreferenceActivity { mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH); for (int i = 0; i < mTelephonyManager.getSimCount(); i++) { - final SubscriptionInfo sir = Utils.findRecordBySlotId(i); + final SubscriptionInfo sir = Utils.findRecordBySlotId(this, i); if (sir != null) { mSelectableSubInfos.add(sir); } @@ -355,7 +355,7 @@ public class SimStatus extends PreferenceActivity { final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId( mSir.getSubscriptionId())); if (UserHandle.myUserId() == UserHandle.USER_OWNER - && mSir.getSubscriptionId() != SubscriptionManager.INVALID_SUB_ID) { + && mSir.getSubscriptionId() != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { if (phone == null) { Log.e(TAG, "Unable to locate a phone object for the given Subscription ID."); return; -- cgit v1.2.3