Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +4 −6 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import android.os.PersistableBundle; import android.os.UserHandle; import android.preference.PreferenceManager; import android.service.carrier.CarrierIdentifier; import android.service.carrier.CarrierService; import android.service.euicc.EuiccProfileInfo; import android.service.euicc.EuiccService; import android.service.euicc.GetEuiccProfileInfoListResult; Loading Loading @@ -1144,11 +1143,10 @@ public class SubscriptionInfoUpdater extends Handler { private boolean isCarrierServicePackage(int phoneId, String pkgName) { if (pkgName.equals(getDefaultCarrierServicePackageName())) return false; List<String> carrierPackageNames = TelephonyManager.from(sContext) .getCarrierPackageNamesForIntentAndPhone( new Intent(CarrierService.CARRIER_SERVICE_INTERFACE), phoneId); if (DBG) logd("Carrier Packages For Subscription = " + carrierPackageNames); return carrierPackageNames != null && carrierPackageNames.contains(pkgName); String carrierPackageName = TelephonyManager.from(sContext) .getCarrierServicePackageNameForLogicalSlot(phoneId); if (DBG) logd("Carrier service package for subscription = " + carrierPackageName); return pkgName.equals(carrierPackageName); } /** Loading tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +12 −13 Original line number Diff line number Diff line Loading @@ -72,7 +72,6 @@ import org.mockito.stubbing.Answer; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; Loading Loading @@ -746,8 +745,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getSubIdUsingPhoneId(phoneId); doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading @@ -772,8 +771,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getSubIdUsingPhoneId(phoneId); doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(false).when(mSubInfo).isOpportunistic(); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading @@ -805,8 +804,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { ParcelUuid.fromString("11111111-2222-3333-4444-555555555555"), carrierPackageName); doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getSubIdUsingPhoneId(phoneId); doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading @@ -842,8 +841,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(ParcelUuid.fromString("11111111-2222-3333-4444-555555555555")) .when(mSubInfo).getGroupUuid(); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading @@ -922,8 +921,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { final int phoneId = mPhone.getPhoneId(); // Install fixtures, ensure the test will hit the right code path doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading @@ -982,8 +981,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getSubIdUsingPhoneId(phoneId); doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(false).when(mSubInfo).isOpportunistic(); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +4 −6 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import android.os.PersistableBundle; import android.os.UserHandle; import android.preference.PreferenceManager; import android.service.carrier.CarrierIdentifier; import android.service.carrier.CarrierService; import android.service.euicc.EuiccProfileInfo; import android.service.euicc.EuiccService; import android.service.euicc.GetEuiccProfileInfoListResult; Loading Loading @@ -1144,11 +1143,10 @@ public class SubscriptionInfoUpdater extends Handler { private boolean isCarrierServicePackage(int phoneId, String pkgName) { if (pkgName.equals(getDefaultCarrierServicePackageName())) return false; List<String> carrierPackageNames = TelephonyManager.from(sContext) .getCarrierPackageNamesForIntentAndPhone( new Intent(CarrierService.CARRIER_SERVICE_INTERFACE), phoneId); if (DBG) logd("Carrier Packages For Subscription = " + carrierPackageNames); return carrierPackageNames != null && carrierPackageNames.contains(pkgName); String carrierPackageName = TelephonyManager.from(sContext) .getCarrierServicePackageNameForLogicalSlot(phoneId); if (DBG) logd("Carrier service package for subscription = " + carrierPackageName); return pkgName.equals(carrierPackageName); } /** Loading
tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +12 −13 Original line number Diff line number Diff line Loading @@ -72,7 +72,6 @@ import org.mockito.stubbing.Answer; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; Loading Loading @@ -746,8 +745,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getSubIdUsingPhoneId(phoneId); doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading @@ -772,8 +771,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getSubIdUsingPhoneId(phoneId); doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(false).when(mSubInfo).isOpportunistic(); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading @@ -805,8 +804,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { ParcelUuid.fromString("11111111-2222-3333-4444-555555555555"), carrierPackageName); doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getSubIdUsingPhoneId(phoneId); doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading @@ -842,8 +841,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(ParcelUuid.fromString("11111111-2222-3333-4444-555555555555")) .when(mSubInfo).getGroupUuid(); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading @@ -922,8 +921,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { final int phoneId = mPhone.getPhoneId(); // Install fixtures, ensure the test will hit the right code path doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading Loading @@ -982,8 +981,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getSubIdUsingPhoneId(phoneId); doReturn(mSubInfo).when(mSubscriptionController).getSubscriptionInfo(eq(FAKE_SUB_ID_1)); doReturn(false).when(mSubInfo).isOpportunistic(); doReturn(Collections.singletonList(carrierPackageName)).when(mTelephonyManager) .getCarrierPackageNamesForIntentAndPhone(any(), eq(phoneId)); doReturn(carrierPackageName).when(mTelephonyManager) .getCarrierServicePackageNameForLogicalSlot(eq(phoneId)); ((MockContentResolver) mContext.getContentResolver()).addProvider( SubscriptionManager.CONTENT_URI.getAuthority(), new FakeSubscriptionContentProvider()); Loading