From 1dfd01546403df1d1db4576ddef43be05e8283ae Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 10 Jun 2013 10:21:57 -0700 Subject: Fix crash in Dialer in landscape mode Bug 9369806 Change-Id: I286ebb828c0f6ce7c005c541661b9aa67284847e --- src/com/android/dialer/dialpad/DialpadFragment.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 3d75e3983..5f70312ff 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -368,7 +368,8 @@ public class DialpadFragment extends Fragment mDialpadChooser = (ListView) fragmentView.findViewById(R.id.dialpadChooser); mDialpadChooser.setOnItemClickListener(this); - // Smart dial + // Smart dial container. This is null if in landscape mode since it is not present + // in the landscape dialer layout. mSmartDialContainer = (RelativeLayout) fragmentView.findViewById( R.id.dialpad_smartdial_container); @@ -556,7 +557,7 @@ public class DialpadFragment extends Fragment // retrieve dialpad autocomplete setting mSmartDialEnabled = Settings.Secure.getInt(contentResolver, - Settings.Secure.DIALPAD_AUTOCOMPLETE, 0) == 1; + Settings.Secure.DIALPAD_AUTOCOMPLETE, 0) == 1 && mSmartDialContainer != null; stopWatch.lap("dtwd"); @@ -1731,7 +1732,9 @@ public class DialpadFragment extends Fragment mSmartDialCache.cacheIfNeeded(true); } } else { - mSmartDialContainer.setVisibility(View.GONE); + if (mSmartDialContainer != null) { + mSmartDialContainer.setVisibility(View.GONE); + } mSmartDialCache = null; } } -- cgit v1.2.3 From 6981e3e852864ccf5de9c3077382d237a0c9b8cc Mon Sep 17 00:00:00 2001 From: Shriram Ganesh Date: Fri, 15 Feb 2013 12:01:51 -0800 Subject: IMS: Dialer app changes for IMS IMS Conference URI UI changes 1. Add a new button for initiating conference URI call in the Dial screen. 2. Send a intent for the conference call with a extra to indicate the call type as conference CRs-Fixed: 455241 Enable visibility of digits container for adding call 1. When a call is active, the user goes to home screen and presses the phone button and then chooses add call. The recipients box is not visible as the visibility of digits container is is not VISIBLE. In this change, the visibility of digits container is set to VISBILE. CRs-Fixed: 486790 Change-Id: Ibdf138eb0f32fed68c3bdc4e6d3f99cea68608b1 --- res/drawable-hdpi/ic_add_group_holo_dark.png | Bin 0 -> 2230 bytes res/drawable-hdpi/ic_dialpad_holo_dark.png | Bin 0 -> 1389 bytes res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png | Bin 0 -> 6870 bytes res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png | Bin 0 -> 5697 bytes .../ic_add_group_holo_dark.png | Bin 0 -> 8294 bytes res/drawable-mdpi/ic_add_group_holo_dark.png | Bin 0 -> 1441 bytes res/drawable-mdpi/ic_dialpad_holo_dark.png | Bin 0 -> 1095 bytes res/drawable-xhdpi/ic_add_group_holo_dark.png | Bin 0 -> 3181 bytes res/drawable-xhdpi/ic_dialpad_holo_dark.png | Bin 0 -> 1439 bytes res/layout-land/dialpad_fragment.xml | 50 +++++++- res/layout/dialpad_fragment.xml | 59 ++++++++- res/values/strings.xml | 2 + .../android/dialer/dialpad/DialpadFragment.java | 140 +++++++++++++++++++-- 13 files changed, 235 insertions(+), 16 deletions(-) create mode 100644 res/drawable-hdpi/ic_add_group_holo_dark.png create mode 100755 res/drawable-hdpi/ic_dialpad_holo_dark.png create mode 100644 res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png create mode 100644 res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png create mode 100644 res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png create mode 100644 res/drawable-mdpi/ic_add_group_holo_dark.png create mode 100755 res/drawable-mdpi/ic_dialpad_holo_dark.png create mode 100644 res/drawable-xhdpi/ic_add_group_holo_dark.png create mode 100755 res/drawable-xhdpi/ic_dialpad_holo_dark.png diff --git a/res/drawable-hdpi/ic_add_group_holo_dark.png b/res/drawable-hdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..6d46ccffb Binary files /dev/null and b/res/drawable-hdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-hdpi/ic_dialpad_holo_dark.png b/res/drawable-hdpi/ic_dialpad_holo_dark.png new file mode 100755 index 000000000..a0ab6c453 Binary files /dev/null and b/res/drawable-hdpi/ic_dialpad_holo_dark.png differ diff --git a/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..54f247ad1 Binary files /dev/null and b/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..a984b568b Binary files /dev/null and b/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..3688e466b Binary files /dev/null and b/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-mdpi/ic_add_group_holo_dark.png b/res/drawable-mdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..a676ab886 Binary files /dev/null and b/res/drawable-mdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-mdpi/ic_dialpad_holo_dark.png b/res/drawable-mdpi/ic_dialpad_holo_dark.png new file mode 100755 index 000000000..b57fcf344 Binary files /dev/null and b/res/drawable-mdpi/ic_dialpad_holo_dark.png differ diff --git a/res/drawable-xhdpi/ic_add_group_holo_dark.png b/res/drawable-xhdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..85924aba4 Binary files /dev/null and b/res/drawable-xhdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-xhdpi/ic_dialpad_holo_dark.png b/res/drawable-xhdpi/ic_dialpad_holo_dark.png new file mode 100755 index 000000000..f9a002c79 Binary files /dev/null and b/res/drawable-xhdpi/ic_dialpad_holo_dark.png differ diff --git a/res/layout-land/dialpad_fragment.xml b/res/layout-land/dialpad_fragment.xml index 658a03b7b..0215342ae 100644 --- a/res/layout-land/dialpad_fragment.xml +++ b/res/layout-land/dialpad_fragment.xml @@ -57,6 +57,25 @@ android:contentDescription="@string/description_delete_button" android:src="@drawable/ic_dial_action_delete" /> + + + + + - + + - + + + + diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml index f3bd2a213..fe11c31aa 100644 --- a/res/layout/dialpad_fragment.xml +++ b/res/layout/dialpad_fragment.xml @@ -55,6 +55,24 @@ android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/description_delete_button" android:src="@drawable/ic_dial_action_delete" /> + + + + + + - + - + + + + Re-enable the People application to use this feature. + Dial conference + 1111:to;sip:abby@example.com:bcc;sip:bill@example.com:cc; diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 5f70312ff..b54084e4c 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -66,6 +66,7 @@ import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.EditText; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; @@ -90,6 +91,7 @@ import com.android.phone.common.HapticFeedback; import com.google.common.annotations.VisibleForTesting; import java.util.List; +import com.android.internal.telephony.TelephonyProperties; /** * Fragment that displays a twelve-key phone dialpad. @@ -128,6 +130,9 @@ public class DialpadFragment extends Fragment private View mDigitsContainer; private EditText mDigits; + private EditText mRecipients; + private View mDialpadStub; + /** Remembers if we need to clear digits field when the screen is completely gone. */ private boolean mClearDigitsOnStop; @@ -145,6 +150,7 @@ public class DialpadFragment extends Fragment private View mDialButtonContainer; private View mDialButton; + private ImageButton mDialConferenceButton; private ListView mDialpadChooser; private DialpadChooserAdapter mDialpadChooserAdapter; @@ -197,6 +203,9 @@ public class DialpadFragment extends Fragment private static final String EXTRA_SEND_EMPTY_FLASH = "com.android.phone.extra.SEND_EMPTY_FLASH"; + private static final String EXTRA_DIAL_CONFERENCE_URI = + "com.android.phone.extra.DIAL_CONFERENCE_URI"; + private String mCurrentCountryIso; private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() { @@ -214,11 +223,24 @@ public class DialpadFragment extends Fragment // Note there's a race condition in the UI here: the // dialpad chooser could conceivably disappear (on its // own) at the exact moment the user was trying to select - // one of the choices, which would be confusing. (But at + // one of the choices, which would be confusing. (But at // least that's better than leaving the dialpad chooser // onscreen, but useless...) showDialpadChooser(false); } + + if (state == TelephonyManager.CALL_STATE_IDLE) { + // No existing calls, conference can be originated. + // Note that when there is on going call, add call should not show dial + // conference button since normal dialpad should be used. + // Check if ImsPhone is created, if so enable the conference button. + if (SystemProperties.getBoolean( + TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false)) { + // Note, phone app still need to check if UI option to "Use Ims Always" + // is checked upon receiving dial request. + mDialConferenceButton.setVisibility(View.VISIBLE); + } + } } }; @@ -322,6 +344,16 @@ public class DialpadFragment extends Fragment mDigits.setOnLongClickListener(this); mDigits.addTextChangedListener(this); PhoneNumberFormatter.setPhoneNumberFormattingTextWatcher(getActivity(), mDigits); + + mRecipients = (EditText) fragmentView.findViewById(R.id.recipients); + if (null != mRecipients) { + mRecipients.setVisibility(View.GONE); + mRecipients.addTextChangedListener(this); + } + + mDialpadStub = fragmentView.findViewById(R.id.dialpadStub); + if (null != mDialpadStub) mDialpadStub.setVisibility(View.GONE); + // Check for the presence of the keypad View oneButton = fragmentView.findViewById(R.id.one); if (oneButton != null) { @@ -349,6 +381,20 @@ public class DialpadFragment extends Fragment mDialButton = null; } + mDialConferenceButton = (ImageButton) fragmentView.findViewById(R.id.dialConferenceButton); + if(SystemProperties.getBoolean( + TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false)) { + if (mDialConferenceButton != null) { + mDialConferenceButton.setOnClickListener(this); + mDialConferenceButton.setOnLongClickListener(this); + } + } + else{ + if (mDialConferenceButton != null) { + mDialConferenceButton.setVisibility(View.GONE); + } + } + mDelete = fragmentView.findViewById(R.id.deleteButton); if (mDelete != null) { mDelete.setOnClickListener(this); @@ -489,6 +535,9 @@ public class DialpadFragment extends Fragment } } + } else { + // for add call, show normal dialpad without dial conference button. + mDialConferenceButton.setVisibility(View.GONE); } showDialpadChooser(needToShowDialpadChooser); @@ -909,6 +958,10 @@ public class DialpadFragment extends Fragment } return; } + case R.id.dialConferenceButton: { + dialConferenceButtonPressed(); + return; + } default: { Log.wtf(TAG, "Unexpected onClick() event from: " + view); return; @@ -1093,11 +1146,20 @@ public class DialpadFragment extends Fragment * case described above). */ public void dialButtonPressed() { - if (isDigitsEmpty()) { // No number entered. + boolean isDigitsShown = mDigits.isShown(); + final String number = (isDigitsShown) ? mDigits.getText().toString() : + mRecipients.getText().toString().trim(); + + if (isDigitsShown && isDigitsEmpty()) { // No number entered. handleDialButtonClickWithEmptyDigits(); + } else if (!isDigitsShown && number.isEmpty()) { + // mRecipients must be empty + // TODO add support for conference URI in last number dialed + // use ErrorDialogFragment instead? also see android.app.AlertDialog + android.widget.Toast.makeText(getActivity(), + "Error: Cannot dial. Please provide conference recipients.", + android.widget.Toast.LENGTH_SHORT).show(); } else { - final String number = mDigits.getText().toString(); - // "persist.radio.otaspdial" is a temporary hack needed for one carrier's automated // test equipment. // TODO: clean it up. @@ -1113,11 +1175,19 @@ public class DialpadFragment extends Fragment } // Clear the digits just in case. - mDigits.getText().clear(); + if (isDigitsShown) { + mDigits.getText().clear(); + } else { + mRecipients.getText().clear(); + } } else { final Intent intent = CallUtil.getCallIntent(number, (getActivity() instanceof DialtactsActivity ? ((DialtactsActivity) getActivity()).getCallOrigin() : null)); + if (!isDigitsShown) { + // must be dial conference add extra + intent.putExtra(EXTRA_DIAL_CONFERENCE_URI, true); + } startActivity(intent); mClearDigitsOnStop = true; getActivity().finish(); @@ -1130,6 +1200,13 @@ public class DialpadFragment extends Fragment ((DialtactsActivity) getActivity()).getCallOrigin() : null; } + public void dialConferenceButtonPressed() { + // show dial conference screen if it is not shown + // If it is already shown, show normal dial screen + boolean show = (mRecipients != null) ? !mRecipients.isShown() : false; + showDialConference(show); + } + private void handleDialButtonClickWithEmptyDigits() { if (phoneIsCdma() && phoneIsOffhook()) { // This is really CDMA specific. On GSM is it possible @@ -1258,7 +1335,10 @@ public class DialpadFragment extends Fragment } else { // mDigits is not enclosed by the container. Make the digits field itself gone. mDigits.setVisibility(View.GONE); + if (mDelete != null) mDelete.setVisibility(View.GONE); + if (mRecipients != null) mRecipients.setVisibility(View.GONE); } + if (mDialpadStub != null) mDialpadStub.setVisibility(View.GONE); if (mDialpad != null) mDialpad.setVisibility(View.GONE); if (mDialButtonContainer != null) mDialButtonContainer.setVisibility(View.GONE); @@ -1272,14 +1352,45 @@ public class DialpadFragment extends Fragment mDialpadChooser.setAdapter(mDialpadChooserAdapter); } else { // Log.i(TAG, "Displaying normal Dialer UI."); + showDialConference(false); + if (mDialButtonContainer != null) mDialButtonContainer.setVisibility(View.VISIBLE); + mDialpadChooser.setVisibility(View.GONE); + } + } + + private void showDialConference(boolean enabled) { + // Check if onCreateView() is already called by checking one of View objects. + if (!isLayoutReady()) { + return; + } + Log.d(TAG, "showDialConference " + enabled); + + //change the image of the button + if (enabled) { + if (mRecipients != null) mRecipients.setVisibility(View.VISIBLE); + if (mDialpadStub != null) mDialpadStub.setVisibility(View.VISIBLE); + if (mDigits != null) mDigits.setVisibility(View.GONE); + if (mDelete != null) mDelete.setVisibility(View.GONE); + if (mDialpad != null) mDialpad.setVisibility(View.GONE); + // dial conference view is shown, so button should show dialpad image. + // Pressing the button again will return to normal dialpad view + if(mDialConferenceButton != null) { + mDialConferenceButton.setImageResource(R.drawable.ic_dialpad_holo_dark); + } + } else { if (mDigitsContainer != null) { mDigitsContainer.setVisibility(View.VISIBLE); - } else { - mDigits.setVisibility(View.VISIBLE); } + if (mRecipients != null) mRecipients.setVisibility(View.GONE); + if (mDialpadStub != null) mDialpadStub.setVisibility(View.GONE); + if (mDigits != null) mDigits.setVisibility(View.VISIBLE); + if (mDelete != null) mDelete.setVisibility(View.VISIBLE); if (mDialpad != null) mDialpad.setVisibility(View.VISIBLE); - if (mDialButtonContainer != null) mDialButtonContainer.setVisibility(View.VISIBLE); - mDialpadChooser.setVisibility(View.GONE); + // normal dialpad view is shown, so button should show dial conference image. + // Pressing the button again will show dial conference view + if(mDialConferenceButton != null) { + mDialConferenceButton.setImageResource(R.drawable.ic_add_group_holo_dark); + } } } @@ -1570,8 +1681,15 @@ public class DialpadFragment extends Fragment // Enable the Dial button if some digits have // been entered, or if there is a last dialed number // that could be redialed. - mDialButton.setEnabled(digitsNotEmpty || - !TextUtils.isEmpty(mLastNumberDialed)); + if(mRecipients.getVisibility() != View.VISIBLE) { + mDialButton.setEnabled(digitsNotEmpty || + !TextUtils.isEmpty(mLastNumberDialed)); + } + else { + mDialButton.setEnabled(digitsNotEmpty || + !TextUtils.isEmpty(mLastNumberDialed) || + mRecipients.getText().length() > 0); + } } } mDelete.setEnabled(digitsNotEmpty); -- cgit v1.2.3 From ff28db3a89f1470ebf8f322811283aa901f8a4c8 Mon Sep 17 00:00:00 2001 From: Jiju Kinattingal Date: Sun, 4 Nov 2012 23:18:26 +0530 Subject: Dialer(MSIM): Dialer app support for multisim -Call Settings support for multisim. Use MSimCallFeaturesSetting class to provide all subscription specific Call settings access to user. -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. Change-Id: I9a65978ec9d6b4deba94082e2892030aca620f25 --- src/com/android/dialer/DialtactsActivity.java | 11 ++- src/com/android/dialer/SpecialCharSequenceMgr.java | 81 +++++++++++++++++----- .../android/dialer/dialpad/DialpadFragment.java | 20 +++++- 3 files changed, 92 insertions(+), 20 deletions(-) diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 32339d2cf..cace854f0 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -1,5 +1,7 @@ /* * Copyright (C) 2008 The Android Open Source Project + * Copyright (c) 2013, The Linux Foundation. All rights reserved. + * Not a Contribution. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +41,7 @@ import android.provider.ContactsContract.Intents.UI; import android.support.v13.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; +import android.telephony.MSimTelephonyManager; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; @@ -89,6 +92,8 @@ 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 = @@ -1260,7 +1265,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); - intent.setClassName(PHONE_PACKAGE, CALL_SETTINGS_CLASS_NAME); + 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; } diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java index fdef263fb..78c3e52d6 100644 --- a/src/com/android/dialer/SpecialCharSequenceMgr.java +++ b/src/com/android/dialer/SpecialCharSequenceMgr.java @@ -1,5 +1,7 @@ /* * Copyright (C) 2006 The Android Open Source Project + * Copyright (c) 2013, The Linux Foundation. All rights reserved. + * Not a Contribution. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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; @@ -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; @@ -173,6 +179,9 @@ public class SpecialCharSequenceMgr { } int len = input.length(); + int subscription = 0; + Uri uri = null; + if ((len > 1) && (len < 5) && (input.endsWith("#"))) { try { // get the ordinal number of the sim contact @@ -208,9 +217,18 @@ public class SpecialCharSequenceMgr { // display the progress dialog sc.progressDialog.show(); + subscription = MSimTelephonyManager.getDefault().getPreferredVoiceSubscription(); + + if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { + 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) { @@ -229,8 +247,19 @@ public class SpecialCharSequenceMgr { static boolean handlePinEntry(Context context, String input) { if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { try { - return ITelephony.Stub.asInterface(ServiceManager.getService("phone")) - .handlePinMmi(input); + 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; @@ -240,15 +269,22 @@ 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 subscription = MSimTelephonyManager.getDefault().getPreferredVoiceSubscription(); + int phoneType; + if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { + 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; } } @@ -278,10 +314,16 @@ 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, - TelephonyManager telephonyManager) { - String imeiStr = telephonyManager.getDeviceId(); + private static void showIMEIPanel(Context context, boolean useSystemWindow) { + int subscription = MSimTelephonyManager.getDefault().getPreferredVoiceSubscription(); + String imeiStr; + if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { + 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) @@ -291,9 +333,16 @@ 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) { + int subscription = MSimTelephonyManager.getDefault().getPreferredVoiceSubscription(); + String meidStr; + if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { + 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) diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index b54084e4c..5494991cb 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -1,5 +1,7 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (c) 2013, The Linux Foundation. All rights reserved. + * Not a Contribution. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +46,7 @@ import android.provider.Contacts.People; import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; import android.provider.Settings; +import android.telephony.MSimTelephonyManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; @@ -107,6 +110,7 @@ public class DialpadFragment extends Fragment private static final boolean DEBUG = DialtactsActivity.DEBUG; + private static final String SUBSCRIPTION_KEY = "subscription"; private static final String EMPTY_NUMBER = ""; private static final char PAUSE = ','; private static final char WAIT = ';'; @@ -174,6 +178,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 @@ -1700,14 +1705,22 @@ 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() { try { - return (TelephonyManager.getDefault().getVoiceMailNumber() != null); + if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { + mSubscription = MSimTelephonyManager.getDefault().getPreferredVoiceSubscription(); + Log.d(TAG, "Voicemail preferred sub id = "+ mSubscription); + + return (MSimTelephonyManager.getDefault(). + getVoiceMailNumber(mSubscription) != null); + } else { + return (TelephonyManager.getDefault().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; } @@ -1782,6 +1795,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; } -- cgit v1.2.3 From 053a141e9ba608669af2ad1def32cb7568715ea7 Mon Sep 17 00:00:00 2001 From: Anju Mathapati Date: Mon, 3 Jun 2013 16:53:50 -0700 Subject: IMS: Add Participant feature changes. Includes- - logic for bringing up dialpad while adding participant Change-Id: I415746ff1b6002cc5633a41715a290f0573f8782 CRs-fixed: 476229 --- .../android/dialer/dialpad/DialpadFragment.java | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 5494991cb..6ae58b359 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -195,6 +195,10 @@ public class DialpadFragment extends Fragment /** Identifier for the "Add Call" intent extra. */ private static final String ADD_CALL_MODE_KEY = "add_call_mode"; + /** Identifier for the "Add Participant" intent extra. */ + private static final String ADD_PARTICIPANT_KEY = "add_participant"; + private boolean mAddParticipant = false; + /** * Identifier for intent extra for sending an empty Flash message for * CDMA networks. This message is used by the network to simulate a @@ -239,8 +243,7 @@ public class DialpadFragment extends Fragment // Note that when there is on going call, add call should not show dial // conference button since normal dialpad should be used. // Check if ImsPhone is created, if so enable the conference button. - if (SystemProperties.getBoolean( - TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false)) { + if (isCallOnImsEnabled()) { // Note, phone app still need to check if UI option to "Use Ims Always" // is checked upon receiving dial request. mDialConferenceButton.setVisibility(View.VISIBLE); @@ -387,8 +390,7 @@ public class DialpadFragment extends Fragment } mDialConferenceButton = (ImageButton) fragmentView.findViewById(R.id.dialConferenceButton); - if(SystemProperties.getBoolean( - TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false)) { + if(isCallOnImsEnabled()) { if (mDialConferenceButton != null) { mDialConferenceButton.setOnClickListener(this); mDialConferenceButton.setOnLongClickListener(this); @@ -541,13 +543,26 @@ public class DialpadFragment extends Fragment } } else { - // for add call, show normal dialpad without dial conference button. - mDialConferenceButton.setVisibility(View.GONE); + mAddParticipant = intent.getBooleanExtra(ADD_PARTICIPANT_KEY, false); + if (isCallOnImsEnabled()) { + // for IMS AddParticipant feature add call, show normal + // dialpad with dial conference button. + mDialConferenceButton.setVisibility(View.VISIBLE); + } else { + // for add call, show normal dialpad without dial conference button. + mDialConferenceButton.setVisibility(View.GONE); + } } + Log.d(TAG,"mAddParticipant = " + mAddParticipant); showDialpadChooser(needToShowDialpadChooser); } + private boolean isCallOnImsEnabled() { + return (SystemProperties.getBoolean( + TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false)); + } + public void setStartedFromNewIntent(boolean value) { mStartedFromNewIntent = value; } @@ -1193,6 +1208,7 @@ public class DialpadFragment extends Fragment // must be dial conference add extra intent.putExtra(EXTRA_DIAL_CONFERENCE_URI, true); } + intent.putExtra(ADD_PARTICIPANT_KEY, mAddParticipant); startActivity(intent); mClearDigitsOnStop = true; getActivity().finish(); -- cgit v1.2.3 From e0cba1301e54d849c37a5f36d35829a0d22bffa6 Mon Sep 17 00:00:00 2001 From: Maanasa Gopal Date: Fri, 16 Aug 2013 16:49:26 +0530 Subject: MSIM: Add voice mail subscription prompt for MSIM 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. Based on this check, prompt is displayed in the dialer. Change-Id: I590ea6b4779c8452364b8565be9819d352b7af1f --- .../android/dialer/dialpad/DialpadFragment.java | 44 ++++++++++++++++------ 1 file 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. -- cgit v1.2.3