diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-10-22 01:19:22 +0100 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-10-22 01:19:22 +0100 |
commit | 2ee08a4b6c334f5ccb00bff110ea8a745d74c1f9 (patch) | |
tree | 0507d804e1becae7ef33c663daaa49ab9e3fc1ff | |
parent | 79f64c387eb500ca5fbe09eb9a20521a605ec58d (diff) | |
parent | 7ddec204e8ae0037d38bdf3f4e907a65b62b8a85 (diff) | |
download | android_packages_apps_Dialer-2ee08a4b6c334f5ccb00bff110ea8a745d74c1f9.tar.gz android_packages_apps_Dialer-2ee08a4b6c334f5ccb00bff110ea8a745d74c1f9.tar.bz2 android_packages_apps_Dialer-2ee08a4b6c334f5ccb00bff110ea8a745d74c1f9.zip |
Merge branch 'qcril' into cm-10.2
-rw-r--r-- | res/drawable-hdpi/ic_add_group_holo_dark.png | bin | 0 -> 2230 bytes | |||
-rwxr-xr-x | res/drawable-hdpi/ic_dialpad_holo_dark.png | bin | 0 -> 1389 bytes | |||
-rw-r--r-- | res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png | bin | 0 -> 6870 bytes | |||
-rw-r--r-- | res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png | bin | 0 -> 5697 bytes | |||
-rw-r--r-- | res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png | bin | 0 -> 8294 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_add_group_holo_dark.png | bin | 0 -> 1441 bytes | |||
-rwxr-xr-x | res/drawable-mdpi/ic_dialpad_holo_dark.png | bin | 0 -> 1095 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/ic_add_group_holo_dark.png | bin | 0 -> 3181 bytes | |||
-rwxr-xr-x | res/drawable-xhdpi/ic_dialpad_holo_dark.png | bin | 0 -> 1439 bytes | |||
-rw-r--r-- | res/layout-land/dialpad_fragment.xml | 50 | ||||
-rw-r--r-- | res/layout/dialpad_fragment.xml | 59 | ||||
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 11 | ||||
-rw-r--r-- | src/com/android/dialer/SpecialCharSequenceMgr.java | 81 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 204 |
15 files changed, 368 insertions, 39 deletions
diff --git a/res/drawable-hdpi/ic_add_group_holo_dark.png b/res/drawable-hdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..6d46ccffb --- /dev/null +++ b/res/drawable-hdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-hdpi/ic_dialpad_holo_dark.png b/res/drawable-hdpi/ic_dialpad_holo_dark.png Binary files differnew file mode 100755 index 000000000..a0ab6c453 --- /dev/null +++ b/res/drawable-hdpi/ic_dialpad_holo_dark.png diff --git a/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..54f247ad1 --- /dev/null +++ b/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..a984b568b --- /dev/null +++ b/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..3688e466b --- /dev/null +++ b/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-mdpi/ic_add_group_holo_dark.png b/res/drawable-mdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..a676ab886 --- /dev/null +++ b/res/drawable-mdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-mdpi/ic_dialpad_holo_dark.png b/res/drawable-mdpi/ic_dialpad_holo_dark.png Binary files differnew file mode 100755 index 000000000..b57fcf344 --- /dev/null +++ b/res/drawable-mdpi/ic_dialpad_holo_dark.png diff --git a/res/drawable-xhdpi/ic_add_group_holo_dark.png b/res/drawable-xhdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..85924aba4 --- /dev/null +++ b/res/drawable-xhdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-xhdpi/ic_dialpad_holo_dark.png b/res/drawable-xhdpi/ic_dialpad_holo_dark.png Binary files differnew file mode 100755 index 000000000..f9a002c79 --- /dev/null +++ b/res/drawable-xhdpi/ic_dialpad_holo_dark.png diff --git a/res/layout-land/dialpad_fragment.xml b/res/layout-land/dialpad_fragment.xml index b3e508915..2118d82e2 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" /> + <!-- recipients replaces digits and deleteButton when + dial conference controls are made visible. --> + <EditText + android:id="@+id/recipients" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="match_parent" + android:layout_gravity="center" + android:layout_marginLeft="8dip" + android:autoText="true" + android:textSize="16sp" + android:hint="@string/to_hint" + android:minHeight="48dip" + android:maxLines="3" + android:maxLength="2000" + android:textColor="?android:attr/textColorPrimary" + android:background="@android:color/transparent"/> + + </LinearLayout> <!-- "Dialpad chooser" UI, shown only when the user brings up the @@ -70,17 +89,32 @@ <!-- Keypad section --> <include layout="@layout/dialpad" /> + <View + android:id="@+id/dialpadStub" + android:layout_width="match_parent" + android:layout_height="0px" + android:layout_weight="@integer/dialpad_layout_weight_dialpad" + android:layout_gravity="center_horizontal" + android:layout_marginTop="@dimen/dialpad_vertical_margin" + android:paddingLeft="5dip" + android:paddingRight="5dip" + android:paddingBottom="10dip" + android:background="@drawable/dialpad_background"/> </LinearLayout> <View android:layout_width="@dimen/dialpad_center_margin" android:layout_height="match_parent" android:background="@color/dialpad_switch_bg"/> - <RelativeLayout + <TableLayout android:id="@+id/dialButtonContainer" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" android:background="@drawable/dialpad_background"> + + <TableRow + android:layout_height="match_parent" + android:layout_weight="1"> <View android:layout_width="match_parent" android:layout_height="@dimen/dialpad_button_margin" @@ -94,5 +128,17 @@ android:background="@drawable/btn_call" android:contentDescription="@string/description_dial_button" android:src="@drawable/ic_dial_action_call" /> - </RelativeLayout> + <!-- src for image for the button will be changed dynamically in the code. + See DialpadFragment.--> + <ImageButton + android:id="@+id/dialConferenceButton" + android:layout_width="match_parent" + android:layout_height="@dimen/call_button_height" + android:layout_alignParentBottom="true" + android:state_enabled="false" + android:background="@drawable/btn_call" + android:contentDescription="@string/dial_conference" + android:src="@drawable/ic_add_group_holo_dark" /> + </TableRow> + </TableLayout> </LinearLayout> 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" /> + + <!-- recipients replaces digits and deleteButton when + dial conference controls are made visible. --> + <EditText + android:id="@+id/recipients" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="match_parent" + android:layout_gravity="center" + android:layout_marginLeft="8dip" + android:autoText="true" + android:textSize="16sp" + android:hint="@string/to_hint" + android:minHeight="48dip" + android:maxLines="3" + android:maxLength="2000" + android:textColor="?android:attr/textColorPrimary" + android:background="@android:color/transparent"/> </LinearLayout> <!-- Smart dial suggestion section. @@ -85,9 +103,27 @@ <include layout="@layout/dialpad" /> <View style="@style/DialpadHorizontalSeparator"/> + <!-- dialpadStub values are copied from dialpad.xml. dialpadStub replaces dialpad when + dial conference controls are made visible. --> + <View + android:id="@+id/dialpadStub" + android:layout_width="match_parent" + android:layout_height="0px" + android:layout_weight="@integer/dialpad_layout_weight_dialpad" + android:layout_gravity="center_horizontal" + android:layout_marginTop="@dimen/dialpad_vertical_margin" + android:paddingLeft="5dip" + android:paddingRight="5dip" + android:paddingBottom="10dip" + android:background="@drawable/dialpad_background"/> + + <View + android:layout_width="match_parent" + android:layout_height="@dimen/dialpad_vertical_margin" + android:background="#66000000"/> <!-- left and right paddings will be modified by the code. See DialpadFragment. --> - <FrameLayout + <TableLayout android:id="@+id/dialButtonContainer" android:layout_width="match_parent" android:layout_height="0px" @@ -95,17 +131,34 @@ android:layout_gravity="center_horizontal" android:background="@drawable/dialpad_background"> + <TableRow + android:layout_height="match_parent" + android:layout_weight="1"> <ImageButton android:id="@+id/dialButton" - android:layout_width="match_parent" + android:layout_width="0dip" android:layout_height="match_parent" + android:layout_weight="1" android:layout_gravity="center" android:state_enabled="false" android:background="@drawable/btn_call" android:contentDescription="@string/description_dial_button" android:src="@drawable/ic_dial_action_call" /> - </FrameLayout> + <!-- src for image for the button will be changed dynamically in the code. + See DialpadFragment.--> + <ImageButton + android:id="@+id/dialConferenceButton" + android:layout_width="0dip" + android:layout_height="match_parent" + android:layout_weight="1" + android:layout_gravity="center" + android:state_enabled="false" + android:background="@drawable/btn_call" + android:contentDescription="@string/description_dial_button" + android:src="@drawable/ic_add_group_holo_dark" /> + </TableRow> + </TableLayout> <!-- "Dialpad chooser" UI, shown only when the user brings up the Dialer while a call is already in progress. diff --git a/res/values/strings.xml b/res/values/strings.xml index 9bf0ee842..889ba4e8d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -511,4 +511,6 @@ <!-- Message displayed when there is no application available to handle the add contact menu option. [CHAR LIMIT=NONE] --> <string name="add_contact_not_available">Re-enable the People application to use this feature.</string> + <string name="dial_conference">Dial conference</string> + <string name="to_hint">1111:to;sip:abby@example.com:bcc;sip:bill@example.com:cc;</string> </resources> diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 93dc4a070..101f6687a 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; @@ -90,6 +93,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 = @@ -1271,7 +1276,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 c913a7098..e8077f225 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. @@ -45,6 +47,7 @@ import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; import android.provider.ContactsContract; import android.provider.Settings; +import android.telephony.MSimTelephonyManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; @@ -67,6 +70,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; @@ -91,6 +95,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. @@ -106,6 +111,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 = ';'; @@ -129,6 +135,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; @@ -146,6 +155,7 @@ public class DialpadFragment extends Fragment private View mDialButtonContainer; private View mDialButton; + private ImageButton mDialConferenceButton; private ListView mDialpadChooser; private DialpadChooserAdapter mDialpadChooserAdapter; @@ -169,6 +179,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 @@ -185,6 +196,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 @@ -198,6 +213,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() { @@ -215,11 +233,23 @@ 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 (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); + } + } } }; @@ -323,6 +353,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) { @@ -350,6 +390,19 @@ public class DialpadFragment extends Fragment mDialButton = null; } + mDialConferenceButton = (ImageButton) fragmentView.findViewById(R.id.dialConferenceButton); + if(isCallOnImsEnabled()) { + 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); @@ -490,11 +543,27 @@ public class DialpadFragment extends Fragment } } + } else { + 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; } @@ -910,6 +979,10 @@ public class DialpadFragment extends Fragment } return; } + case R.id.dialConferenceButton: { + dialConferenceButtonPressed(); + return; + } default: { Log.wtf(TAG, "Unexpected onClick() event from: " + view); return; @@ -1094,11 +1167,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. @@ -1114,11 +1196,20 @@ 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); + } + intent.putExtra(ADD_PARTICIPANT_KEY, mAddParticipant); startActivity(intent); mClearDigitsOnStop = true; getActivity().finish(); @@ -1131,6 +1222,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 @@ -1259,7 +1357,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); @@ -1273,14 +1374,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); + } } } @@ -1571,8 +1703,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); @@ -1583,18 +1722,48 @@ 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); - } catch (SecurityException se) { - // Possibly no READ_PHONE_STATE privilege. - Log.w(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient."); + 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(); + 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."); + } } 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. @@ -1665,6 +1834,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; } |