aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-13 20:37:44 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-13 20:37:44 +0000
commit61a7c85a018a8363ab6bb625c95c509ea8fc90b1 (patch)
treedd98dd366a25c257bc6c90fc99317766d725e76a
parent8306687a206c3f9981d231667aa7c79d05b05ad3 (diff)
parent1846448436559e023a39aac376a53be209411fc2 (diff)
downloadtelephony-61a7c85a018a8363ab6bb625c95c509ea8fc90b1.tar.gz
Change-Id: I728b9bdab164eb7ae2de2b11fd16c6ec51ebf9da
-rw-r--r--src/java/com/android/internal/telephony/SubscriptionController.java16
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java31
2 files changed, 44 insertions, 3 deletions
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
index 49db160450..2243e48938 100644
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
@@ -3228,9 +3228,19 @@ public class SubscriptionController extends ISub.Stub {
@Override
public String getSubscriptionProperty(int subId, String propKey, String callingPackage,
String callingFeatureId) {
- if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mContext, subId, callingPackage,
- callingFeatureId, "getSubscriptionProperty")) {
- return null;
+ switch (propKey) {
+ case SubscriptionManager.GROUP_UUID:
+ if (mContext.checkCallingOrSelfPermission(
+ Manifest.permission.READ_PRIVILEGED_PHONE_STATE) != PERMISSION_GRANTED) {
+ EventLog.writeEvent(0x534e4554, "213457638", Binder.getCallingUid());
+ return null;
+ }
+ break;
+ default:
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mContext, subId,
+ callingPackage, callingFeatureId, "getSubscriptionProperty")) {
+ return null;
+ }
}
final long identity = Binder.clearCallingIdentity();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java
index b79b3178d9..8f2c08ed28 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java
@@ -960,6 +960,37 @@ public class SubscriptionControllerTest extends TelephonyTest {
@Test
@SmallTest
+ public void testGetSubscriptionProperty() throws Exception {
+ testInsertSim();
+ ContentValues values = new ContentValues();
+ values.put(SubscriptionManager.GROUP_UUID, 1);
+ mFakeTelephonyProvider.update(SubscriptionManager.CONTENT_URI, values,
+ SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + 1, null);
+
+ mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
+ mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);
+
+ // should succeed with read phone state permission
+ String prop = mSubscriptionControllerUT.getSubscriptionProperty(1,
+ SubscriptionManager.CB_EXTREME_THREAT_ALERT, mContext.getOpPackageName(),
+ mContext.getAttributionTag());
+
+ assertNotEquals(null, prop);
+
+ // group UUID requires privileged phone state permission
+ prop = mSubscriptionControllerUT.getSubscriptionProperty(1, SubscriptionManager.GROUP_UUID,
+ mContext.getOpPackageName(), mContext.getAttributionTag());
+ assertEquals(null, prop);
+
+ // group UUID should succeed once privileged phone state permission is granted
+ mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE);
+ prop = mSubscriptionControllerUT.getSubscriptionProperty(1, SubscriptionManager.GROUP_UUID,
+ mContext.getOpPackageName(), mContext.getAttributionTag());
+ assertNotEquals(null, prop);
+ }
+
+ @Test
+ @SmallTest
public void testCreateSubscriptionGroupWithCarrierPrivilegePermission() throws Exception {
testInsertSim();
// Adding a second profile and mark as embedded.