Merge "Make getSubIdForPhoneAccountHandle Public"
am: dfd0429259
Change-Id: I5626161730f242d96eb821ed72ecc0e8c7cfbb27
This commit is contained in:
@@ -45021,6 +45021,7 @@ package android.telephony {
|
|||||||
method @Nullable public CharSequence getSimSpecificCarrierIdName();
|
method @Nullable public CharSequence getSimSpecificCarrierIdName();
|
||||||
method public int getSimState();
|
method public int getSimState();
|
||||||
method public int getSimState(int);
|
method public int getSimState(int);
|
||||||
|
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getSubIdForPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle);
|
||||||
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId();
|
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId();
|
||||||
method public int getSupportedModemCount();
|
method public int getSupportedModemCount();
|
||||||
method @Nullable public String getTypeAllocationCode();
|
method @Nullable public String getTypeAllocationCode();
|
||||||
|
|||||||
@@ -9448,16 +9448,28 @@ public class TelephonyManager {
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getSubIdForPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) {
|
/**
|
||||||
|
* Returns the subscription ID for the given phone account handle.
|
||||||
|
*
|
||||||
|
* @param phoneAccountHandle the phone account handle for outgoing calls
|
||||||
|
* @return subscription ID for the given phone account handle; or
|
||||||
|
* {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}
|
||||||
|
* if not available; or throw a SecurityException if the caller doesn't have the
|
||||||
|
* permission.
|
||||||
|
*/
|
||||||
|
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
||||||
|
public int getSubIdForPhoneAccountHandle(@NonNull PhoneAccountHandle phoneAccountHandle) {
|
||||||
int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||||
try {
|
try {
|
||||||
ITelecomService service = getTelecomService();
|
ITelephony service = getITelephony();
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
retval = getSubIdForPhoneAccount(service.getPhoneAccount(phoneAccountHandle));
|
retval = service.getSubIdForPhoneAccountHandle(
|
||||||
|
phoneAccountHandle, mContext.getOpPackageName());
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException ex) {
|
||||||
|
Log.e(TAG, "getSubIdForPhoneAccountHandle RemoteException", ex);
|
||||||
|
ex.rethrowAsRuntimeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1308,6 +1308,12 @@ interface ITelephony {
|
|||||||
*/
|
*/
|
||||||
int getSubIdForPhoneAccount(in PhoneAccount phoneAccount);
|
int getSubIdForPhoneAccount(in PhoneAccount phoneAccount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the subscription ID associated with the specified PhoneAccountHandle.
|
||||||
|
*/
|
||||||
|
int getSubIdForPhoneAccountHandle(in PhoneAccountHandle phoneAccountHandle,
|
||||||
|
String callingPackage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the PhoneAccountHandle associated with a subscription ID.
|
* Returns the PhoneAccountHandle associated with a subscription ID.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user