aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Groover <mpgroover@google.com>2021-02-09 23:02:38 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-02-09 23:02:38 +0000
commit5811e7e6ce382ff5f178f032e0b32eef04772a4c (patch)
treeb01e510a6edeb51da0743c7d7505809491ae6810
parentf0a7b0dfbc7b3dfefc4b060fadd8838da7ffd8af (diff)
parent7dfee2e7c3f762d069b8c606f8591498f109ff3e (diff)
downloadtelephony-5811e7e6ce382ff5f178f032e0b32eef04772a4c.tar.gz
Guard ICC ID card string behind new identifier access requirements am: 7dfee2e7c3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/13299604 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I1a0e8c0de3dfd85053321de71e4e1de326fc48d1
-rw-r--r--src/java/com/android/internal/telephony/SubscriptionController.java1
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java16
2 files changed, 13 insertions, 4 deletions
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
index 33e0b43d6e..540c8d054f 100644
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
@@ -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;
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java
index 56a623bfa5..ee596706c0 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java
@@ -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);
}
}