Loading telephony/java/android/telephony/PhoneNumberUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -135,9 +135,9 @@ public class PhoneNumberUtils } // TODO: We don't check for SecurityException here (requires // READ_PHONE_STATE permission). // CALL_PRIVILEGED permission). if (scheme.equals("voicemail")) { return TelephonyManager.getDefault().getVoiceMailNumber(); return TelephonyManager.getDefault().getCompleteVoiceMailNumber(); } if (context == null) { Loading telephony/java/android/telephony/TelephonyManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -664,6 +664,25 @@ public class TelephonyManager { } } /** * Returns the complete voice mail number. Return null if it is unavailable. * <p> * Requires Permission: * {@link android.Manifest.permission#CALL_PRIVILEGED CALL_PRIVILEGED} * * @hide */ public String getCompleteVoiceMailNumber() { try { return getSubscriberInfo().getCompleteVoiceMailNumber(); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { // This could happen before phone restarts due to crashing return null; } } /** * Returns the voice mail count. Return 0 if unavailable. * <p> Loading telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ interface IPhoneSubInfo { */ String getVoiceMailNumber(); /** * Retrieves the complete voice mail number. */ String getCompleteVoiceMailNumber(); /** * Retrieves the alpha identifier associated with the voice mail number. */ Loading telephony/java/com/android/internal/telephony/PhoneSubInfo.java +20 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import java.io.PrintWriter; import android.content.Context; import android.content.pm.PackageManager; import android.os.Binder; import android.telephony.PhoneNumberUtils; import android.util.Log; public class PhoneSubInfo extends IPhoneSubInfo.Stub { Loading @@ -29,6 +30,9 @@ public class PhoneSubInfo extends IPhoneSubInfo.Stub { private Context mContext; private static final String READ_PHONE_STATE = android.Manifest.permission.READ_PHONE_STATE; private static final String CALL_PRIVILEGED = // TODO Add core/res/AndriodManifest.xml#READ_PRIVILEGED_PHONE_STATE android.Manifest.permission.CALL_PRIVILEGED; public PhoneSubInfo(Phone phone) { mPhone = phone; Loading Loading @@ -101,7 +105,22 @@ public class PhoneSubInfo extends IPhoneSubInfo.Stub { */ public String getVoiceMailNumber() { mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE"); return (String) mPhone.getVoiceMailNumber(); String number = PhoneNumberUtils.extractNetworkPortion(mPhone.getVoiceMailNumber()); Log.d(LOG_TAG, "VM: PhoneSubInfo.getVoiceMailNUmber: "); // + number); return number; } /** * Retrieves the compelete voice mail number. * * @hide */ public String getCompleteVoiceMailNumber() { mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED, "Requires CALL_PRIVILEGED"); String number = mPhone.getVoiceMailNumber(); Log.d(LOG_TAG, "VM: PhoneSubInfo.getCompleteVoiceMailNUmber: "); // + number); return number; } /** Loading telephony/java/com/android/internal/telephony/PhoneSubInfoProxy.java +7 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,13 @@ public class PhoneSubInfoProxy extends IPhoneSubInfo.Stub { return mPhoneSubInfo.getVoiceMailNumber(); } /** * Retrieves the complete voice mail number. */ public String getCompleteVoiceMailNumber() { return mPhoneSubInfo.getCompleteVoiceMailNumber(); } /** * Retrieves the alpha identifier associated with the voice mail number. */ Loading Loading
telephony/java/android/telephony/PhoneNumberUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -135,9 +135,9 @@ public class PhoneNumberUtils } // TODO: We don't check for SecurityException here (requires // READ_PHONE_STATE permission). // CALL_PRIVILEGED permission). if (scheme.equals("voicemail")) { return TelephonyManager.getDefault().getVoiceMailNumber(); return TelephonyManager.getDefault().getCompleteVoiceMailNumber(); } if (context == null) { Loading
telephony/java/android/telephony/TelephonyManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -664,6 +664,25 @@ public class TelephonyManager { } } /** * Returns the complete voice mail number. Return null if it is unavailable. * <p> * Requires Permission: * {@link android.Manifest.permission#CALL_PRIVILEGED CALL_PRIVILEGED} * * @hide */ public String getCompleteVoiceMailNumber() { try { return getSubscriberInfo().getCompleteVoiceMailNumber(); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { // This could happen before phone restarts due to crashing return null; } } /** * Returns the voice mail count. Return 0 if unavailable. * <p> Loading
telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ interface IPhoneSubInfo { */ String getVoiceMailNumber(); /** * Retrieves the complete voice mail number. */ String getCompleteVoiceMailNumber(); /** * Retrieves the alpha identifier associated with the voice mail number. */ Loading
telephony/java/com/android/internal/telephony/PhoneSubInfo.java +20 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import java.io.PrintWriter; import android.content.Context; import android.content.pm.PackageManager; import android.os.Binder; import android.telephony.PhoneNumberUtils; import android.util.Log; public class PhoneSubInfo extends IPhoneSubInfo.Stub { Loading @@ -29,6 +30,9 @@ public class PhoneSubInfo extends IPhoneSubInfo.Stub { private Context mContext; private static final String READ_PHONE_STATE = android.Manifest.permission.READ_PHONE_STATE; private static final String CALL_PRIVILEGED = // TODO Add core/res/AndriodManifest.xml#READ_PRIVILEGED_PHONE_STATE android.Manifest.permission.CALL_PRIVILEGED; public PhoneSubInfo(Phone phone) { mPhone = phone; Loading Loading @@ -101,7 +105,22 @@ public class PhoneSubInfo extends IPhoneSubInfo.Stub { */ public String getVoiceMailNumber() { mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE"); return (String) mPhone.getVoiceMailNumber(); String number = PhoneNumberUtils.extractNetworkPortion(mPhone.getVoiceMailNumber()); Log.d(LOG_TAG, "VM: PhoneSubInfo.getVoiceMailNUmber: "); // + number); return number; } /** * Retrieves the compelete voice mail number. * * @hide */ public String getCompleteVoiceMailNumber() { mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED, "Requires CALL_PRIVILEGED"); String number = mPhone.getVoiceMailNumber(); Log.d(LOG_TAG, "VM: PhoneSubInfo.getCompleteVoiceMailNUmber: "); // + number); return number; } /** Loading
telephony/java/com/android/internal/telephony/PhoneSubInfoProxy.java +7 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,13 @@ public class PhoneSubInfoProxy extends IPhoneSubInfo.Stub { return mPhoneSubInfo.getVoiceMailNumber(); } /** * Retrieves the complete voice mail number. */ public String getCompleteVoiceMailNumber() { return mPhoneSubInfo.getCompleteVoiceMailNumber(); } /** * Retrieves the alpha identifier associated with the voice mail number. */ Loading