Merge "Add getEsn()." into nyc-mr1-dev

am: 16717be173

* commit '16717be1738c29ad4f3dd992121ad4bac8b8d5c1':
  Add getEsn().

Change-Id: I43db23cff359f906b7d6a5bbc50b3cf490a7371c
This commit is contained in:
Youhan Wang
2016-05-12 21:13:43 +00:00
committed by android-build-merger
2 changed files with 44 additions and 0 deletions

View File

@@ -5214,4 +5214,37 @@ public class TelephonyManager {
return null;
}
/**
* Return the Electronic Serial Number.
*
* Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
*
* @return ESN or null if error.
* @hide
*/
public String getEsn() {
return getEsn(getDefaultSubscription());
}
/**
* Return the Electronic Serial Number.
*
* Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
*
* @param subId the subscription ID that this request applies to.
* @return ESN or null if error.
* @hide
*/
public String getEsn(int subId) {
try {
ITelephony service = getITelephony();
if (service != null) {
return service.getEsn(subId);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#getEsn", e);
}
return null;
}
}

View File

@@ -1076,4 +1076,15 @@ interface ITelephony {
* @return Application ID for specificied app type or null if no uicc or error.
*/
String getAidForAppType(int subId, int appType);
/**
* Return the Electronic Serial Number.
*
* Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
*
* @param subId the subscription ID that this request applies to.
* @return ESN or null if error.
* @hide
*/
String getEsn(int subId);
}