summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorAmit Mahajan <amitmahajan@google.com>2014-08-18 17:49:59 -0700
committerAmit Mahajan <amitmahajan@google.com>2014-08-20 17:02:17 -0700
commit284f1ec16e816f60cbbf243cebb2de90c50322bb (patch)
treec102a2fc4c5bd7d649b61b51b3bf257903ef2ad0 /telephony
parentd504ab14d264e340fac9422b84b5f3c677d87c5f (diff)
downloadframeworks_base-284f1ec16e816f60cbbf243cebb2de90c50322bb.zip
frameworks_base-284f1ec16e816f60cbbf243cebb2de90c50322bb.tar.gz
frameworks_base-284f1ec16e816f60cbbf243cebb2de90c50322bb.tar.bz2
Adding APIs to get IMEI/MEID
Change-Id: I553b7c019b20a64ff1049f35b0e3999ab82b7cce
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java31
-rw-r--r--telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl4
2 files changed, 35 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index c50110a..4ef97eb 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -617,6 +617,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>
* If there is only one radio in the device and that radio has an LTE connection,
diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
index 4734965..552abaf 100644
--- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
+++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
@@ -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