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

Commit bfc884fc authored by Michael Groover's avatar Michael Groover Committed by Android (Google) Code Review
Browse files

Merge "Guard ICC ID card string behind new identifier access requirements" into rvc-dev

parents f6c63b85 3a2a3fb9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -3750,6 +3750,7 @@ public class SubscriptionController extends ISub.Stub {
                callingFeatureId, message)) {
                callingFeatureId, message)) {
            result = new SubscriptionInfo(subInfo);
            result = new SubscriptionInfo(subInfo);
            result.clearIccId();
            result.clearIccId();
            result.clearCardString();
        }
        }
        return result;
        return result;
    }
    }
+12 −4
Original line number Original line Diff line number Diff line
@@ -1042,7 +1042,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testGetActiveSubscriptionInfoWithReadPhoneState() throws Exception {
    public void testGetActiveSubscriptionInfoWithReadPhoneState() throws Exception {
        // If the calling package only has the READ_PHONE_STATE permission then
        // 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
        // getActiveSubscriptionInfo should still return a result but the ICC ID should not be
        // available.
        // available via getIccId or getCardString.
        testInsertSim();
        testInsertSim();
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
@@ -1054,6 +1054,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
                subId, mCallingPackage, mCallingFeature);
                subId, mCallingPackage, mCallingFeature);
        assertNotNull(subscriptionInfo);
        assertNotNull(subscriptionInfo);
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getIccId());
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getIccId());
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getCardString());
    }
    }


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


    @Test
    @Test
@@ -1090,7 +1092,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testGetActiveSubscriptionInfoForSimSlotIndexWithReadPhoneState() throws Exception {
    public void testGetActiveSubscriptionInfoForSimSlotIndexWithReadPhoneState() throws Exception {
        // If the calling package only has the READ_PHONE_STATE permission then
        // If the calling package only has the READ_PHONE_STATE permission then
        // getActiveSubscriptionInfoForSimlSlotIndex should still return the SubscriptionInfo but
        // 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();
        testInsertSim();
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
@@ -1102,6 +1104,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
                        mCallingPackage, mCallingFeature);
                        mCallingPackage, mCallingFeature);
        assertNotNull(subscriptionInfo);
        assertNotNull(subscriptionInfo);
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getIccId());
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getIccId());
        assertEquals(UNAVAILABLE_ICCID, subscriptionInfo.getCardString());
    }
    }


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


    @Test
    @Test
@@ -1136,7 +1140,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testGetActiveSubscriptionInfoListWithReadPhoneState() throws Exception {
    public void testGetActiveSubscriptionInfoListWithReadPhoneState() throws Exception {
        // If the calling package only has the READ_PHONE_STATE permission then
        // If the calling package only has the READ_PHONE_STATE permission then
        // getActiveSubscriptionInfoList should still return the list of SubscriptionInfo objects
        // 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();
        testInsertSim();
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
@@ -1149,6 +1153,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
        assertTrue(subInfoList.size() > 0);
        assertTrue(subInfoList.size() > 0);
        for (SubscriptionInfo info : subInfoList) {
        for (SubscriptionInfo info : subInfoList) {
            assertEquals(UNAVAILABLE_ICCID, info.getIccId());
            assertEquals(UNAVAILABLE_ICCID, info.getIccId());
            assertEquals(UNAVAILABLE_ICCID, info.getCardString());
        }
        }
    }
    }


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


@@ -1187,7 +1193,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testGetSubscriptionsInGroupWithReadPhoneState() throws Exception {
    public void testGetSubscriptionsInGroupWithReadPhoneState() throws Exception {
        // If the calling package only has the READ_PHONE_STATE permission then
        // If the calling package only has the READ_PHONE_STATE permission then
        // getSubscriptionsInGroup should still return the list of SubscriptionInfo objects
        // 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();
        ParcelUuid groupUuid = setupGetSubscriptionsInGroupTest();
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
@@ -1199,6 +1205,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
        assertTrue(subInfoList.size() > 0);
        assertTrue(subInfoList.size() > 0);
        for (SubscriptionInfo info : subInfoList) {
        for (SubscriptionInfo info : subInfoList) {
            assertEquals(UNAVAILABLE_ICCID, info.getIccId());
            assertEquals(UNAVAILABLE_ICCID, info.getIccId());
            assertEquals(UNAVAILABLE_ICCID, info.getCardString());
        }
        }
    }
    }


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