diff options
author | Amit Mahajan <amitmahajan@google.com> | 2014-08-21 00:32:14 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-21 00:16:54 +0000 |
commit | dbc6689664156a42ecd2b4bd53ffd772e276bf63 (patch) | |
tree | 189295cd4e9bde88a916067f69131e58e7a4e8b1 /telephony | |
parent | 2d84cdb414fe15fb8d12a870e76b1e9cfdb2e10b (diff) | |
parent | 284f1ec16e816f60cbbf243cebb2de90c50322bb (diff) | |
download | frameworks_base-dbc6689664156a42ecd2b4bd53ffd772e276bf63.zip frameworks_base-dbc6689664156a42ecd2b4bd53ffd772e276bf63.tar.gz frameworks_base-dbc6689664156a42ecd2b4bd53ffd772e276bf63.tar.bz2 |
Merge "Adding APIs to get IMEI/MEID" into lmp-dev
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 31 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl | 4 |
2 files changed, 35 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index d4f8362..0eb170c 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 |