Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e9736d7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update SubscriptionInfoUpdater to use TM#getCarrierServicePackageName" into tm-dev

parents 48423fbf d89bc9d4
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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;
@@ -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);
    }

    /**
+12 −13
Original line number Diff line number Diff line
@@ -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;

@@ -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());
@@ -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());
@@ -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());
@@ -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());
@@ -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());
@@ -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());