diff options
author | Jiju Kinattingal <jijuk@codeaurora.org> | 2012-11-04 23:18:26 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2014-11-04 08:28:20 -0700 |
commit | a3cf17c76fad937fae23ad35fb8a9db67c9d2b96 (patch) | |
tree | bf029cd1ff884b372ea08bc05e84292d8c1a917e | |
parent | 716d4add35921aa899d0186626d85d9c8849db37 (diff) | |
download | android_packages_apps_Dialer-a3cf17c76fad937fae23ad35fb8a9db67c9d2b96.tar.gz android_packages_apps_Dialer-a3cf17c76fad937fae23ad35fb8a9db67c9d2b96.tar.bz2 android_packages_apps_Dialer-a3cf17c76fad937fae23ad35fb8a9db67c9d2b96.zip |
Dialer(MSIM): Dialer app support for multisimstaging/cm-12.0-caf
-Add support to handle the following commands/request on
voice preferred subscription for multisim
1) ADN entry MMI commands.
2) Voicemail dial request.
3) PIN/PUK MMI commands.
-Add voice mail subscription prompt for multisim:
When prompt option is enabled in MultiSIM settings,
check for the voicemail number on all subs and allow
voice mail request if at least one sub has voice mail
number associated with it.
CRs-Fixed: 718068
Conflicts:
src/com/android/dialer/SpecialCharSequenceMgr.java
Change-Id: I9a65978ec9d6b4deba94082e2892030aca620f25
-rw-r--r-- | src/com/android/dialer/SpecialCharSequenceMgr.java | 34 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 35 |
2 files changed, 56 insertions, 13 deletions
diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java index 14b26eccc..ba44555cb 100644 --- a/src/com/android/dialer/SpecialCharSequenceMgr.java +++ b/src/com/android/dialer/SpecialCharSequenceMgr.java @@ -27,9 +27,12 @@ import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Looper; +import android.os.RemoteException; +import android.os.ServiceManager; import android.provider.Settings; import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; +import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Log; import android.view.WindowManager; @@ -38,7 +41,7 @@ import android.widget.Toast; import com.android.common.io.MoreCloseables; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; - +import com.android.internal.telephony.ITelephony; /** * Helper class to listen for some magic character sequences * that are handled specially by the dialer. @@ -208,7 +211,9 @@ public class SpecialCharSequenceMgr { sc.progressDialog.show(); // run the query. - handler.startQuery(ADN_QUERY_TOKEN, sc, Uri.parse("content://icc/adn"), + long subId = SubscriptionManager.getDefaultVoiceSubId(); + Uri uri = Uri.parse("content://icc/adn/subId/" + subId); + handler.startQuery(ADN_QUERY_TOKEN, sc, uri, new String[]{ADN_PHONE_NUMBER_COLUMN_NAME}, null, null, null); if (sPreviousAdnQueryHandler != null) { @@ -226,9 +231,14 @@ public class SpecialCharSequenceMgr { static boolean handlePinEntry(Context context, String input) { if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { - TelecomManager telecomManager = - (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); - return telecomManager.handleMmi(input); + long subId = SubscriptionManager.getDefaultVoiceSubId(); + try { + return ITelephony.Stub.asInterface(ServiceManager.getService( + Context.TELEPHONY_SERVICE)).handlePinMmiForSubscriber(subId, input); + } catch(RemoteException ex) { + Log.e(TAG, "Remote Exception "+ex); + return false; + } } return false; } @@ -237,7 +247,9 @@ public class SpecialCharSequenceMgr { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null && input.equals(MMI_IMEI_DISPLAY)) { - int phoneType = telephonyManager.getPhoneType(); + int phoneType; + long subId = SubscriptionManager.getDefaultVoiceSubId(); + phoneType = telephonyManager.getCurrentPhoneType(subId); if (phoneType == TelephonyManager.PHONE_TYPE_GSM) { showIMEIPanel(context, useSystemWindow, telephonyManager); return true; @@ -272,7 +284,10 @@ public class SpecialCharSequenceMgr { private static void showIMEIPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { - String imeiStr = telephonyManager.getDeviceId(); + String imeiStr = null; + long subId = SubscriptionManager.getDefaultVoiceSubId(); + int slotId = SubscriptionManager.getSlotId(subId); + imeiStr = telephonyManager.getDeviceId(slotId); AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.imei) @@ -284,7 +299,10 @@ public class SpecialCharSequenceMgr { private static void showMEIDPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { - String meidStr = telephonyManager.getDeviceId(); + String meidStr = null; + long subId = SubscriptionManager.getDefaultVoiceSubId(); + int slotId = SubscriptionManager.getSlotId(subId); + meidStr = telephonyManager.getDeviceId(slotId); AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.meid) diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index ee799dd07..6e870cf8c 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -41,6 +41,7 @@ import android.telecom.PhoneAccount; import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; +import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.Editable; import android.text.SpannableString; @@ -1640,15 +1641,39 @@ public class DialpadFragment extends AnalyticsFragment * @see TelephonyManager#getVoiceMailNumber() */ private boolean isVoicemailAvailable() { - try { - return getTelephonyManager().getVoiceMailNumber() != null; - } catch (SecurityException se) { - // Possibly no READ_PHONE_STATE privilege. - Log.w(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient."); + boolean promptEnabled = SubscriptionManager.isVoicePromptEnabled(); + if (promptEnabled) { + hasVMNumber(); + } else { + long subId = SubscriptionManager.getDefaultVoiceSubId(); + try { + return getTelephonyManager().getVoiceMailNumber(subId) != null; + } catch (SecurityException se) { + // Possibly no READ_PHONE_STATE privilege. + Log.w(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient."); + } } return false; } + private boolean hasVMNumber() { + boolean hasVMNum = false; + int phoneCount = getTelephonyManager().getPhoneCount(); + for (int i = 0; i < phoneCount; i++) { + try { + long[] subId = SubscriptionManager.getSubId(i); + hasVMNum = getTelephonyManager().getVoiceMailNumber(subId[0]) != null; + } catch (SecurityException se) { + // Possibly no READ_PHONE_STATE privilege. + Log.e(TAG, "hasVMNumber: SecurityException, 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. |