consistent permission check for getSubIdForPhoneAccount

make sure getSubIfForPhoneAccount, getSubIdForPhoneAccountHandle
and getSubscriptionId has consistent permission check

Bug: 183409662
Test: Manual test
Change-Id: I2521883599479f4350c87b9bd8b09db97f88c9b0
This commit is contained in:
Chen Xu
2021-05-14 19:04:52 -07:00
parent 634a9667ef
commit 405b15de70
2 changed files with 3 additions and 12 deletions

View File

@@ -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;
}

View File

@@ -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.
*/