Loading src/com/android/dialer/DialtactsActivity.java +12 −1 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); Loading Loading @@ -36,6 +39,7 @@ import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; import android.provider.ContactsContract.Intents.UI; import android.speech.RecognizerIntent; import android.telephony.MSimTelephonyManager; import android.telephony.TelephonyManager; import android.text.Editable; import android.text.TextUtils; Loading Loading @@ -91,6 +95,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private static final String PHONE_PACKAGE = "com.android.phone"; private static final String CALL_SETTINGS_CLASS_NAME = "com.android.phone.CallFeaturesSetting"; private static final String MSIM_CALL_SETTINGS_CLASS_NAME = "com.android.phone.MSimCallFeaturesSetting"; /** @see #getCallOrigin() */ private static final String CALL_ORIGIN_DIALTACTS = "com.android.dialer.DialtactsActivity"; Loading Loading @@ -860,7 +867,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O /** Returns an Intent to launch Call Settings screen */ public static Intent getCallSettingsIntent() { final Intent intent = new Intent(Intent.ACTION_MAIN); if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { intent.setClassName(PHONE_PACKAGE, MSIM_CALL_SETTINGS_CLASS_NAME); } else { intent.setClassName(PHONE_PACKAGE, CALL_SETTINGS_CLASS_NAME); } intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); return intent; } Loading src/com/android/dialer/SpecialCharSequenceMgr.java +71 −16 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Not a Contribution. * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); Loading Loading @@ -30,6 +32,9 @@ import android.net.Uri; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.telephony.MSimTelephonyManager; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.util.Log; Loading @@ -39,6 +44,7 @@ import android.widget.Toast; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.msim.ITelephonyMSim; import com.android.internal.telephony.TelephonyCapabilities; import com.android.internal.telephony.TelephonyIntents; Loading Loading @@ -173,6 +179,8 @@ public class SpecialCharSequenceMgr { } int len = input.length(); Uri uri = null; if ((len > 1) && (len < 5) && (input.endsWith("#"))) { try { // get the ordinal number of the sim contact Loading Loading @@ -209,8 +217,18 @@ public class SpecialCharSequenceMgr { // display the progress dialog sc.progressDialog.show(); if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); String[] adn = {"adn", "adn_sub2", "adn_sub3"}; uri = Uri.parse("content://iccmsim/" + adn[subscription]); } else { uri = Uri.parse("content://icc/adn"); } // run the query. handler.startQuery(ADN_QUERY_TOKEN, sc, Uri.parse("content://icc/adn"), handler.startQuery(ADN_QUERY_TOKEN, sc, uri, new String[]{ADN_PHONE_NUMBER_COLUMN_NAME}, null, null, null); if (sPreviousAdnQueryHandler != null) { Loading @@ -229,8 +247,19 @@ public class SpecialCharSequenceMgr { static boolean handlePinEntry(Context context, String input) { if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { try { if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = 0; // On multisim targets handle PIN/PUK related MMI commands on // Voice preferred subscription. subscription = MSimTelephonyManager.getDefault() .getPreferredVoiceSubscription(); return ITelephonyMSim.Stub.asInterface(ServiceManager.getService("phone_msim")) .handlePinMmi(input, subscription); } else { return ITelephony.Stub.asInterface(ServiceManager.getService("phone")) .handlePinMmi(input); } } catch (RemoteException e) { Log.e(TAG, "Failed to handlePinMmi due to remote exception"); return false; Loading @@ -240,15 +269,24 @@ public class SpecialCharSequenceMgr { } static boolean handleIMEIDisplay(Context context, String input, boolean useSystemWindow) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null && input.equals(MMI_IMEI_DISPLAY)) { int phoneType = telephonyManager.getCurrentPhoneType(); if (input.equals(MMI_IMEI_DISPLAY)) { int phoneType; if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); phoneType = ((MSimTelephonyManager)context.getSystemService( Context.MSIM_TELEPHONY_SERVICE)).getCurrentPhoneType(subscription); } else { phoneType = ((TelephonyManager)context.getSystemService( Context.TELEPHONY_SERVICE)).getCurrentPhoneType(); } if (phoneType == TelephonyManager.PHONE_TYPE_GSM) { showIMEIPanel(context, useSystemWindow, telephonyManager); showIMEIPanel(context, useSystemWindow); return true; } else if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) { showMEIDPanel(context, useSystemWindow, telephonyManager); showMEIDPanel(context, useSystemWindow); return true; } } Loading Loading @@ -278,10 +316,18 @@ public class SpecialCharSequenceMgr { // version of SpecialCharSequenceMgr.java. (This will require moving // the phone app's TelephonyCapabilities.getDeviceIdLabel() method // into the telephony framework, though.) private static void showIMEIPanel(Context context, boolean useSystemWindow) { String imeiStr; if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); private static void showIMEIPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { String imeiStr = telephonyManager.getDeviceId(); imeiStr = ((MSimTelephonyManager)context. getSystemService(Context.MSIM_TELEPHONY_SERVICE)).getDeviceId(subscription); } else { imeiStr = ((TelephonyManager)context. getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); } AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.imei) Loading @@ -291,9 +337,18 @@ public class SpecialCharSequenceMgr { .show(); } private static void showMEIDPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { String meidStr = telephonyManager.getDeviceId(); private static void showMEIDPanel(Context context, boolean useSystemWindow) { String meidStr; if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); meidStr = ((MSimTelephonyManager)context. getSystemService(Context.MSIM_TELEPHONY_SERVICE)).getDeviceId(subscription); } else { meidStr = ((TelephonyManager)context. getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); } AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.meid) Loading src/com/android/dialer/dialpad/DialpadFragment.java +47 −6 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Not a Contribution. * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); Loading Loading @@ -42,6 +44,7 @@ import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; import android.provider.ContactsContract.Intents; import android.provider.Settings; import android.telephony.MSimTelephonyManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; Loading Loading @@ -174,6 +177,8 @@ public class DialpadFragment extends Fragment // This is the amount of screen the dialpad fragment takes up when fully displayed private static final float DIALPAD_SLIDE_FRACTION = 0.67f; private static final String SUBSCRIPTION_KEY = "subscription"; private static final String EMPTY_NUMBER = ""; private static final char PAUSE = ','; private static final char WAIT = ';'; Loading Loading @@ -221,6 +226,7 @@ public class DialpadFragment extends Fragment */ private String mProhibitedPhoneNumberRegexp; private int mSubscription = 0; // Last number dialed, retrieved asynchronously from the call DB // in onCreate. This number is displayed when the user hits the Loading Loading @@ -1606,18 +1612,52 @@ public class DialpadFragment extends Fragment * * @return true if voicemail is enabled and accessibly. Note that this can be false * "temporarily" after the app boot. * @see TelephonyManager#getVoiceMailNumber() * @see MSimTelephonyManager#getVoiceMailNumber() */ private boolean isVoicemailAvailable() { 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 { if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { mSubscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); Log.d(TAG, "Voicemail preferred sub id = "+ mSubscription); return (MSimTelephonyManager.getDefault(). getVoiceMailNumber(mSubscription) != null); } else { return getTelephonyManager().getVoiceMailNumber() != null; } } catch (SecurityException se) { // Possibly no READ_PHONE_STATE privilege. Log.w(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient."); 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, "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. Loading Loading @@ -1692,6 +1732,7 @@ public class DialpadFragment extends Fragment private Intent newFlashIntent() { final Intent intent = CallUtil.getCallIntent(EMPTY_NUMBER); intent.putExtra(EXTRA_SEND_EMPTY_FLASH, true); intent.putExtra(SUBSCRIPTION_KEY, mSubscription); return intent; } Loading Loading
src/com/android/dialer/DialtactsActivity.java +12 −1 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); Loading Loading @@ -36,6 +39,7 @@ import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; import android.provider.ContactsContract.Intents.UI; import android.speech.RecognizerIntent; import android.telephony.MSimTelephonyManager; import android.telephony.TelephonyManager; import android.text.Editable; import android.text.TextUtils; Loading Loading @@ -91,6 +95,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private static final String PHONE_PACKAGE = "com.android.phone"; private static final String CALL_SETTINGS_CLASS_NAME = "com.android.phone.CallFeaturesSetting"; private static final String MSIM_CALL_SETTINGS_CLASS_NAME = "com.android.phone.MSimCallFeaturesSetting"; /** @see #getCallOrigin() */ private static final String CALL_ORIGIN_DIALTACTS = "com.android.dialer.DialtactsActivity"; Loading Loading @@ -860,7 +867,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O /** Returns an Intent to launch Call Settings screen */ public static Intent getCallSettingsIntent() { final Intent intent = new Intent(Intent.ACTION_MAIN); if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { intent.setClassName(PHONE_PACKAGE, MSIM_CALL_SETTINGS_CLASS_NAME); } else { intent.setClassName(PHONE_PACKAGE, CALL_SETTINGS_CLASS_NAME); } intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); return intent; } Loading
src/com/android/dialer/SpecialCharSequenceMgr.java +71 −16 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Not a Contribution. * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); Loading Loading @@ -30,6 +32,9 @@ import android.net.Uri; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.telephony.MSimTelephonyManager; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.util.Log; Loading @@ -39,6 +44,7 @@ import android.widget.Toast; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.msim.ITelephonyMSim; import com.android.internal.telephony.TelephonyCapabilities; import com.android.internal.telephony.TelephonyIntents; Loading Loading @@ -173,6 +179,8 @@ public class SpecialCharSequenceMgr { } int len = input.length(); Uri uri = null; if ((len > 1) && (len < 5) && (input.endsWith("#"))) { try { // get the ordinal number of the sim contact Loading Loading @@ -209,8 +217,18 @@ public class SpecialCharSequenceMgr { // display the progress dialog sc.progressDialog.show(); if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); String[] adn = {"adn", "adn_sub2", "adn_sub3"}; uri = Uri.parse("content://iccmsim/" + adn[subscription]); } else { uri = Uri.parse("content://icc/adn"); } // run the query. handler.startQuery(ADN_QUERY_TOKEN, sc, Uri.parse("content://icc/adn"), handler.startQuery(ADN_QUERY_TOKEN, sc, uri, new String[]{ADN_PHONE_NUMBER_COLUMN_NAME}, null, null, null); if (sPreviousAdnQueryHandler != null) { Loading @@ -229,8 +247,19 @@ public class SpecialCharSequenceMgr { static boolean handlePinEntry(Context context, String input) { if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { try { if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = 0; // On multisim targets handle PIN/PUK related MMI commands on // Voice preferred subscription. subscription = MSimTelephonyManager.getDefault() .getPreferredVoiceSubscription(); return ITelephonyMSim.Stub.asInterface(ServiceManager.getService("phone_msim")) .handlePinMmi(input, subscription); } else { return ITelephony.Stub.asInterface(ServiceManager.getService("phone")) .handlePinMmi(input); } } catch (RemoteException e) { Log.e(TAG, "Failed to handlePinMmi due to remote exception"); return false; Loading @@ -240,15 +269,24 @@ public class SpecialCharSequenceMgr { } static boolean handleIMEIDisplay(Context context, String input, boolean useSystemWindow) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null && input.equals(MMI_IMEI_DISPLAY)) { int phoneType = telephonyManager.getCurrentPhoneType(); if (input.equals(MMI_IMEI_DISPLAY)) { int phoneType; if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); phoneType = ((MSimTelephonyManager)context.getSystemService( Context.MSIM_TELEPHONY_SERVICE)).getCurrentPhoneType(subscription); } else { phoneType = ((TelephonyManager)context.getSystemService( Context.TELEPHONY_SERVICE)).getCurrentPhoneType(); } if (phoneType == TelephonyManager.PHONE_TYPE_GSM) { showIMEIPanel(context, useSystemWindow, telephonyManager); showIMEIPanel(context, useSystemWindow); return true; } else if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) { showMEIDPanel(context, useSystemWindow, telephonyManager); showMEIDPanel(context, useSystemWindow); return true; } } Loading Loading @@ -278,10 +316,18 @@ public class SpecialCharSequenceMgr { // version of SpecialCharSequenceMgr.java. (This will require moving // the phone app's TelephonyCapabilities.getDeviceIdLabel() method // into the telephony framework, though.) private static void showIMEIPanel(Context context, boolean useSystemWindow) { String imeiStr; if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); private static void showIMEIPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { String imeiStr = telephonyManager.getDeviceId(); imeiStr = ((MSimTelephonyManager)context. getSystemService(Context.MSIM_TELEPHONY_SERVICE)).getDeviceId(subscription); } else { imeiStr = ((TelephonyManager)context. getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); } AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.imei) Loading @@ -291,9 +337,18 @@ public class SpecialCharSequenceMgr { .show(); } private static void showMEIDPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { String meidStr = telephonyManager.getDeviceId(); private static void showMEIDPanel(Context context, boolean useSystemWindow) { String meidStr; if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); meidStr = ((MSimTelephonyManager)context. getSystemService(Context.MSIM_TELEPHONY_SERVICE)).getDeviceId(subscription); } else { meidStr = ((TelephonyManager)context. getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); } AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.meid) Loading
src/com/android/dialer/dialpad/DialpadFragment.java +47 −6 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Not a Contribution. * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); Loading Loading @@ -42,6 +44,7 @@ import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; import android.provider.ContactsContract.Intents; import android.provider.Settings; import android.telephony.MSimTelephonyManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; Loading Loading @@ -174,6 +177,8 @@ public class DialpadFragment extends Fragment // This is the amount of screen the dialpad fragment takes up when fully displayed private static final float DIALPAD_SLIDE_FRACTION = 0.67f; private static final String SUBSCRIPTION_KEY = "subscription"; private static final String EMPTY_NUMBER = ""; private static final char PAUSE = ','; private static final char WAIT = ';'; Loading Loading @@ -221,6 +226,7 @@ public class DialpadFragment extends Fragment */ private String mProhibitedPhoneNumberRegexp; private int mSubscription = 0; // Last number dialed, retrieved asynchronously from the call DB // in onCreate. This number is displayed when the user hits the Loading Loading @@ -1606,18 +1612,52 @@ public class DialpadFragment extends Fragment * * @return true if voicemail is enabled and accessibly. Note that this can be false * "temporarily" after the app boot. * @see TelephonyManager#getVoiceMailNumber() * @see MSimTelephonyManager#getVoiceMailNumber() */ private boolean isVoicemailAvailable() { 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 { if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { mSubscription = MSimTelephonyManager.getDefault(). getPreferredVoiceSubscription(); Log.d(TAG, "Voicemail preferred sub id = "+ mSubscription); return (MSimTelephonyManager.getDefault(). getVoiceMailNumber(mSubscription) != null); } else { return getTelephonyManager().getVoiceMailNumber() != null; } } catch (SecurityException se) { // Possibly no READ_PHONE_STATE privilege. Log.w(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient."); 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, "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. Loading Loading @@ -1692,6 +1732,7 @@ public class DialpadFragment extends Fragment private Intent newFlashIntent() { final Intent intent = CallUtil.getCallIntent(EMPTY_NUMBER); intent.putExtra(EXTRA_SEND_EMPTY_FLASH, true); intent.putExtra(SUBSCRIPTION_KEY, mSubscription); return intent; } Loading