From 80c32a37b63ceff885199e22a8505ac557c86d35 Mon Sep 17 00:00:00 2001 From: "duckyoung.chai" Date: Thu, 15 Sep 2011 16:12:51 +0900 Subject: [PATCH] [toro] Add telephonyManager API ( getMsisdnNumber() ) for IMS Module. IMS Module need the MSISDN value for IMS registration.(VZW Requirement) Change-Id: I8713b6c55788276246ee1c2f91eaf2d3ab8cc813 Signed-off-by: duckyoung.chai --- .../android/telephony/TelephonyManager.java | 20 +++++++++++++++++++ .../internal/telephony/IPhoneSubInfo.aidl | 5 +++++ .../internal/telephony/PhoneSubInfo.java | 8 ++++++++ .../internal/telephony/PhoneSubInfoProxy.java | 7 +++++++ 4 files changed, 40 insertions(+) mode change 100644 => 100755 telephony/java/android/telephony/TelephonyManager.java mode change 100644 => 100755 telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl mode change 100644 => 100755 telephony/java/com/android/internal/telephony/PhoneSubInfo.java mode change 100644 => 100755 telephony/java/com/android/internal/telephony/PhoneSubInfoProxy.java diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java old mode 100644 new mode 100755 index c59dd3c82b16f..8ead45ebb9539 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -761,6 +761,26 @@ public class TelephonyManager { } } + /** + * Returns the MSISDN string. + * for a GSM phone. Return null if it is unavailable. + *

+ * Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * + * @hide + */ + public String getMsisdn() { + try { + return getSubscriberInfo().getMsisdn(); + } catch (RemoteException ex) { + return null; + } catch (NullPointerException ex) { + // This could happen before phone restarts due to crashing + return null; + } + } + /** * Returns the voice mail number. Return null if it is unavailable. *

diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl old mode 100644 new mode 100755 index def770f4ed885..da0326c4721eb --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -53,6 +53,11 @@ interface IPhoneSubInfo { */ String getLine1AlphaTag(); + /** + * Retrieves MSISDN Number. + */ + String getMsisdn(); + /** * Retrieves the voice mail number. */ diff --git a/telephony/java/com/android/internal/telephony/PhoneSubInfo.java b/telephony/java/com/android/internal/telephony/PhoneSubInfo.java old mode 100644 new mode 100755 index de18d0a8c6ae5..e8449cefe16c1 --- a/telephony/java/com/android/internal/telephony/PhoneSubInfo.java +++ b/telephony/java/com/android/internal/telephony/PhoneSubInfo.java @@ -104,6 +104,14 @@ public class PhoneSubInfo extends IPhoneSubInfo.Stub { return (String) mPhone.getLine1AlphaTag(); } + /** + * Retrieves the MSISDN string. + */ + public String getMsisdn() { + mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE"); + return mPhone.getMsisdn(); + } + /** * Retrieves the voice mail number. */ diff --git a/telephony/java/com/android/internal/telephony/PhoneSubInfoProxy.java b/telephony/java/com/android/internal/telephony/PhoneSubInfoProxy.java old mode 100644 new mode 100755 index a287b2e9f4f47..bd130deb00d48 --- a/telephony/java/com/android/internal/telephony/PhoneSubInfoProxy.java +++ b/telephony/java/com/android/internal/telephony/PhoneSubInfoProxy.java @@ -74,6 +74,13 @@ public class PhoneSubInfoProxy extends IPhoneSubInfo.Stub { return mPhoneSubInfo.getLine1AlphaTag(); } + /** + * Retrieves the MSISDN Number. + */ + public String getMsisdn() { + return mPhoneSubInfo.getMsisdn(); + } + /** * Retrieves the voice mail number. */