From 1d1bd0da0b32a5b8cb1c7c5585acccb180b19849 Mon Sep 17 00:00:00 2001 From: Ihab Awad Date: Mon, 30 Jun 2014 21:24:01 -0700 Subject: Rename Telecomm "Subscription" to "Account" (3/7) Change-Id: I866e9d4f629a2b23acb3d3d3f2baeb0a674522f7 --- src/com/android/dialer/CallDetailActivity.java | 21 ++++++------ src/com/android/dialer/DialtactsActivity.java | 37 ++++++++++------------ src/com/android/dialer/PhoneCallDetails.java | 11 +++---- src/com/android/dialer/PhoneCallDetailsHelper.java | 19 +++-------- src/com/android/dialer/PhoneCallDetailsViews.java | 8 ++--- src/com/android/dialer/calllog/CallLogAdapter.java | 27 +++++++--------- .../dialer/calllog/CallLogGroupBuilder.java | 32 +++++++++---------- .../dialer/calllog/CallLogListItemViews.java | 7 ++-- src/com/android/dialer/calllog/CallLogQuery.java | 8 ++--- src/com/android/dialer/calllog/IntentProvider.java | 8 ++--- .../android/dialer/dialpad/DialpadFragment.java | 32 ++++++++----------- 11 files changed, 93 insertions(+), 117 deletions(-) (limited to 'src/com/android/dialer') diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index d07060111..3735293fc 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -32,7 +32,6 @@ import android.provider.CallLog; 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 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware CallLog.Calls.COUNTRY_ISO, CallLog.Calls.GEOCODED_LOCATION, CallLog.Calls.NUMBER_PRESENTATION, - CallLog.Calls.SUBSCRIPTION_COMPONENT_NAME, - CallLog.Calls.SUBSCRIPTION_ID, + CallLog.Calls.ACCOUNT_COMPONENT_NAME, + CallLog.Calls.ACCOUNT_ID, }; static final int DATE_COLUMN_INDEX = 0; @@ -207,8 +206,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware 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 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware 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 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware 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 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware } /** - * 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 da46a40c4..014ea7e77 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -28,16 +28,13 @@ import android.content.pm.PackageManager; 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.PopupMenu; 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 class DialtactsActivity extends TransactionSafeActivity implements View.O 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 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O 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 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O 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 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O 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 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } mIsDialpadShown = true; mDialpadFragment.setAnimate(animate); - mDialpadFragment.setSubscriptionManager(mSubscriptionManager); + mDialpadFragment.setAccountManager(mAccountManager); final FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.show(mDialpadFragment); @@ -776,8 +773,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O 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,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onCallNumberDirectly(String phoneNumber) { - final Subscription subscription = mSubscriptionManager != null? - mSubscriptionManager.getCurrentSubscription(): null; - Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin(), subscription); + 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 3562b170f..afdb2e303 100644 --- a/src/com/android/dialer/PhoneCallDetails.java +++ b/src/com/android/dialer/PhoneCallDetails.java @@ -20,7 +20,6 @@ import android.graphics.drawable.Drawable; 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 @@ public class PhoneCallDetails { /** * 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 @@ public class PhoneCallDetails { 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 @@ public class PhoneCallDetails { 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 05314128b..62ef30580 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.android.dialer.calllog.PhoneNumberUtilsWrapper; 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 @@ public class PhoneCallDetailsHelper { // 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 4f701376f..67babc1f7 100644 --- a/src/com/android/dialer/PhoneCallDetailsViews.java +++ b/src/com/android/dialer/PhoneCallDetailsViews.java @@ -30,17 +30,17 @@ public final class PhoneCallDetailsViews { 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 @@ public final class PhoneCallDetailsViews { 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 d08933069..483c5020a 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -27,9 +27,8 @@ import android.os.Handler; 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 android.widget.TextView; 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 com.google.common.base.Objects; 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 @@ public class CallLogAdapter extends GroupingListAdapter 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 @@ public class CallLogAdapter extends GroupingListAdapter 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 @@ public class CallLogAdapter extends GroupingListAdapter 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 @@ public class CallLogAdapter extends GroupingListAdapter 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 @@ public class CallLogAdapter extends GroupingListAdapter 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 @@ public class CallLogAdapter extends GroupingListAdapter 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 a36ceb48f..9c4e6319a 100644 --- a/src/com/android/dialer/calllog/CallLogGroupBuilder.java +++ b/src/com/android/dialer/calllog/CallLogGroupBuilder.java @@ -126,9 +126,9 @@ public class CallLogGroupBuilder { // 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 @@ public class CallLogGroupBuilder { // 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 @@ public class CallLogGroupBuilder { // 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 39c6e6435..8048d83cb 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 final class CallLogListItemViews { 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 87b7a45a0..42b4ae82f 100644 --- a/src/com/android/dialer/calllog/CallLogQuery.java +++ b/src/com/android/dialer/calllog/CallLogQuery.java @@ -44,8 +44,8 @@ public final class CallLogQuery { Calls.CACHED_FORMATTED_NUMBER, // 15 Calls.IS_READ, // 16 Calls.NUMBER_PRESENTATION, // 17 - Calls.SUBSCRIPTION_COMPONENT_NAME, // 18 - Calls.SUBSCRIPTION_ID, // 19 + Calls.ACCOUNT_COMPONENT_NAME, // 18 + Calls.ACCOUNT_ID, // 19 }; public static final int ID = 0; @@ -66,6 +66,6 @@ public final class CallLogQuery { 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 6a270be2d..9820102d2 100644 --- a/src/com/android/dialer/calllog/IntentProvider.java +++ b/src/com/android/dialer/calllog/IntentProvider.java @@ -19,11 +19,9 @@ package com.android.dialer.calllog; 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 class IntentProvider { 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 9752aa7fb..f9139c7b7 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -34,13 +34,11 @@ import android.media.AudioManager; 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.MenuItem; 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.ImageView; 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 @@ public class DialpadFragment extends Fragment 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 @@ public class DialpadFragment extends Fragment @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 @@ public class DialpadFragment extends Fragment // 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 @@ public class DialpadFragment extends Fragment 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 @@ public class DialpadFragment extends Fragment return mAnimate; } - public void setSubscriptionManager(SubscriptionManager subscriptionManager) { - mSubscriptionManager = subscriptionManager; + public void setAccountManager(PhoneAccountManager accountManager) { + mAccountManager = accountManager; } public void setYFraction(float yFraction) { -- cgit v1.2.3