Merge "Make dialer use PhoneManager.cancelMissedCallsNotification."
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index d46462e..0f64e8b 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -113,7 +113,7 @@
android:layout_gravity="center_vertical"
/>
<ImageView
- android:id="@+id/call_subscription_icon"
+ android:id="@+id/call_account_icon"
android:layout_width="@dimen/call_provider_small_icon_size"
android:layout_height="@dimen/call_provider_small_icon_size"
android:layout_marginEnd="@dimen/call_log_icon_margin"
diff --git a/res/menu/dialpad_options.xml b/res/menu/dialpad_options.xml
index 311a5ee..b977ef9 100644
--- a/res/menu/dialpad_options.xml
+++ b/res/menu/dialpad_options.xml
@@ -19,8 +19,8 @@
android:title="@string/add_contact"
android:showAsAction="withText" />
<item
- android:id="@+id/menu_select_subscription"
- android:title="@string/menu_select_subscription"
+ android:id="@+id/menu_select_account"
+ android:title="@string/menu_select_account"
android:showAsAction="withText" />
<item
android:id="@+id/menu_2s_pause"
diff --git a/res/menu/dialtacts_options.xml b/res/menu/dialtacts_options.xml
index 558cbd8..a410b43 100644
--- a/res/menu/dialtacts_options.xml
+++ b/res/menu/dialtacts_options.xml
@@ -20,8 +20,8 @@
android:icon="@drawable/ic_menu_history_lt"
android:title="@string/action_menu_call_history_description" />
<item
- android:id="@+id/menu_select_subscription"
- android:title="@string/menu_select_subscription" />
+ android:id="@+id/menu_select_account"
+ android:title="@string/menu_select_account" />
<item
android:id="@+id/menu_import_export"
android:title="@string/menu_import_export" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f40544c..2c3b13c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -326,8 +326,8 @@
<string name="add_2sec_pause">Add 2-sec pause</string>
<string name="add_wait">Add wait</string>
- <!-- Menu item to select subscription (connection provider) to place call from [CHAR LIMIT=30] -->
- <string name="menu_select_subscription">Select Subscription</string>
+ <!-- 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>
@@ -592,6 +592,9 @@
<!-- Shortcut item used to add a number directly from search -->
<string name="search_shortcut_add_to_contacts">Add to contacts</string>
+ <!-- Shortcut item used to make a video call directly from search. -->
+ <string name="search_shortcut_make_video_call">Make video call</string>
+
<!-- Title for the recent calls footer that brings users to the full call history when clicked -->
<string name="recents_footer_text">View full call history</string>
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index d070601..fa8d5ed 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -32,7 +32,6 @@
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.VoicemailContract.Voicemails;
-import android.telecomm.Subscription;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -196,8 +195,8 @@
CallLog.Calls.COUNTRY_ISO,
CallLog.Calls.GEOCODED_LOCATION,
CallLog.Calls.NUMBER_PRESENTATION,
- CallLog.Calls.SUBSCRIPTION_COMPONENT_NAME,
- CallLog.Calls.SUBSCRIPTION_ID,
+ CallLog.Calls.PHONE_ACCOUNT_COMPONENT_NAME,
+ CallLog.Calls.PHONE_ACCOUNT_ID,
};
static final int DATE_COLUMN_INDEX = 0;
@@ -207,8 +206,8 @@
static final int COUNTRY_ISO_COLUMN_INDEX = 4;
static final int GEOCODED_LOCATION_COLUMN_INDEX = 5;
static final int NUMBER_PRESENTATION_COLUMN_INDEX = 6;
- static final int SUBSCRIPTION_COMPONENT_NAME = 7;
- static final int SUBSCRIPTION_ID = 8;
+ static final int ACCOUNT_COMPONENT_NAME = 7;
+ static final int ACCOUNT_ID = 8;
@Override
protected void onCreate(Bundle icicle) {
@@ -487,7 +486,7 @@
final int callType = callCursor.getInt(CALL_TYPE_COLUMN_INDEX);
String countryIso = callCursor.getString(COUNTRY_ISO_COLUMN_INDEX);
final String geocode = callCursor.getString(GEOCODED_LOCATION_COLUMN_INDEX);
- final Drawable subscriptionIcon = getSubscriptionIcon(callCursor);
+ final Drawable accountIcon = getAccountIcon(callCursor);
if (TextUtils.isEmpty(countryIso)) {
countryIso = mDefaultCountryIso;
@@ -530,7 +529,7 @@
formattedNumber, countryIso, geocode,
new int[]{ callType }, date, duration,
nameText, numberType, numberLabel, lookupUri, photoUri, sourceType,
- subscriptionIcon);
+ accountIcon);
} finally {
if (callCursor != null) {
callCursor.close();
@@ -539,11 +538,11 @@
}
/**
- * Generate subscription object from data in Telecomm database
+ * Generate account object from data in Telecomm database
*/
- private Drawable getSubscriptionIcon(Cursor c) {
- final String component_name = c.getString(SUBSCRIPTION_COMPONENT_NAME);
- final String subscription_id = c.getString(SUBSCRIPTION_ID);
+ private Drawable getAccountIcon(Cursor c) {
+ final String component_name = c.getString(ACCOUNT_COMPONENT_NAME);
+ final String account_id = c.getString(ACCOUNT_ID);
// TODO: actually pull data from the database
return null;
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index da46a40..4141351 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -28,16 +28,13 @@
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.net.Uri;
import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Intents;
import android.speech.RecognizerIntent;
import android.support.v4.view.ViewPager;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextUtils;
@@ -63,10 +60,10 @@
import android.widget.Toast;
import com.android.contacts.common.CallUtil;
-import com.android.contacts.common.SubscriptionManager;
+import com.android.contacts.common.PhoneAccountManager;
import com.android.contacts.common.activity.TransactionSafeActivity;
import com.android.contacts.common.dialog.ClearFrequentsDialog;
-import com.android.contacts.common.dialog.SelectSubscriptionDialogFragment;
+import com.android.contacts.common.dialog.SelectAccountDialogFragment;
import com.android.contacts.common.interactions.ImportExportDialogFragment;
import com.android.contacts.common.list.OnPhoneNumberPickerActionListener;
import com.android.contacts.common.widget.FloatingActionButtonController;
@@ -114,8 +111,8 @@
public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
- /** Temporary flag for disabling subscription selection menu */
- public static final boolean ENABLE_SUBSCRIPTION_SELECT = false;
+ /** 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";
@@ -199,9 +196,9 @@
private boolean mIsLandscape;
/**
- * Information about the currently selected subscription.
+ * Information about the currently selected account.
*/
- private SubscriptionManager mSubscriptionManager = null;
+ private PhoneAccountManager mAccountManager = null;
/**
* The position of the currently selected tab in the attached {@link ListsFragment}.
@@ -390,8 +387,8 @@
mIsLandscape = getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE;
- if (getTelephonyManager().getSubscriptions().size() > 1 && ENABLE_SUBSCRIPTION_SELECT) {
- mSubscriptionManager = new SubscriptionManager(getTelephonyManager());
+ if (getTelephonyManager().getAccounts().size() > 1 && ENABLE_ACCOUNT_SELECT) {
+ mAccountManager = new PhoneAccountManager(getTelephonyManager());
}
final View floatingActionButtonContainer = findViewById(
@@ -601,8 +598,8 @@
case R.id.menu_call_settings:
handleMenuSettings();
return true;
- case R.id.menu_select_subscription:
- SelectSubscriptionDialogFragment.show(getFragmentManager(), mSubscriptionManager);
+ case R.id.menu_select_account:
+ SelectAccountDialogFragment.show(getFragmentManager(), mAccountManager);
return true;
}
return false;
@@ -638,7 +635,7 @@
}
mIsDialpadShown = true;
mDialpadFragment.setAnimate(animate);
- mDialpadFragment.setSubscriptionManager(mSubscriptionManager);
+ mDialpadFragment.setAccountManager(mAccountManager);
final FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.show(mDialpadFragment);
@@ -776,8 +773,8 @@
final OptionsPopupMenu popupMenu = new OptionsPopupMenu(this, invoker);
popupMenu.inflate(R.menu.dialtacts_options);
final Menu menu = popupMenu.getMenu();
- final MenuItem selectSubscription = menu.findItem(R.id.menu_select_subscription);
- selectSubscription.setVisible(mSubscriptionManager != null);
+ final MenuItem selectAccount = menu.findItem(R.id.menu_select_account);
+ selectAccount.setVisible(mAccountManager != null);
popupMenu.setOnMenuItemClickListener(this);
return popupMenu;
}
@@ -1108,9 +1105,22 @@
@Override
public void onCallNumberDirectly(String phoneNumber) {
- final Subscription subscription = mSubscriptionManager != null?
- mSubscriptionManager.getCurrentSubscription(): null;
- Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin(), subscription);
+ onCallNumberDirectly(phoneNumber, false /* isVideoCall */);
+ }
+
+ @Override
+ public void onCallNumberDirectly(String phoneNumber, boolean isVideoCall) {
+ if (isVideoCall) {
+ //TODO: Dispatch intent with video call extras specified, then remove this toast.
+ Toast toast = Toast.makeText(getApplicationContext(),
+ "Feature development in progress.", Toast.LENGTH_SHORT);
+ toast.show();
+ return;
+ }
+
+ final PhoneAccount account = mAccountManager != null ?
+ mAccountManager.getCurrentAccount() : null;
+ Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin(), account);
DialerUtils.startActivityWithErrorToast(this, intent);
mClearSearchOnPause = true;
}
diff --git a/src/com/android/dialer/PhoneCallDetails.java b/src/com/android/dialer/PhoneCallDetails.java
index 3562b17..afdb2e3 100644
--- a/src/com/android/dialer/PhoneCallDetails.java
+++ b/src/com/android/dialer/PhoneCallDetails.java
@@ -20,7 +20,6 @@
import android.net.Uri;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.telecomm.Subscription;
/**
* The details of a phone call to be shown in the UI.
@@ -68,14 +67,14 @@
/**
* The unique identifier for the provider associated with the call.
*/
- public final Drawable subscriptionIcon;
+ public final Drawable accountIcon;
/** Create the details for a call with a number not associated with a contact. */
public PhoneCallDetails(CharSequence number, int numberPresentation,
CharSequence formattedNumber, String countryIso, String geocode,
- int[] callTypes, long date, long duration, Drawable subscriptionIcon) {
+ int[] callTypes, long date, long duration, Drawable accountIcon) {
this(number, numberPresentation, formattedNumber, countryIso, geocode,
- callTypes, date, duration, "", 0, "", null, null, 0, subscriptionIcon);
+ callTypes, date, duration, "", 0, "", null, null, 0, accountIcon);
}
/** Create the details for a call with a number associated with a contact. */
@@ -83,7 +82,7 @@
CharSequence formattedNumber, String countryIso, String geocode,
int[] callTypes, long date, long duration, CharSequence name,
int numberType, CharSequence numberLabel, Uri contactUri,
- Uri photoUri, int sourceType, Drawable subscriptionIcon) {
+ Uri photoUri, int sourceType, Drawable accountIcon) {
this.number = number;
this.numberPresentation = numberPresentation;
this.formattedNumber = formattedNumber;
@@ -98,6 +97,6 @@
this.contactUri = contactUri;
this.photoUri = photoUri;
this.sourceType = sourceType;
- this.subscriptionIcon = subscriptionIcon;
+ this.accountIcon = accountIcon;
}
}
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index 0531412..62ef305 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -17,19 +17,11 @@
package com.android.dialer;
import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.graphics.Typeface;
import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.telecomm.Subscription;
-import android.text.SpannableString;
-import android.text.Spanned;
import android.text.TextUtils;
import android.text.format.DateUtils;
-import android.text.style.ForegroundColorSpan;
-import android.text.style.StyleSpan;
import android.view.View;
import android.widget.TextView;
-import android.widget.ImageView;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.PhoneNumberHelper;
@@ -41,7 +33,6 @@
import com.google.common.collect.Lists;
import java.util.ArrayList;
-import java.util.List;
/**
* Helper class to fill in the views in {@link PhoneCallDetailsViews}.
@@ -102,12 +93,12 @@
// Set the call count, location and date.
setCallCountAndDate(views, callCount, callLocationAndDate);
- // set the subscription icon if it exists
- if (details.subscriptionIcon != null) {
- views.callSubscriptionIcon.setVisibility(View.VISIBLE);
- views.callSubscriptionIcon.setImageDrawable(details.subscriptionIcon);
+ // set the account icon if it exists
+ if (details.accountIcon != null) {
+ views.callAccountIcon.setVisibility(View.VISIBLE);
+ views.callAccountIcon.setImageDrawable(details.accountIcon);
} else {
- views.callSubscriptionIcon.setVisibility(View.GONE);
+ views.callAccountIcon.setVisibility(View.GONE);
}
final CharSequence nameText;
diff --git a/src/com/android/dialer/PhoneCallDetailsViews.java b/src/com/android/dialer/PhoneCallDetailsViews.java
index 4f70137..67babc1 100644
--- a/src/com/android/dialer/PhoneCallDetailsViews.java
+++ b/src/com/android/dialer/PhoneCallDetailsViews.java
@@ -30,17 +30,17 @@
public final TextView nameView;
public final View callTypeView;
public final CallTypeIconsView callTypeIcons;
- public final ImageView callSubscriptionIcon;
+ public final ImageView callAccountIcon;
public final TextView callLocationAndDate;
public final TextView voicemailTranscriptionView;
private PhoneCallDetailsViews(TextView nameView, View callTypeView,
- CallTypeIconsView callTypeIcons, ImageView callSubscriptionIcon,
+ CallTypeIconsView callTypeIcons, ImageView callAccountIcon,
TextView callLocationAndDate, TextView voicemailTranscriptionView) {
this.nameView = nameView;
this.callTypeView = callTypeView;
this.callTypeIcons = callTypeIcons;
- this.callSubscriptionIcon = callSubscriptionIcon;
+ this.callAccountIcon = callAccountIcon;
this.callLocationAndDate = callLocationAndDate;
this.voicemailTranscriptionView = voicemailTranscriptionView;
}
@@ -56,7 +56,7 @@
return new PhoneCallDetailsViews((TextView) view.findViewById(R.id.name),
view.findViewById(R.id.call_type),
(CallTypeIconsView) view.findViewById(R.id.call_type_icons),
- (ImageView) view.findViewById(R.id.call_subscription_icon),
+ (ImageView) view.findViewById(R.id.call_account_icon),
(TextView) view.findViewById(R.id.call_location_and_date),
(TextView) view.findViewById(R.id.voicemail_transcription));
}
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index d089330..483c502 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -27,9 +27,8 @@
import android.os.Message;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.PhoneLookup;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.text.TextUtils;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -41,7 +40,6 @@
import com.android.common.widget.GroupingListAdapter;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
-import com.android.contacts.common.util.DateUtils;
import com.android.contacts.common.util.UriUtils;
import com.android.dialer.PhoneCallDetails;
import com.android.dialer.PhoneCallDetailsHelper;
@@ -54,7 +52,6 @@
import java.util.HashMap;
import java.util.LinkedList;
-import java.util.List;
/**
* Adapter class to fill in data for the Call Log.
@@ -634,9 +631,9 @@
final long date = c.getLong(CallLogQuery.DATE);
final long duration = c.getLong(CallLogQuery.DURATION);
final int callType = c.getInt(CallLogQuery.CALL_TYPE);
- final Subscription subscription = getSubscription(c);
- final Drawable subscriptionIcon = subscription != null?
- subscription.getIcon(mContext) : null;
+ final PhoneAccount account = getAccount(c);
+ final Drawable accountIcon = account != null?
+ account.getIcon(mContext) : null;
final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO);
final long rowId = c.getLong(CallLogQuery.ID);
views.rowId = rowId;
@@ -661,7 +658,7 @@
views.number = number;
views.numberPresentation = numberPresentation;
views.callType = callType;
- views.subscription = subscription;
+ views.mAccount = account;
views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI);
// Stash away the Ids of the calls so that we can support deleting a row in the call log.
views.callIds = getCallIds(c, count);
@@ -680,7 +677,7 @@
if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) {
// Sets the primary action to call the number.
views.primaryActionView.setTag(IntentProvider.getReturnCallIntentProvider(number,
- subscription));
+ account));
} else {
// Number is not callable, so hide button.
views.primaryActionView.setTag(null);
@@ -750,12 +747,12 @@
if (TextUtils.isEmpty(name)) {
details = new PhoneCallDetails(number, numberPresentation,
formattedNumber, countryIso, geocode, callTypes, date,
- duration, subscriptionIcon);
+ duration, accountIcon);
} else {
details = new PhoneCallDetails(number, numberPresentation,
formattedNumber, countryIso, geocode, callTypes, date,
duration, name, ntype, label, lookupUri, photoUri, sourceType,
- subscriptionIcon);
+ accountIcon);
}
mCallLogViewsHelper.setPhoneCallDetails(views, details);
@@ -939,7 +936,7 @@
if (PhoneNumberUtilsWrapper.canPlaceCallsTo(views.number, views.numberPresentation)) {
// Sets the primary action to call the number.
views.callBackButtonView.setTag(
- IntentProvider.getReturnCallIntentProvider(views.number, views.subscription));
+ IntentProvider.getReturnCallIntentProvider(views.number, views.mAccount));
views.callBackButtonView.setVisibility(View.VISIBLE);
views.callBackButtonView.setOnClickListener(mActionListener);
} else {
@@ -1185,9 +1182,9 @@
return callTypes;
}
- private Subscription getSubscription(Cursor c) {
- final String component_name = c.getString(CallLogQuery.SUBSCRIPTION_COMPONENT_NAME);
- final String subscription_id = c.getString(CallLogQuery.SUBSCRIPTION_ID);
+ private PhoneAccount getAccount(Cursor c) {
+ final String component_name = c.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME);
+ final String account_id = c.getString(CallLogQuery.ACCOUNT_ID);
// TODO: actually pull data from the database
return null;
diff --git a/src/com/android/dialer/calllog/CallLogGroupBuilder.java b/src/com/android/dialer/calllog/CallLogGroupBuilder.java
index a36ceb4..9c4e631 100644
--- a/src/com/android/dialer/calllog/CallLogGroupBuilder.java
+++ b/src/com/android/dialer/calllog/CallLogGroupBuilder.java
@@ -126,9 +126,9 @@
// This is the type of the first call in the group.
int firstCallType = cursor.getInt(CallLogQuery.CALL_TYPE);
- // The subscription information of the first entry in the group.
- String firstSubscriptionComponentName = cursor.getString(CallLogQuery.SUBSCRIPTION_COMPONENT_NAME);
- String firstSubscriptionId = cursor.getString(CallLogQuery.SUBSCRIPTION_ID);
+ // The account information of the first entry in the group.
+ String firstAccountComponentName = cursor.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME);
+ String firstAccountId = cursor.getString(CallLogQuery.ACCOUNT_ID);
// Determine the day group for the first call in the cursor.
final long firstDate = cursor.getLong(CallLogQuery.DATE);
@@ -140,24 +140,24 @@
// The number of the current row in the cursor.
final String currentNumber = cursor.getString(CallLogQuery.NUMBER);
final int callType = cursor.getInt(CallLogQuery.CALL_TYPE);
- final String currentSubscriptionComponentName = cursor.getString(
- CallLogQuery.SUBSCRIPTION_COMPONENT_NAME);
- final String currentSubscriptionId = cursor.getString(CallLogQuery.SUBSCRIPTION_ID);
+ final String currentAccountComponentName = cursor.getString(
+ CallLogQuery.ACCOUNT_COMPONENT_NAME);
+ final String currentAccountId = cursor.getString(CallLogQuery.ACCOUNT_ID);
final boolean sameNumber = equalNumbers(firstNumber, currentNumber);
- final boolean sameSubscriptionComponentName = Objects.equals(
- firstSubscriptionComponentName,
- currentSubscriptionComponentName);
- final boolean sameSubscriptionId = Objects.equals(
- firstSubscriptionId,
- currentSubscriptionId);
- final boolean sameSubscription = sameSubscriptionComponentName && sameSubscriptionId;
+ final boolean sameAccountComponentName = Objects.equals(
+ firstAccountComponentName,
+ currentAccountComponentName);
+ final boolean sameAccountId = Objects.equals(
+ firstAccountId,
+ currentAccountId);
+ final boolean sameAccount = sameAccountComponentName && sameAccountId;
final boolean shouldGroup;
final long currentCallId = cursor.getLong(CallLogQuery.ID);
final long date = cursor.getLong(CallLogQuery.DATE);
- if (!sameNumber || !sameSubscription) {
+ if (!sameNumber || !sameAccount) {
// Should only group with calls from the same number.
shouldGroup = false;
} else if (firstCallType == Calls.VOICEMAIL_TYPE) {
@@ -188,8 +188,8 @@
// The current entry is now the first in the group.
firstNumber = currentNumber;
firstCallType = callType;
- firstSubscriptionComponentName = currentSubscriptionComponentName;
- firstSubscriptionId = currentSubscriptionId;
+ firstAccountComponentName = currentAccountComponentName;
+ firstAccountId = currentAccountId;
}
// Save the day group associated with the current call.
diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java
index 39c6e64..8048d83 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViews.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViews.java
@@ -17,9 +17,8 @@
package com.android.dialer.calllog;
import android.content.Context;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.view.View;
-import android.widget.ImageView;
import android.widget.QuickContactBadge;
import android.widget.TextView;
@@ -81,10 +80,10 @@
public int callType;
/**
- * The subscription for the current call log entry. Cached here as the call back
+ * The account for the current call log entry. Cached here as the call back
* intent is set only when the actions ViewStub is inflated.
*/
- public Subscription subscription;
+ public PhoneAccount mAccount;
/**
* If the call has an associated voicemail message, the URI of the voicemail message for
diff --git a/src/com/android/dialer/calllog/CallLogQuery.java b/src/com/android/dialer/calllog/CallLogQuery.java
index 87b7a45..8b88818 100644
--- a/src/com/android/dialer/calllog/CallLogQuery.java
+++ b/src/com/android/dialer/calllog/CallLogQuery.java
@@ -44,8 +44,8 @@
Calls.CACHED_FORMATTED_NUMBER, // 15
Calls.IS_READ, // 16
Calls.NUMBER_PRESENTATION, // 17
- Calls.SUBSCRIPTION_COMPONENT_NAME, // 18
- Calls.SUBSCRIPTION_ID, // 19
+ Calls.PHONE_ACCOUNT_COMPONENT_NAME, // 18
+ Calls.PHONE_ACCOUNT_ID, // 19
};
public static final int ID = 0;
@@ -66,6 +66,6 @@
public static final int CACHED_FORMATTED_NUMBER = 15;
public static final int IS_READ = 16;
public static final int NUMBER_PRESENTATION = 17;
- public static final int SUBSCRIPTION_COMPONENT_NAME = 18;
- public static final int SUBSCRIPTION_ID = 19;
+ public static final int ACCOUNT_COMPONENT_NAME = 18;
+ public static final int ACCOUNT_ID = 19;
}
diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java
index 6a270be..9820102 100644
--- a/src/com/android/dialer/calllog/IntentProvider.java
+++ b/src/com/android/dialer/calllog/IntentProvider.java
@@ -19,11 +19,9 @@
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
-import android.database.Cursor;
import android.net.Uri;
import android.provider.CallLog.Calls;
-import android.telecomm.Subscription;
-import android.util.Log;
+import android.telecomm.PhoneAccount;
import com.android.contacts.common.CallUtil;
import com.android.dialer.CallDetailActivity;
@@ -40,11 +38,11 @@
public abstract Intent getIntent(Context context);
public static IntentProvider getReturnCallIntentProvider(final String number,
- final Subscription subscription) {
+ final PhoneAccount account) {
return new IntentProvider() {
@Override
public Intent getIntent(Context context) {
- return CallUtil.getCallIntent(number, subscription);
+ return CallUtil.getCallIntent(number, account);
}
};
}
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 9752aa7..f9139c7 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -34,13 +34,11 @@
import android.media.ToneGenerator;
import android.net.Uri;
import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.provider.Contacts.People;
import android.provider.Contacts.Phones;
import android.provider.Contacts.PhonesColumns;
import android.provider.Settings;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.telecomm.TelecommManager;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneStateListener;
@@ -59,8 +57,6 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
-import android.view.ViewTreeObserver.OnPreDrawListener;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.EditText;
@@ -68,13 +64,12 @@
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupMenu;
-import android.widget.TableRow;
import android.widget.TextView;
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.GeoUtil;
-import com.android.contacts.common.SubscriptionManager;
-import com.android.contacts.common.dialog.SelectSubscriptionDialogFragment;
+import com.android.contacts.common.PhoneAccountManager;
+import com.android.contacts.common.dialog.SelectAccountDialogFragment;
import com.android.contacts.common.util.PhoneNumberFormatter;
import com.android.contacts.common.util.StopWatch;
import com.android.dialer.NeededForReflection;
@@ -101,7 +96,7 @@
DialpadKeyButton.OnPressedListener {
private static final String TAG = DialpadFragment.class.getSimpleName();
- private static SubscriptionManager mSubscriptionManager;
+ private static PhoneAccountManager mAccountManager;
/**
* This interface allows the DialpadFragment to tell its hosting Activity when and when not
@@ -856,9 +851,9 @@
@Override
public void show() {
final Menu menu = getMenu();
- final MenuItem selectSubscription = menu.findItem(R.id.menu_select_subscription);
+ final MenuItem selectAccount = menu.findItem(R.id.menu_select_account);
final MenuItem sendMessage = menu.findItem(R.id.menu_send_message);
- selectSubscription.setVisible(mSubscriptionManager != null);
+ selectAccount.setVisible(mAccountManager != null);
sendMessage.setVisible(mSmsPackageComponentName != null);
boolean enable = !isDigitsEmpty();
@@ -1077,14 +1072,15 @@
// Clear the digits just in case.
clearDialpad();
} else {
- final Subscription subscription = mSubscriptionManager != null?
- mSubscriptionManager.getCurrentSubscription() : null;
+ final PhoneAccount account = mAccountManager != null?
+ mAccountManager.getCurrentAccount() : null;
final Intent intent = CallUtil.getCallIntent(number,
(getActivity() instanceof DialtactsActivity ?
((DialtactsActivity) getActivity()).getCallOrigin() : null),
- subscription);
+ account
+ );
DialerUtils.startActivityWithErrorToast(getActivity(), intent);
hideAndClearDialpad(false);
}
@@ -1444,8 +1440,8 @@
DialerUtils.startActivityWithErrorToast(getActivity(), smsIntent);
return true;
}
- case R.id.menu_select_subscription:
- SelectSubscriptionDialogFragment.show(getFragmentManager(), mSubscriptionManager);
+ case R.id.menu_select_account:
+ SelectAccountDialogFragment.show(getFragmentManager(), mAccountManager);
return true;
default:
@@ -1617,8 +1613,8 @@
return mAnimate;
}
- public void setSubscriptionManager(SubscriptionManager subscriptionManager) {
- mSubscriptionManager = subscriptionManager;
+ public void setAccountManager(PhoneAccountManager accountManager) {
+ mAccountManager = accountManager;
}
public void setYFraction(float yFraction) {
diff --git a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java
index abceda4..9fb2239 100644
--- a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java
+++ b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java
@@ -28,8 +28,9 @@
public final static int SHORTCUT_INVALID = -1;
public final static int SHORTCUT_DIRECT_CALL = 0;
public final static int SHORTCUT_ADD_NUMBER_TO_CONTACTS = 1;
+ public final static int SHORTCUT_MAKE_VIDEO_CALL = 2;
- public final static int SHORTCUT_COUNT = 2;
+ public final static int SHORTCUT_COUNT = 3;
private final boolean[] mShortcutEnabled = new boolean[SHORTCUT_COUNT];
@@ -145,12 +146,17 @@
text = resources.getString(R.string.search_shortcut_add_to_contacts);
drawableId = R.drawable.ic_search_add_contact;
break;
+ case SHORTCUT_MAKE_VIDEO_CALL:
+ text = resources.getString(R.string.search_shortcut_make_video_call);
+ drawableId = R.drawable.ic_videocam;
+ break;
default:
throw new IllegalArgumentException("Invalid shortcut type");
}
v.setDrawableResource(R.drawable.search_shortcut_background, drawableId);
v.setDisplayName(text);
v.setPhotoPosition(super.getPhotoPosition());
+ v.setAdjustSelectionBoundsEnabled(false);
}
public void setShortcutEnabled(int shortcutType, boolean visible) {
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index b50f94e..e94555e 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -141,8 +141,8 @@
// slideOffset is 1 when the shortcut card is fully exposed, and 0 when completely
// hidden.
float ratioCardHidden = (1 - slideOffset) * 1.5f;
- if (mShortcutCardsListView.getCount() > 0) {
- SwipeableShortcutCard v =
+ if (mShortcutCardsListView.getChildCount() > 0) {
+ final SwipeableShortcutCard v =
(SwipeableShortcutCard) mShortcutCardsListView.getChildAt(0);
v.clipCard(ratioCardHidden);
}
@@ -348,7 +348,7 @@
mRemoveView.setAlpha(show ? 0 : 1);
mRemoveView.animate().alpha(show ? 1 : 0).start();
- if (mShortcutCardsListView.getCount() > 0) {
+ if (mShortcutCardsListView.getChildCount() > 0) {
View v = mShortcutCardsListView.getChildAt(0);
v.animate().withLayer()
.alpha(show ? REMOVE_VIEW_SHOWN_ALPHA : REMOVE_VIEW_HIDDEN_ALPHA)
diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java
index d0617b7..2bceaf9 100644
--- a/src/com/android/dialer/list/RegularSearchListAdapter.java
+++ b/src/com/android/dialer/list/RegularSearchListAdapter.java
@@ -73,6 +73,9 @@
// a dialable number, then clicking add to contact should add it as a number.
// Otherwise, it should add it to a new contact as a name.
setShortcutEnabled(SHORTCUT_ADD_NUMBER_TO_CONTACTS, showNumberShortcuts);
+ // TODO: Write utility method to check subscriptions and settings, and use it to determine
+ // whether to enable or disable video call shortcut.
+ setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, showNumberShortcuts);
super.setQueryString(queryString);
}
}
diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java
index 03d2242..e2cea41 100644
--- a/src/com/android/dialer/list/SearchFragment.java
+++ b/src/com/android/dialer/list/SearchFragment.java
@@ -147,21 +147,31 @@
protected void onItemClick(int position, long id) {
final DialerPhoneNumberListAdapter adapter = (DialerPhoneNumberListAdapter) getAdapter();
final int shortcutType = adapter.getShortcutTypeFromPosition(position);
+ final OnPhoneNumberPickerActionListener listener;
- if (shortcutType == DialerPhoneNumberListAdapter.SHORTCUT_INVALID) {
- super.onItemClick(position, id);
- } else if (shortcutType == DialerPhoneNumberListAdapter.SHORTCUT_DIRECT_CALL) {
- final OnPhoneNumberPickerActionListener listener =
- getOnPhoneNumberPickerListener();
- if (listener != null) {
- listener.onCallNumberDirectly(getQueryString());
- }
- } else if (shortcutType == DialerPhoneNumberListAdapter.SHORTCUT_ADD_NUMBER_TO_CONTACTS) {
- final String number = TextUtils.isEmpty(mAddToContactNumber) ?
- adapter.getFormattedQueryString() : mAddToContactNumber;
- final Intent intent = DialtactsActivity.getAddNumberToContactIntent(number);
- DialerUtils.startActivityWithErrorToast(getActivity(), intent,
- R.string.add_contact_not_available);
+ switch (shortcutType) {
+ case DialerPhoneNumberListAdapter.SHORTCUT_INVALID:
+ super.onItemClick(position, id);
+ break;
+ case DialerPhoneNumberListAdapter.SHORTCUT_DIRECT_CALL:
+ listener = getOnPhoneNumberPickerListener();
+ if (listener != null) {
+ listener.onCallNumberDirectly(getQueryString());
+ }
+ break;
+ case DialerPhoneNumberListAdapter.SHORTCUT_ADD_NUMBER_TO_CONTACTS:
+ final String number = TextUtils.isEmpty(mAddToContactNumber) ?
+ adapter.getFormattedQueryString() : mAddToContactNumber;
+ final Intent intent = DialtactsActivity.getAddNumberToContactIntent(number);
+ DialerUtils.startActivityWithErrorToast(getActivity(), intent,
+ R.string.add_contact_not_available);
+ break;
+ case DialerPhoneNumberListAdapter.SHORTCUT_MAKE_VIDEO_CALL:
+ listener = getOnPhoneNumberPickerListener();
+ if (listener != null) {
+ listener.onCallNumberDirectly(getQueryString(), true /* isVideoCall */);
+ }
+ break;
}
}
diff --git a/src/com/android/dialer/list/SmartDialNumberListAdapter.java b/src/com/android/dialer/list/SmartDialNumberListAdapter.java
index 25d442e..d9aa846 100644
--- a/src/com/android/dialer/list/SmartDialNumberListAdapter.java
+++ b/src/com/android/dialer/list/SmartDialNumberListAdapter.java
@@ -22,6 +22,7 @@
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Callable;
import android.telephony.PhoneNumberUtils;
+import android.text.TextUtils;
import android.util.Log;
import com.android.contacts.common.list.ContactListItemView;
@@ -112,4 +113,14 @@
return null;
}
}
+
+ @Override
+ public void setQueryString(String queryString) {
+ final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString());
+ setShortcutEnabled(SHORTCUT_ADD_NUMBER_TO_CONTACTS, showNumberShortcuts);
+ // TODO: Write utility method to check subscriptions and settings, and use it to determine
+ // whether to enable or disable video call shortcut.
+ setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, showNumberShortcuts);
+ super.setQueryString(queryString);
+ }
}
diff --git a/tests/res/layout/fill_call_log_test.xml b/tests/res/layout/fill_call_log_test.xml
index c81a679..7651b08 100644
--- a/tests/res/layout/fill_call_log_test.xml
+++ b/tests/res/layout/fill_call_log_test.xml
@@ -179,28 +179,28 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/call_subscription" />
+ android:text="@string/call_account" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
- android:id="@+id/subscription0"
+ android:id="@+id/account0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/subscription0"
+ android:text="@string/account0"
android:textSize="9sp" />
<RadioButton
- android:id="@+id/subscription1"
+ android:id="@+id/account1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/subscription1"
+ android:text="@string/account1"
android:textSize="9sp" />
<RadioButton
- android:id="@+id/no_subscription"
+ android:id="@+id/no_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/no_subscription"
+ android:text="@string/no_account"
android:textSize="9sp" />
</RadioGroup>
<Button
diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml
index cfc70c4..553b3c0 100644
--- a/tests/res/values/donottranslate_strings.xml
+++ b/tests/res/values/donottranslate_strings.xml
@@ -51,8 +51,8 @@
<string name="presentation_unknown">Unknown</string>
<string name="presentation_payphone">Payphone</string>
<string name="delta_after_add">Offset call time after add (min): </string>
- <string name="call_subscription">Subscription</string>
- <string name="subscription0">Subscription 0</string>
- <string name="subscription1">Subscription 1</string>
- <string name="no_subscription">No Subscription</string>
+ <string name="call_account">Account</string>
+ <string name="account0">Account 0</string>
+ <string name="account1">Account 1</string>
+ <string name="no_account">No Account</string>
</resources>
diff --git a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
index e12a2a2..e495ca7 100644
--- a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
+++ b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
@@ -31,7 +31,7 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.provider.CallLog.Calls;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.telephony.TelephonyManager;
import android.text.format.DateFormat;
import android.util.Log;
@@ -86,8 +86,8 @@
private int mCallDateYear;
private int mCallDateMonth;
private int mCallDateDay;
- private RadioButton mSubscription0;
- private RadioButton mSubscription1;
+ private RadioButton mAccount0;
+ private RadioButton mAccount1;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -132,8 +132,8 @@
mCallDate = (TextView) findViewById(R.id.call_date);
mPhoneNumber = (TextView) findViewById(R.id.phone_number);
mOffset = (EditText) findViewById(R.id.delta_after_add);
- mSubscription0 = (RadioButton) findViewById(R.id.subscription0);
- mSubscription1 = (RadioButton) findViewById(R.id.subscription1);
+ mAccount0 = (RadioButton) findViewById(R.id.account0);
+ mAccount1 = (RadioButton) findViewById(R.id.account1);
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
@@ -395,13 +395,13 @@
}
}
- private Subscription getManualSubscription() {
+ private PhoneAccount getManualAccount() {
TelephonyManager telephonyManager = new TelephonyManager(this);
- List <Subscription> subscriptions = telephonyManager.getSubscriptions();
- if (mSubscription0.isChecked()) {
- return subscriptions.get(0);
- } else if (mSubscription1.isChecked()){
- return subscriptions.get(1);
+ List <PhoneAccount> accounts = telephonyManager.getAccounts();
+ if (mAccount0.isChecked()) {
+ return accounts.get(0);
+ } else if (mAccount1.isChecked()){
+ return accounts.get(1);
} else {
return null;
}
@@ -489,7 +489,7 @@
dateTime.set(mCallDateYear, mCallDateMonth, mCallDateDay, mCallTimeHour, mCallTimeMinute);
Calls.addCall(null, this, mPhoneNumber.getText().toString(), getManualPresentation(),
- getManualCallType(), getManualSubscription(), dateTime.getTimeInMillis(),
+ getManualCallType(), getManualAccount(), dateTime.getTimeInMillis(),
RNG.nextInt(60 * 60));
// Subtract offset from the call date/time and store as new date/time