diff options
| author | 2025-02-08 15:27:23 -0800 | |
|---|---|---|
| committer | 2025-02-08 15:27:23 -0800 | |
| commit | 34c706fb9cd96feb3b0b05358fdce02734abe534 (patch) | |
| tree | 323e00f73a385bc8b67dd472f24f99dca53442ee | |
| parent | a0d90e73560c08bea62f04ddfc19f6ff805fdb0c (diff) | |
| parent | 85c368a6f422e39ac1ae4656d94429b6bd1db420 (diff) | |
Merge "Fixed incorrect permission check" into main
| -rw-r--r-- | telephony/java/android/telephony/SubscriptionManager.java | 6 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ISub.aidl | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index e0af22369182..d2741ac7ee9f 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -4821,10 +4821,14 @@ public class SubscriptionManager { + "Invalid subscriptionId: " + subscriptionId); } + String contextPkg = mContext != null ? mContext.getOpPackageName() : "<unknown>"; + String contextAttributionTag = mContext != null ? mContext.getAttributionTag() : null; + try { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { - return iSub.isSubscriptionAssociatedWithCallingUser(subscriptionId); + return iSub.isSubscriptionAssociatedWithCallingUser(subscriptionId, contextPkg, + contextAttributionTag); } else { throw new IllegalStateException("subscription service unavailable."); } diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index 1bfec29a3cf4..a974c615a4ae 100644 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -347,13 +347,17 @@ interface ISub { * Returns whether the given subscription is associated with the calling user. * * @param subscriptionId the subscription ID of the subscription + * @param callingPackage The package maing the call + * @param callingFeatureId The feature in the package + * @return {@code true} if the subscription is associated with the user that the current process * is running in; {@code false} otherwise. * * @throws IllegalArgumentException if subscription doesn't exist. * @throws SecurityException if the caller doesn't have permissions required. */ - boolean isSubscriptionAssociatedWithCallingUser(int subscriptionId); + boolean isSubscriptionAssociatedWithCallingUser(int subscriptionId, String callingPackage, + String callingFeatureId); /** * Check if subscription and user are associated with each other. |