Merge "Adding APIs to get IMEI/MEID" into lmp-dev

This commit is contained in:
Amit Mahajan
2014-08-21 00:32:14 +00:00
committed by Android (Google) Code Review
2 changed files with 35 additions and 0 deletions

View File

@@ -616,6 +616,37 @@ public class TelephonyManager {
}
}
/**
* Returns the IMEI. Return null if IMEI is not available.
*
* <p>Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
*/
/** {@hide} */
public String getImei() {
return getImei(getDefaultSim());
}
/**
* Returns the IMEI. Return null if IMEI is not available.
*
* <p>Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
*
* @param slotId of which deviceID is returned
*/
/** {@hide} */
public String getImei(int slotId) {
long[] subId = SubscriptionManager.getSubId(slotId);
try {
return getSubscriberInfo().getImeiUsingSubId(subId[0]);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
return null;
}
}
/**
* Returns the current location of the device.
*<p>

View File

@@ -33,6 +33,10 @@ interface IPhoneSubInfo {
*/
String getDeviceIdUsingSubId(long subId);
/**
* Retrieves the IMEI.
*/
String getImeiUsingSubId(long subId);
/**
* Retrieves the software version number for the device, e.g., IMEI/SV