From 405b15de70bdc0ae838203a925dc9469165f7019 Mon Sep 17 00:00:00 2001 From: Chen Xu Date: Fri, 14 May 2021 19:04:52 -0700 Subject: [PATCH] consistent permission check for getSubIdForPhoneAccount make sure getSubIfForPhoneAccount, getSubIdForPhoneAccountHandle and getSubscriptionId has consistent permission check Bug: 183409662 Test: Manual test Change-Id: I2521883599479f4350c87b9bd8b09db97f88c9b0 --- telephony/java/android/telephony/TelephonyManager.java | 10 +++------- .../com/android/internal/telephony/ITelephony.aidl | 5 ----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 78da86c57ef13..5151a2c34d4fe 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -11115,14 +11115,10 @@ public class TelephonyManager { @UnsupportedAppUsage public int getSubIdForPhoneAccount(@Nullable PhoneAccount phoneAccount) { int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID; - try { - ITelephony service = getITelephony(); - if (service != null) { - retval = service.getSubIdForPhoneAccount(phoneAccount); - } - } catch (RemoteException e) { + if (phoneAccount != null + && phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) { + retval = getSubscriptionId(phoneAccount.getAccountHandle()); } - return retval; } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 4cd59a24b1826..453eeb59bb354 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1353,11 +1353,6 @@ interface ITelephony { String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage, String callingFeatureId); - /** - * Returns the subscription ID associated with the specified PhoneAccount. - */ - int getSubIdForPhoneAccount(in PhoneAccount phoneAccount); - /** * Returns the subscription ID associated with the specified PhoneAccountHandle. */