From 6bb21401a4e7c8d1ed4f60a5b1572ce78b5311f6 Mon Sep 17 00:00:00 2001 From: xinhe Date: Wed, 15 Oct 2014 14:05:26 -0700 Subject: [PATCH] Sprint: MMS proxy authorization does not include NAI Read the NAI from CSIM and pass it to MMS module Bug:17752727 Change-Id: Ib7f53bed87183bd9e67103c676218b5748be668f --- .../android/telephony/TelephonyManager.java | 26 +++++++++++++++++++ .../internal/telephony/IPhoneSubInfo.aidl | 5 ++++ 2 files changed, 31 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 7173637b85430..d3cef4a1c88e9 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -668,6 +668,32 @@ public class TelephonyManager { } } + /** + * Returns the NAI. Return null if NAI is not available. + * + */ + /** {@hide}*/ + public String getNai() { + return getNai(getDefaultSim()); + } + + /** + * Returns the NAI. Return null if NAI is not available. + * + * @param slotId of which Nai is returned + */ + /** {@hide}*/ + public String getNai(int slotId) { + long[] subId = SubscriptionManager.getSubId(slotId); + try { + return getSubscriberInfo().getNaiForSubscriber(subId[0]); + } catch (RemoteException ex) { + return null; + } catch (NullPointerException ex) { + return null; + } + } + /** * Returns the current location of the device. *

diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index d7062034c6c69..98fd70caf1209 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -27,6 +27,11 @@ interface IPhoneSubInfo { */ String getDeviceId(); + /** + * Retrieves the unique Network Access ID + */ + String getNaiForSubscriber(long subId); + /** * Retrieves the unique device ID of a subId for the device, e.g., IMEI * for GSM phones.