summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml10
-rw-r--r--res/layout/call_log_list_item_actions.xml18
-rw-r--r--res/menu/dialtacts_options.xml2
-rw-r--r--res/values/colors.xml6
-rw-r--r--res/values/strings.xml35
-rw-r--r--res/values/styles.xml10
-rw-r--r--src/com/android/dialer/DialtactsActivity.java22
-rw-r--r--src/com/android/dialer/calllog/CallDetailHistoryAdapter.java7
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java23
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemHelper.java8
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemViews.java2
-rw-r--r--src/com/android/dialer/calllog/CallTypeHelper.java29
-rw-r--r--src/com/android/dialer/calllog/CallTypeIconsView.java9
-rw-r--r--src/com/android/dialer/calllog/IntentProvider.java10
-rw-r--r--src/com/android/dialer/settings/DialerSettingsActivity.java54
-rw-r--r--tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java33
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java15
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java2
18 files changed, 253 insertions, 42 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index bacec34f6..03b349f69 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -122,6 +122,13 @@
</intent-filter>
</activity>
+ <activity android:name="com.android.dialer.settings.DialerSettingsActivity"
+ android:label="@string/dialer_settings_label"
+ android:parentActivityName="com.android.dialer.DialtactsActivity"
+ android:theme="@style/SettingsStyle"
+ android:exported="false">
+ </activity>
+
<activity android:name="com.android.dialer.calllog.CallLogActivity"
android:label="@string/call_log_activity_title"
android:theme="@style/DialtactsThemeWithoutActionBarOverlay"
@@ -270,7 +277,8 @@
android:launchMode="singleInstance"
android:configChanges="keyboardHidden"
android:exported="false"
- android:process="com.android.incallui">
+ android:process="com.android.incallui"
+ android:screenOrientation="nosensor">
</activity>
<!-- BroadcastReceiver for receiving Intents from Notification mechanism. -->
diff --git a/res/layout/call_log_list_item_actions.xml b/res/layout/call_log_list_item_actions.xml
index 22fcca0c2..ac83f4ac8 100644
--- a/res/layout/call_log_list_item_actions.xml
+++ b/res/layout/call_log_list_item_actions.xml
@@ -41,6 +41,22 @@
android:textSize="@dimen/call_log_list_item_actions_text_size"
android:textStyle="bold"
android:nextFocusLeft="@+id/primary_action_view"
+ android:nextFocusRight="@+id/video_call_action"
+ android:focusable="true"
+ android:singleLine="true"/>
+ <TextView
+ android:id="@+id/video_call_action"
+ android:background="@drawable/action_button_background"
+ android:gravity="center"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:paddingStart="@dimen/call_log_action_horizontal_padding"
+ android:paddingEnd="@dimen/call_log_action_horizontal_padding"
+ android:text="@string/call_log_action_video_call"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="@dimen/call_log_list_item_actions_text_size"
+ android:textStyle="bold"
+ android:nextFocusLeft="@+id/call_back_action"
android:nextFocusRight="@+id/voicemail_action"
android:focusable="true"
android:singleLine="true"/>
@@ -56,7 +72,7 @@
android:textColor="@color/call_log_action_text"
android:textSize="@dimen/call_log_list_item_actions_text_size"
android:textStyle="bold"
- android:nextFocusLeft="@+id/call_back_action"
+ android:nextFocusLeft="@+id/video_call_action"
android:nextFocusRight="@+id/details_action"
android:focusable="true"
android:singleLine="true"/>
diff --git a/res/menu/dialtacts_options.xml b/res/menu/dialtacts_options.xml
index 17f4d9fe1..cc5e3868e 100644
--- a/res/menu/dialtacts_options.xml
+++ b/res/menu/dialtacts_options.xml
@@ -30,6 +30,6 @@
android:title="@string/menu_newContact"/>
<item
android:id="@+id/menu_call_settings"
- android:title="@string/call_settings"
+ android:title="@string/dialer_settings_label"
android:orderInCategory="2" />
</menu>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 6624c2d80..cbf737cb2 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -21,6 +21,12 @@
<color name="dialtacts_secondary_text_color">#888888</color>
<color name="dialer_accent_color">#eeff41</color>
+ <!-- Color for the setting text. -->
+ <color name="setting_primary_color">#4d4c4c</color>
+ <!-- Color for the setting description text. -->
+ <color name="setting_secondary_color">#989898</color>
+ <color name="setting_background_color">#ffffff</color>
+
<!-- Color of the text describing an unconsumed missed call. -->
<color name="call_log_missed_call_highlight_color">#FF0000</color>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e51aff714..17984fd26 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -329,8 +329,8 @@
<!-- Menu item to select account used to make phone calls [CHAR LIMIT=30] -->
<string name="menu_select_account">Select Account</string>
- <!-- Menu item label for call settings [CHAR LIMIT=30] -->
- <string name="call_settings">Settings</string>
+ <!-- Label for the dialer app setting page [CHAR LIMIT=30]-->
+ <string name="dialer_settings_label">Settings</string>
<!-- Menu item to create a new contact [CHAR LIMIT=30] -->
<string name="menu_newContact">New contact</string>
@@ -425,6 +425,14 @@
-->
<string name="description_num_calls"><xliff:g id="numberOfCalls">%1$s</xliff:g> calls.</string>
+ <!-- String indicating a call log entry had video capabilities.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ [CHAR LIMIT=NONE]
+ -->
+ <string name="description_video_call">Video call.</string>
+
<!-- String describing the button to SMS a number or contact.
Note: AccessibilityServices use this attribute to announce what the view represents.
@@ -641,21 +649,6 @@
[CHAR LIMIT=NONE] -->
<string name="description_outgoing_call">Call to <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>.</string>
- <!-- String describing an incoming missed video call entry in the call log.
- Note: AccessibilityServices uses this attribute to announce what the view represents.
- [CHAR LIMIT=NONE] -->
- <string name="description_incoming_missed_video_call">Missed video call from <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>.</string>
-
- <!-- String describing an incoming answered video call entry in the call log.
- Note: AccessibilityServices uses this attribute to announce what the view represents.
- [CHAR LIMIT=NONE] -->
- <string name="description_incoming_answered_video_call">Answered video call from <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>.</string>
-
- <!-- String describing an outgoing video call entry in the call log.
- Note: AccessibilityServices uses this attribute to announce what the view represents.
- [CHAR LIMIT=NONE] -->
- <string name="description_outgoing_video_call">Video call to <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>.</string>
-
<!-- String describing the "call back" action for an entry in the call log. The call back
action triggers a return call to the named user.
Note: AccessibilityServices uses this attribute to announce the purpose of the button.
@@ -750,4 +743,12 @@
<!-- Delimeter used between each item in a textual list; for example "Alpha, Beta".
[CHAR LIMIT=3] -->
<string name="list_delimeter">", "</string>
+
+ <!-- Dialer settings related strings-->
+
+ <!-- Label for the call settings section [CHAR LIMIT=30]-->
+ <string name="call_settings_label">Call Settings</string>
+
+ <!-- Label for the call settings section description [CHAR LIMIT=80]-->
+ <string name="call_settings_description">Ringtones, voicemail settings, VoIP calling, etc</string>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 0140db8e1..5df218b16 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -28,6 +28,7 @@
<item name="android:homeAsUpIndicator">@drawable/ic_back_arrow</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:listViewStyle">@style/ListViewStyle</item>
+ <item name="android:overlapAnchor">true</item>
<item name="activated_background">@drawable/list_item_activated_background</item>
<item name="section_header_background">@drawable/list_title_holo</item>
<item name="list_section_header_height">32dip</item>
@@ -150,4 +151,13 @@
<item name="android:paddingLeft">@dimen/dismiss_button_padding_start</item>
<item name="android:paddingRight">@dimen/dismiss_button_padding_end</item>
</style>
+
+ <!-- Style applied to the "Settings" screen. Keep in sync with SettingsLight in Telephony. -->
+ <style name="SettingsStyle" parent="DialtactsThemeWithoutActionBarOverlay">
+ <!-- Setting text. -->
+ <item name="android:textColorSecondary">@color/setting_primary_color</item>
+ <!-- Setting description. -->
+ <item name="android:textColorTertiary">@color/setting_secondary_color</item>
+ <item name="android:windowBackground">@color/setting_background_color</item>
+ </style>
</resources>
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 4965647e7..a19964b60 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -42,6 +42,7 @@ import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.DragEvent;
+import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
@@ -81,6 +82,7 @@ import com.android.dialer.list.RegularSearchFragment;
import com.android.dialer.list.SearchFragment;
import com.android.dialer.list.SmartDialSearchFragment;
import com.android.dialer.list.SpeedDialFragment;
+import com.android.dialer.settings.DialerSettingsActivity;
import com.android.dialer.util.DialerUtils;
import com.android.dialer.widget.ActionBarController;
import com.android.dialer.widget.SearchEditTextLayout;
@@ -110,9 +112,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
- /** Temporary flag for disabling account selection menu */
- public static final boolean ENABLE_ACCOUNT_SELECT = false;
-
public static final String SHARED_PREFS_NAME = "com.android.dialer_preferences";
/** Used to open Call Setting */
@@ -215,6 +214,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
*/
private String mPendingSearchViewQuery;
+ private PopupMenu mOverflowMenu;
private EditText mSearchView;
private View mVoiceSearchButton;
@@ -237,7 +237,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private class OptionsPopupMenu extends PopupMenu {
public OptionsPopupMenu(Context context, View anchor) {
- super(context, anchor);
+ super(context, anchor, Gravity.END);
}
@Override
@@ -395,8 +395,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
ImageButton optionsMenuButton =
(ImageButton) searchEditTextLayout.findViewById(R.id.dialtacts_options_menu_button);
optionsMenuButton.setOnClickListener(this);
- final OptionsPopupMenu optionsMenu = buildOptionsMenu(optionsMenuButton);
- optionsMenuButton.setOnTouchListener(optionsMenu.getDragToOpenListener());
+ mOverflowMenu = buildOptionsMenu(searchEditTextLayout);
+ optionsMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener());
// Add the favorites fragment, and the dialpad fragment, but only if savedInstanceState
// is null. Otherwise the fragment manager takes care of recreating these fragments.
@@ -519,12 +519,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
protected void handleMenuSettings() {
- openTelephonySetting(this);
- }
-
- public static void openTelephonySetting(Activity activity) {
- final Intent settingsIntent = getCallSettingsIntent();
- activity.startActivity(settingsIntent);
+ final Intent intent = new Intent(this, DialerSettingsActivity.class);
+ startActivity(intent);
}
@Override
@@ -549,7 +545,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
break;
case R.id.dialtacts_options_menu_button:
- buildOptionsMenu(view).show();
+ mOverflowMenu.show();
break;
default: {
Log.wtf(TAG, "Unexpected onClick event from " + view);
diff --git a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
index cc116e7ad..105462ffe 100644
--- a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
+++ b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
@@ -122,11 +122,12 @@ public class CallDetailHistoryAdapter extends BaseAdapter {
TextView durationView = (TextView) result.findViewById(R.id.duration);
int callType = details.callTypes[0];
+ boolean isVideoCall = (details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO;
+
callTypeIconView.clear();
callTypeIconView.add(callType);
- callTypeIconView.setShowVideo(
- (details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO);
- callTypeTextView.setText(mCallTypeHelper.getCallTypeText(callType));
+ callTypeIconView.setShowVideo(isVideoCall);
+ callTypeTextView.setText(mCallTypeHelper.getCallTypeText(callType, isVideoCall));
// Set the date.
CharSequence dateValue = DateUtils.formatDateRange(mContext, details.date, details.date,
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE |
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index f4b9f3a94..d70a40dea 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -895,6 +895,7 @@ public class CallLogAdapter extends GroupingListAdapter
// focus was successful. The first successful focus will satisfy the OR
// block and block further attempts to set focus.
boolean focused = views.callBackButtonView.requestAccessibilityFocus() ||
+ views.videoCallButtonView.requestAccessibilityFocus() ||
views.voicemailButtonView.requestAccessibilityFocus() ||
views.detailsButtonView.requestAccessibilityFocus();
} else {
@@ -929,6 +930,11 @@ public class CallLogAdapter extends GroupingListAdapter
R.id.call_back_action);
}
+ if (views.videoCallButtonView == null) {
+ views.videoCallButtonView = (TextView)views.actionsView.findViewById(
+ R.id.video_call_action);
+ }
+
if (views.voicemailButtonView == null) {
views.voicemailButtonView = (TextView)views.actionsView.findViewById(
R.id.voicemail_action);
@@ -960,8 +966,10 @@ public class CallLogAdapter extends GroupingListAdapter
* @param views The call log item views.
*/
private void bindActionButtons(CallLogListItemViews views) {
+ boolean canPlaceCallToNumber =
+ PhoneNumberUtilsWrapper.canPlaceCallsTo(views.number, views.numberPresentation);
// Set return call intent, otherwise null.
- if (PhoneNumberUtilsWrapper.canPlaceCallsTo(views.number, views.numberPresentation)) {
+ if (canPlaceCallToNumber) {
// Sets the primary action to call the number.
views.callBackButtonView.setTag(
IntentProvider.getReturnCallIntentProvider(views.number, views.mAccount));
@@ -973,6 +981,18 @@ public class CallLogAdapter extends GroupingListAdapter
views.callBackButtonView.setVisibility(View.GONE);
}
+ // If one of the calls had video capabilities, show the video call button.
+ if (canPlaceCallToNumber && views.phoneCallDetailsViews.callTypeIcons.isVideoShown()) {
+ views.videoCallButtonView.setTag(
+ IntentProvider.getReturnVideoCallIntentProvider(views.number,
+ views.mAccount));
+ views.videoCallButtonView.setVisibility(View.VISIBLE);
+ views.videoCallButtonView.setOnClickListener(mActionListener);
+ } else {
+ views.videoCallButtonView.setTag(null);
+ views.videoCallButtonView.setVisibility(View.GONE);
+ }
+
// For voicemail calls, show the "VOICEMAIL" action button; hide otherwise.
if (views.callType == Calls.VOICEMAIL_TYPE) {
views.voicemailButtonView.setOnClickListener(mActionListener);
@@ -991,6 +1011,7 @@ public class CallLogAdapter extends GroupingListAdapter
IntentProvider.getCallDetailIntentProvider(
views.rowId, views.callIds, null)
);
+
if (views.isExternal && !views.reported) {
views.reportButtonView.setVisibility(View.VISIBLE);
}
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index cb7c7cda3..b2c1e2d14 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -77,6 +77,9 @@ import com.android.dialer.R;
views.callBackButtonView.setContentDescription(
mResources.getString(R.string.description_call_back_action, views.nameOrNumber));
+ views.videoCallButtonView.setContentDescription(
+ mResources.getString(R.string.description_video_call_action, views.nameOrNumber));
+
views.voicemailButtonView.setContentDescription(
mResources.getString(R.string.description_voicemail_action, views.nameOrNumber));
@@ -149,6 +152,11 @@ import com.android.dialer.R;
details.callTypes.length));
}
+ // If call had video capabilities, add the "Video Call" string.
+ if ((details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) {
+ callDescription.append(mResources.getString(R.string.description_video_call));
+ }
+
int stringID = getCallDescriptionStringID(details);
// Use chosen string resource to build up the message.
diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java
index 3efa5cbea..70d545e89 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViews.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViews.java
@@ -44,6 +44,8 @@ public final class CallLogListItemViews {
public View actionsView;
/** The "call back" action button - assigned only when the action section is expanded. */
public TextView callBackButtonView;
+ /** The "video call" action button - assigned only when the action section is expanded. */
+ public TextView videoCallButtonView;
/** The "voicemail" action button - assigned only when the action section is expanded. */
public TextView voicemailButtonView;
/** The "details" action button - assigned only when the action section is expanded. */
diff --git a/src/com/android/dialer/calllog/CallTypeHelper.java b/src/com/android/dialer/calllog/CallTypeHelper.java
index 1c4f44f23..36c0975bd 100644
--- a/src/com/android/dialer/calllog/CallTypeHelper.java
+++ b/src/com/android/dialer/calllog/CallTypeHelper.java
@@ -31,6 +31,12 @@ public class CallTypeHelper {
private final CharSequence mOutgoingName;
/** Name used to identify missed calls. */
private final CharSequence mMissedName;
+ /** Name used to identify incoming video calls. */
+ private final CharSequence mIncomingVideoName;
+ /** Name used to identify outgoing video calls. */
+ private final CharSequence mOutgoingVideoName;
+ /** Name used to identify missed video calls. */
+ private final CharSequence mMissedVideoName;
/** Name used to identify voicemail calls. */
private final CharSequence mVoicemailName;
/** Color used to identify new missed calls. */
@@ -43,22 +49,37 @@ public class CallTypeHelper {
mIncomingName = resources.getString(R.string.type_incoming);
mOutgoingName = resources.getString(R.string.type_outgoing);
mMissedName = resources.getString(R.string.type_missed);
+ mIncomingVideoName = resources.getString(R.string.type_incoming_video);
+ mOutgoingVideoName = resources.getString(R.string.type_outgoing_video);
+ mMissedVideoName = resources.getString(R.string.type_missed_video);
mVoicemailName = resources.getString(R.string.type_voicemail);
mNewMissedColor = resources.getColor(R.color.call_log_missed_call_highlight_color);
mNewVoicemailColor = resources.getColor(R.color.call_log_voicemail_highlight_color);
}
/** Returns the text used to represent the given call type. */
- public CharSequence getCallTypeText(int callType) {
+ public CharSequence getCallTypeText(int callType, boolean isVideoCall) {
switch (callType) {
case Calls.INCOMING_TYPE:
- return mIncomingName;
+ if (isVideoCall) {
+ return mIncomingVideoName;
+ } else {
+ return mIncomingName;
+ }
case Calls.OUTGOING_TYPE:
- return mOutgoingName;
+ if (isVideoCall) {
+ return mOutgoingVideoName;
+ } else {
+ return mOutgoingName;
+ }
case Calls.MISSED_TYPE:
- return mMissedName;
+ if (isVideoCall) {
+ return mMissedVideoName;
+ } else {
+ return mMissedName;
+ }
case Calls.VOICEMAIL_TYPE:
return mVoicemailName;
diff --git a/src/com/android/dialer/calllog/CallTypeIconsView.java b/src/com/android/dialer/calllog/CallTypeIconsView.java
index 382056c72..ef729ae39 100644
--- a/src/com/android/dialer/calllog/CallTypeIconsView.java
+++ b/src/com/android/dialer/calllog/CallTypeIconsView.java
@@ -85,6 +85,15 @@ public class CallTypeIconsView extends View {
}
}
+ /**
+ * Determines if the video icon should be shown.
+ *
+ * @return True if the video icon should be shown.
+ */
+ public boolean isVideoShown() {
+ return mShowVideo;
+ }
+
@NeededForTesting
public int getCount() {
return mCallTypes.size();
diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java
index 9820102d2..c52dff87f 100644
--- a/src/com/android/dialer/calllog/IntentProvider.java
+++ b/src/com/android/dialer/calllog/IntentProvider.java
@@ -47,6 +47,16 @@ public abstract class IntentProvider {
};
}
+ public static IntentProvider getReturnVideoCallIntentProvider(final String number,
+ final PhoneAccount account) {
+ return new IntentProvider() {
+ @Override
+ public Intent getIntent(Context context) {
+ return CallUtil.getVideoCallIntent(number, account);
+ }
+ };
+ }
+
public static IntentProvider getPlayVoicemailIntentProvider(final long rowId,
final String voicemailUri) {
return new IntentProvider() {
diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java
new file mode 100644
index 000000000..904be82b8
--- /dev/null
+++ b/src/com/android/dialer/settings/DialerSettingsActivity.java
@@ -0,0 +1,54 @@
+package com.android.dialer.settings;
+
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceManager;
+import android.preference.PreferenceActivity.Header;
+import android.view.MenuItem;
+
+import com.android.contacts.common.preference.DisplayOptionsPreferenceFragment;
+import com.android.dialer.DialtactsActivity;
+import com.android.dialer.R;
+
+import java.util.List;
+
+public class DialerSettingsActivity extends PreferenceActivity {
+
+ protected SharedPreferences mPreferences;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+ }
+
+ @Override
+ public void onBuildHeaders(List<Header> target) {
+ final Header contactDisplayHeader = new Header();
+ contactDisplayHeader.titleRes = R.string.settings_contact_display_options_title;
+ contactDisplayHeader.summaryRes = R.string.settings_contact_display_options_description;
+ contactDisplayHeader.fragment = DisplayOptionsPreferenceFragment.class.getName();
+ target.add(contactDisplayHeader);
+
+ final Header callSettingHeader = new Header();
+ callSettingHeader.titleRes = R.string.call_settings_label;
+ callSettingHeader.summaryRes = R.string.call_settings_description;
+ callSettingHeader.intent = DialtactsActivity.getCallSettingsIntent();
+ target.add(callSettingHeader);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ onBackPressed();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return true;
+ }
+}
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
index 147201bcb..d0c13eeb6 100644
--- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
@@ -159,6 +159,22 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
assertCallTypeIconsEquals(Calls.VOICEMAIL_TYPE);
}
+ /**
+ * Tests a case where the video call feature is present.
+ */
+ public void testSetPhoneCallDetails_Video() {
+ setPhoneCallDetailsWithFeatures(Calls.FEATURES_VIDEO);
+ assertIsVideoCall(true);
+ }
+
+ /**
+ * Tests a case where the video call feature is not present.
+ */
+ public void testSetPhoneCallDetails_NoVideo() {
+ setPhoneCallDetailsWithFeatures(Calls.FEATURES_NONE);
+ assertIsVideoCall(false);
+ }
+
public void testSetPhoneCallDetails_MultipleCallTypeIcons() {
setPhoneCallDetailsWithCallTypeIcons(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
assertCallTypeIconsEquals(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
@@ -258,6 +274,11 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
assertTrue(mViews.callLocationAndDate.getText().toString().contains(text));
}
+ /** Asserts that the video icon is shown. */
+ private void assertIsVideoCall(boolean isVideoCall) {
+ assertEquals(isVideoCall, mViews.callTypeIcons.isVideoShown());
+ }
+
/** Asserts that the call type contains the images with the given drawables. */
private void assertCallTypeIconsEquals(int... ids) {
assertEquals(ids.length, mViews.callTypeIcons.getCount());
@@ -325,6 +346,18 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
);
}
+ /**
+ * Sets the phone call details with default values and the given call features.
+ */
+ private void setPhoneCallDetailsWithFeatures(int features) {
+ mHelper.setPhoneCallDetails(mViews,
+ new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
+ TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
+ new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null,
+ features, null)
+ );
+ }
+
private void setCallDetailsHeaderWithNumber(String number, int presentation) {
mHelper.setCallDetailsHeader(mNameView,
new PhoneCallDetails(number, presentation,
diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
index 8fbda1596..4c9d92cfc 100644
--- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
@@ -327,6 +327,21 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
.contains(this.mResources.getString(R.string.description_num_calls, 2)));
}
+ /**
+ * Test getCallDescription method used to get the accessibility description for calls.
+ * Test that the "Video call." message is present if the call had video capability.
+ */
+ public void testGetCallDescription_Video() {
+ PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
+ TEST_FORMATTED_NUMBER,
+ TEST_COUNTRY_ISO, TEST_GEOCODE,
+ new int[]{Calls.INCOMING_TYPE, Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION,
+ null, Calls.FEATURES_VIDEO, null);
+ CharSequence description = mHelper.getCallDescription(details);
+ assertTrue(description.toString()
+ .contains(this.mResources.getString(R.string.description_video_call, 2)));
+ }
+
/** Asserts that the primary action view does not have a call intent. */
private void assertNoCallIntent() {
Object intentProvider = (IntentProvider)mViews.primaryActionView.getTag();
diff --git a/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java b/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java
index c13b936e5..dc3f525d8 100644
--- a/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java
+++ b/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java
@@ -29,7 +29,7 @@ public class CallLogQueryTestUtils {
public static Object[] createTestValues() {
Object[] values = new Object[]{
0L, "", 0L, 0L, Calls.INCOMING_TYPE, "", "", "", null, 0, null, null, null, null,
- 0L, null, 0, Calls.PRESENTATION_ALLOWED,
+ 0L, null, 0, Calls.PRESENTATION_ALLOWED, null, null, Calls.FEATURES_NONE, null
};
assertEquals(CallLogQuery._PROJECTION.length, values.length);
return values;