diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2013-08-21 16:10:43 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2013-08-21 16:10:43 -0700 |
commit | db352bcbb8bda9e6b571376ff4b4c3a99cb431bd (patch) | |
tree | 3d4594c562065b437fee006fa0145b4415e31b7f | |
parent | b75020174482c2e4011f3be61c5c433e0742be9b (diff) | |
parent | e0cba1301e54d849c37a5f36d35829a0d22bffa6 (diff) | |
download | android_packages_apps_Dialer-db352bcbb8bda9e6b571376ff4b4c3a99cb431bd.tar.gz android_packages_apps_Dialer-db352bcbb8bda9e6b571376ff4b4c3a99cb431bd.tar.bz2 android_packages_apps_Dialer-db352bcbb8bda9e6b571376ff4b4c3a99cb431bd.zip |
Merge "MSIM: Add voice mail subscription prompt for MSIM"
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 6ae58b359..1f66c5fdb 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -1724,23 +1724,45 @@ public class DialpadFragment extends Fragment * @see MSimTelephonyManager#getVoiceMailNumber() */ private boolean isVoicemailAvailable() { - try { - if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { + boolean promptEnabled = Settings.Global.getInt(getActivity().getContentResolver(), + Settings.Global.MULTI_SIM_VOICE_PROMPT, 0) == 1; + Log.d(TAG, "prompt enabled : "+ promptEnabled); + if (promptEnabled) { + return hasVMNumber(); + } else { + try { mSubscription = MSimTelephonyManager.getDefault().getPreferredVoiceSubscription(); - Log.d(TAG, "Voicemail preferred sub id = "+ mSubscription); - - return (MSimTelephonyManager.getDefault(). - getVoiceMailNumber(mSubscription) != null); - } else { - return (TelephonyManager.getDefault().getVoiceMailNumber() != null); + if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { + return (MSimTelephonyManager.getDefault(). + getVoiceMailNumber(mSubscription) != null); + } else { + return (TelephonyManager.getDefault().getVoiceMailNumber() != null); + } + } catch (SecurityException se) { + // Possibly no READ_PHONE_STATE privilege. + Log.e(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient."); } - } catch (SecurityException se) { - // Possibly no READ_PHONE_STATE privilege. - Log.e(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient."); } return false; } + private boolean hasVMNumber() { + boolean hasVMNum = false; + int phoneCount = MSimTelephonyManager.getDefault().getPhoneCount(); + for (int i = 0; i < phoneCount; i++) { + try { + hasVMNum = MSimTelephonyManager.getDefault().getVoiceMailNumber(i) != null; + } catch (SecurityException se) { + // Possibly no READ_PHONE_STATE privilege. + Log.e(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient."); + } + if (hasVMNum) { + break; + } + } + return hasVMNum; + } + /** * Returns true of the newDigit parameter can be added at the current selection * point, otherwise returns false. |