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

Commit 5811e7e6 authored by Michael Groover's avatar Michael Groover Committed by Automerger Merge Worker
Browse files

Guard ICC ID card string behind new identifier access requirements am: 7dfee2e7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/13299604

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1a0e8c0de3dfd85053321de71e4e1de326fc48d1
parents f0a7b0df 7dfee2e7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3654,6 +3654,7 @@ public class SubscriptionController extends ISub.Stub {
        if (!hasSubscriberIdentifierAccess(subInfo.getSubscriptionId(), callingPackage, message)) {
            result = new SubscriptionInfo(subInfo);
            result.clearIccId();
            result.clearCardString();
        }
        return result;
    }
+12 −4
Original line number Diff line number Diff line
@@ -961,7 +961,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testGetActiveSubscriptionInfoWithReadPhoneState() throws Exception {
        // If the calling package only has the READ_PHONE_STATE permission then
        // getActiveSubscriptionInfo should still return a result but the ICC ID should not be
        // available.
        // available via getIccId or getCardString.
        testInsertSim();
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
@@ -972,6 +972,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
                subId, mCallingPackage);
        assertNotNull(subscriptionInfo);
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getIccId());
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getCardString());
    }

    @Test
@@ -985,6 +986,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
                subId, mCallingPackage);
        assertNotNull(subscriptionInfo);
        assertTrue(subscriptionInfo.getIccId().length() > 0);
        assertTrue(subscriptionInfo.getCardString().length() > 0);
    }

    @Test
@@ -1007,7 +1009,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testGetActiveSubscriptionInfoForSimSlotIndexWithReadPhoneState() throws Exception {
        // If the calling package only has the READ_PHONE_STATE permission then
        // getActiveSubscriptionInfoForSimlSlotIndex should still return the SubscriptionInfo but
        // the ICC ID should not be available.
        // the ICC ID should not be available via getIccId or getCardString.
        testInsertSim();
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
@@ -1018,6 +1020,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
                        mCallingPackage);
        assertNotNull(subscriptionInfo);
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getIccId());
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getCardString());
    }

    @Test
@@ -1032,6 +1035,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
                        mCallingPackage);
        assertNotNull(subscriptionInfo);
        assertTrue(subscriptionInfo.getIccId().length() > 0);
        assertTrue(subscriptionInfo.getCardString().length() > 0);
    }

    @Test
@@ -1051,7 +1055,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testGetActiveSubscriptionInfoListWithReadPhoneState() throws Exception {
        // If the calling package only has the READ_PHONE_STATE permission then
        // getActiveSubscriptionInfoList should still return the list of SubscriptionInfo objects
        // but the ICC ID should not be available.
        // but the ICC ID should not be available via getIccId or getCardString.
        testInsertSim();
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
@@ -1062,6 +1066,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
        assertTrue(subInfoList.size() > 0);
        for (SubscriptionInfo info : subInfoList) {
            assertEquals(UNAVAILABLE_ICCID, info.getIccId());
            assertEquals(UNAVAILABLE_ICCID, info.getCardString());
        }
    }

@@ -1076,6 +1081,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
        assertTrue(subInfoList.size() > 0);
        for (SubscriptionInfo info : subInfoList) {
            assertTrue(info.getIccId().length() > 0);
            assertTrue(info.getCardString().length() > 0);
        }
    }

@@ -1098,7 +1104,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testGetSubscriptionsInGroupWithReadPhoneState() throws Exception {
        // If the calling package only has the READ_PHONE_STATE permission then
        // getSubscriptionsInGroup should still return the list of SubscriptionInfo objects
        // but the ICC ID should not be available.
        // but the ICC ID should not be available via getIccId or getCardString.
        ParcelUuid groupUuid = setupGetSubscriptionsInGroupTest();
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
@@ -1109,6 +1115,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
        assertTrue(subInfoList.size() > 0);
        for (SubscriptionInfo info : subInfoList) {
            assertEquals(UNAVAILABLE_ICCID, info.getIccId());
            assertEquals(UNAVAILABLE_ICCID, info.getCardString());
        }
    }

@@ -1123,6 +1130,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
        assertTrue(subInfoList.size() > 0);
        for (SubscriptionInfo info : subInfoList) {
            assertTrue(info.getIccId().length() > 0);
            assertTrue(info.getCardString().length() > 0);
        }
    }