Loading src/com/android/dialer/CallDetailActivity.java +20 −10 Original line number Diff line number Diff line Loading @@ -208,6 +208,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware CallLog.Calls.TYPE, CallLog.Calls.COUNTRY_ISO, CallLog.Calls.GEOCODED_LOCATION, CallLog.Calls.NUMBER_PRESENTATION, }; static final int DATE_COLUMN_INDEX = 0; Loading @@ -216,6 +217,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware static final int CALL_TYPE_COLUMN_INDEX = 3; static final int COUNTRY_ISO_COLUMN_INDEX = 4; static final int GEOCODED_LOCATION_COLUMN_INDEX = 5; static final int NUMBER_PRESENTATION_COLUMN_INDEX = 6; private final View.OnClickListener mPrimaryActionListener = new View.OnClickListener() { @Override Loading Loading @@ -421,6 +423,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware // first. PhoneCallDetails firstDetails = details[0]; mNumber = firstDetails.number.toString(); final int numberPresentation = firstDetails.numberPresentation; final Uri contactUri = firstDetails.contactUri; final Uri photoUri = firstDetails.photoUri; Loading @@ -428,7 +431,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware mPhoneCallDetailsHelper.setCallDetailsHeader(mHeaderTextView, firstDetails); // Cache the details about the phone number. final boolean canPlaceCallsTo = mPhoneNumberHelper.canPlaceCallsTo(mNumber); final boolean canPlaceCallsTo = PhoneNumberHelper.canPlaceCallsTo(mNumber, numberPresentation); final boolean isVoicemailNumber = mPhoneNumberHelper.isVoicemailNumber(mNumber); final boolean isSipNumber = mPhoneNumberHelper.isSipNumber(mNumber); Loading Loading @@ -509,7 +513,9 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware if (canPlaceCallsTo) { final CharSequence displayNumber = mPhoneNumberHelper.getDisplayNumber( firstDetails.number, firstDetails.formattedNumber); firstDetails.number, firstDetails.numberPresentation, firstDetails.formattedNumber); ViewEntry entry = new ViewEntry( getString(R.string.menu_callNumber, Loading @@ -527,7 +533,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware // The secondary action allows to send an SMS to the number that placed the // call. if (mPhoneNumberHelper.canSendSmsTo(mNumber)) { if (mPhoneNumberHelper.canSendSmsTo(mNumber, numberPresentation)) { entry.setSecondaryAction( R.drawable.ic_text_holo_dark, new Intent(Intent.ACTION_SENDTO, Loading Loading @@ -598,10 +604,12 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware } // Read call log specifics. String number = callCursor.getString(NUMBER_COLUMN_INDEX); long date = callCursor.getLong(DATE_COLUMN_INDEX); long duration = callCursor.getLong(DURATION_COLUMN_INDEX); int callType = callCursor.getInt(CALL_TYPE_COLUMN_INDEX); final String number = callCursor.getString(NUMBER_COLUMN_INDEX); final int numberPresentation = callCursor.getInt( NUMBER_PRESENTATION_COLUMN_INDEX); final long date = callCursor.getLong(DATE_COLUMN_INDEX); final long duration = callCursor.getLong(DURATION_COLUMN_INDEX); 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); Loading @@ -619,12 +627,13 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware final Uri lookupUri; // If this is not a regular number, there is no point in looking it up in the contacts. ContactInfo info = mPhoneNumberHelper.canPlaceCallsTo(number) PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation) && !mPhoneNumberHelper.isVoicemailNumber(number) ? mContactInfoHelper.lookupNumber(number, countryIso) : null; if (info == null) { formattedNumber = mPhoneNumberHelper.getDisplayNumber(number, null); formattedNumber = mPhoneNumberHelper.getDisplayNumber(number, numberPresentation, null); nameText = ""; numberType = 0; numberLabel = ""; Loading @@ -638,7 +647,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware photoUri = info.photoUri; lookupUri = info.lookupUri; } return new PhoneCallDetails(number, formattedNumber, countryIso, geocode, return new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, new int[]{ callType }, date, duration, nameText, numberType, numberLabel, lookupUri, photoUri); } finally { Loading src/com/android/dialer/PhoneCallDetails.java +12 −7 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.provider.ContactsContract.CommonDataKinds.Phone; public class PhoneCallDetails { /** The number of the other party involved in the call. */ public final CharSequence number; /** The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED} */ public final int numberPresentation; /** The formatted version of {@link #number}. */ public final CharSequence formattedNumber; /** The country corresponding with the phone number. */ Loading Loading @@ -59,18 +61,21 @@ public class PhoneCallDetails { public final Uri photoUri; /** Create the details for a call with a number not associated with a contact. */ public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration) { this(number, formattedNumber, countryIso, geocode, callTypes, date, duration, "", 0, "", null, null); public PhoneCallDetails(CharSequence number, int numberPresentation, CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration) { this(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, duration, "", 0, "", null, null); } /** Create the details for a call with a number associated with a contact. */ public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration, CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri, public PhoneCallDetails(CharSequence number, int numberPresentation, CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration, CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri, Uri photoUri) { this.number = number; this.numberPresentation = numberPresentation; this.formattedNumber = formattedNumber; this.countryIso = countryIso; this.geocode = geocode; Loading src/com/android/dialer/PhoneCallDetailsHelper.java +3 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,8 @@ public class PhoneCallDetailsHelper { final CharSequence numberText; final CharSequence labelText; final CharSequence displayNumber = mPhoneNumberHelper.getDisplayNumber(details.number, details.formattedNumber); mPhoneNumberHelper.getDisplayNumber(details.number, details.numberPresentation, details.formattedNumber); if (TextUtils.isEmpty(details.name)) { nameText = displayNumber; if (TextUtils.isEmpty(details.geocode) Loading Loading @@ -135,7 +136,7 @@ public class PhoneCallDetailsHelper { public void setCallDetailsHeader(TextView nameView, PhoneCallDetails details) { final CharSequence nameText; final CharSequence displayNumber = mPhoneNumberHelper.getDisplayNumber(details.number, mPhoneNumberHelper.getDisplayNumber(details.number, details.numberPresentation, mResources.getString(R.string.recentCalls_addToContact)); if (TextUtils.isEmpty(details.name)) { nameText = displayNumber; Loading src/com/android/dialer/calllog/CallLogAdapter.java +8 −5 Original line number Diff line number Diff line Loading @@ -521,6 +521,7 @@ import java.util.LinkedList; views.listHeaderTextView.setVisibility(View.GONE); final String number = c.getString(CallLogQuery.NUMBER); final int numberPresentation = c.getInt(CallLogQuery.NUMBER_PRESENTATION); final long date = c.getLong(CallLogQuery.DATE); final long duration = c.getLong(CallLogQuery.DURATION); final int callType = c.getInt(CallLogQuery.CALL_TYPE); Loading Loading @@ -551,7 +552,7 @@ import java.util.LinkedList; ExpirableCache.CachedValue<ContactInfo> cachedInfo = mContactInfoCache.getCachedValue(numberCountryIso); ContactInfo info = cachedInfo == null ? null : cachedInfo.getValue(); if (!mPhoneNumberHelper.canPlaceCallsTo(number) if (!PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation) || mPhoneNumberHelper.isVoicemailNumber(number)) { // If this is a number that cannot be dialed, there is no point in looking up a contact // for it. Loading Loading @@ -593,12 +594,14 @@ import java.util.LinkedList; final String geocode = c.getString(CallLogQuery.GEOCODED_LOCATION); final PhoneCallDetails details; if (TextUtils.isEmpty(name)) { details = new PhoneCallDetails(number, formattedNumber, countryIso, geocode, callTypes, date, duration); details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, duration); } else { // We do not pass a photo id since we do not need the high-res picture. details = new PhoneCallDetails(number, formattedNumber, countryIso, geocode, callTypes, date, duration, name, ntype, label, lookupUri, null); details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, duration, name, ntype, label, lookupUri, null); } final boolean isNew = c.getInt(CallLogQuery.IS_READ) == 0; Loading src/com/android/dialer/calllog/CallLogFragment.java +2 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ import com.android.dialer.util.EmptyLoader; import com.android.dialer.voicemail.VoicemailStatusHelper; import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage; import com.android.dialer.voicemail.VoicemailStatusHelperImpl; import com.android.internal.telephony.CallerInfo; import com.android.internal.telephony.ITelephony; import com.google.common.annotations.VisibleForTesting; Loading Loading @@ -460,10 +459,8 @@ public class CallLogFragment extends ListFragment final Cursor cursor = (Cursor)mAdapter.getItem(position); if (cursor != null) { String number = cursor.getString(CallLogQuery.NUMBER); if (TextUtils.isEmpty(number) || number.equals(CallerInfo.UNKNOWN_NUMBER) || number.equals(CallerInfo.PRIVATE_NUMBER) || number.equals(CallerInfo.PAYPHONE_NUMBER)) { int numberPresentation = cursor.getInt(CallLogQuery.NUMBER_PRESENTATION); if (!PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation)) { // This number can't be called, do nothing return; } Loading Loading
src/com/android/dialer/CallDetailActivity.java +20 −10 Original line number Diff line number Diff line Loading @@ -208,6 +208,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware CallLog.Calls.TYPE, CallLog.Calls.COUNTRY_ISO, CallLog.Calls.GEOCODED_LOCATION, CallLog.Calls.NUMBER_PRESENTATION, }; static final int DATE_COLUMN_INDEX = 0; Loading @@ -216,6 +217,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware static final int CALL_TYPE_COLUMN_INDEX = 3; static final int COUNTRY_ISO_COLUMN_INDEX = 4; static final int GEOCODED_LOCATION_COLUMN_INDEX = 5; static final int NUMBER_PRESENTATION_COLUMN_INDEX = 6; private final View.OnClickListener mPrimaryActionListener = new View.OnClickListener() { @Override Loading Loading @@ -421,6 +423,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware // first. PhoneCallDetails firstDetails = details[0]; mNumber = firstDetails.number.toString(); final int numberPresentation = firstDetails.numberPresentation; final Uri contactUri = firstDetails.contactUri; final Uri photoUri = firstDetails.photoUri; Loading @@ -428,7 +431,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware mPhoneCallDetailsHelper.setCallDetailsHeader(mHeaderTextView, firstDetails); // Cache the details about the phone number. final boolean canPlaceCallsTo = mPhoneNumberHelper.canPlaceCallsTo(mNumber); final boolean canPlaceCallsTo = PhoneNumberHelper.canPlaceCallsTo(mNumber, numberPresentation); final boolean isVoicemailNumber = mPhoneNumberHelper.isVoicemailNumber(mNumber); final boolean isSipNumber = mPhoneNumberHelper.isSipNumber(mNumber); Loading Loading @@ -509,7 +513,9 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware if (canPlaceCallsTo) { final CharSequence displayNumber = mPhoneNumberHelper.getDisplayNumber( firstDetails.number, firstDetails.formattedNumber); firstDetails.number, firstDetails.numberPresentation, firstDetails.formattedNumber); ViewEntry entry = new ViewEntry( getString(R.string.menu_callNumber, Loading @@ -527,7 +533,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware // The secondary action allows to send an SMS to the number that placed the // call. if (mPhoneNumberHelper.canSendSmsTo(mNumber)) { if (mPhoneNumberHelper.canSendSmsTo(mNumber, numberPresentation)) { entry.setSecondaryAction( R.drawable.ic_text_holo_dark, new Intent(Intent.ACTION_SENDTO, Loading Loading @@ -598,10 +604,12 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware } // Read call log specifics. String number = callCursor.getString(NUMBER_COLUMN_INDEX); long date = callCursor.getLong(DATE_COLUMN_INDEX); long duration = callCursor.getLong(DURATION_COLUMN_INDEX); int callType = callCursor.getInt(CALL_TYPE_COLUMN_INDEX); final String number = callCursor.getString(NUMBER_COLUMN_INDEX); final int numberPresentation = callCursor.getInt( NUMBER_PRESENTATION_COLUMN_INDEX); final long date = callCursor.getLong(DATE_COLUMN_INDEX); final long duration = callCursor.getLong(DURATION_COLUMN_INDEX); 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); Loading @@ -619,12 +627,13 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware final Uri lookupUri; // If this is not a regular number, there is no point in looking it up in the contacts. ContactInfo info = mPhoneNumberHelper.canPlaceCallsTo(number) PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation) && !mPhoneNumberHelper.isVoicemailNumber(number) ? mContactInfoHelper.lookupNumber(number, countryIso) : null; if (info == null) { formattedNumber = mPhoneNumberHelper.getDisplayNumber(number, null); formattedNumber = mPhoneNumberHelper.getDisplayNumber(number, numberPresentation, null); nameText = ""; numberType = 0; numberLabel = ""; Loading @@ -638,7 +647,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware photoUri = info.photoUri; lookupUri = info.lookupUri; } return new PhoneCallDetails(number, formattedNumber, countryIso, geocode, return new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, new int[]{ callType }, date, duration, nameText, numberType, numberLabel, lookupUri, photoUri); } finally { Loading
src/com/android/dialer/PhoneCallDetails.java +12 −7 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.provider.ContactsContract.CommonDataKinds.Phone; public class PhoneCallDetails { /** The number of the other party involved in the call. */ public final CharSequence number; /** The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED} */ public final int numberPresentation; /** The formatted version of {@link #number}. */ public final CharSequence formattedNumber; /** The country corresponding with the phone number. */ Loading Loading @@ -59,18 +61,21 @@ public class PhoneCallDetails { public final Uri photoUri; /** Create the details for a call with a number not associated with a contact. */ public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration) { this(number, formattedNumber, countryIso, geocode, callTypes, date, duration, "", 0, "", null, null); public PhoneCallDetails(CharSequence number, int numberPresentation, CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration) { this(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, duration, "", 0, "", null, null); } /** Create the details for a call with a number associated with a contact. */ public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration, CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri, public PhoneCallDetails(CharSequence number, int numberPresentation, CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration, CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri, Uri photoUri) { this.number = number; this.numberPresentation = numberPresentation; this.formattedNumber = formattedNumber; this.countryIso = countryIso; this.geocode = geocode; Loading
src/com/android/dialer/PhoneCallDetailsHelper.java +3 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,8 @@ public class PhoneCallDetailsHelper { final CharSequence numberText; final CharSequence labelText; final CharSequence displayNumber = mPhoneNumberHelper.getDisplayNumber(details.number, details.formattedNumber); mPhoneNumberHelper.getDisplayNumber(details.number, details.numberPresentation, details.formattedNumber); if (TextUtils.isEmpty(details.name)) { nameText = displayNumber; if (TextUtils.isEmpty(details.geocode) Loading Loading @@ -135,7 +136,7 @@ public class PhoneCallDetailsHelper { public void setCallDetailsHeader(TextView nameView, PhoneCallDetails details) { final CharSequence nameText; final CharSequence displayNumber = mPhoneNumberHelper.getDisplayNumber(details.number, mPhoneNumberHelper.getDisplayNumber(details.number, details.numberPresentation, mResources.getString(R.string.recentCalls_addToContact)); if (TextUtils.isEmpty(details.name)) { nameText = displayNumber; Loading
src/com/android/dialer/calllog/CallLogAdapter.java +8 −5 Original line number Diff line number Diff line Loading @@ -521,6 +521,7 @@ import java.util.LinkedList; views.listHeaderTextView.setVisibility(View.GONE); final String number = c.getString(CallLogQuery.NUMBER); final int numberPresentation = c.getInt(CallLogQuery.NUMBER_PRESENTATION); final long date = c.getLong(CallLogQuery.DATE); final long duration = c.getLong(CallLogQuery.DURATION); final int callType = c.getInt(CallLogQuery.CALL_TYPE); Loading Loading @@ -551,7 +552,7 @@ import java.util.LinkedList; ExpirableCache.CachedValue<ContactInfo> cachedInfo = mContactInfoCache.getCachedValue(numberCountryIso); ContactInfo info = cachedInfo == null ? null : cachedInfo.getValue(); if (!mPhoneNumberHelper.canPlaceCallsTo(number) if (!PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation) || mPhoneNumberHelper.isVoicemailNumber(number)) { // If this is a number that cannot be dialed, there is no point in looking up a contact // for it. Loading Loading @@ -593,12 +594,14 @@ import java.util.LinkedList; final String geocode = c.getString(CallLogQuery.GEOCODED_LOCATION); final PhoneCallDetails details; if (TextUtils.isEmpty(name)) { details = new PhoneCallDetails(number, formattedNumber, countryIso, geocode, callTypes, date, duration); details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, duration); } else { // We do not pass a photo id since we do not need the high-res picture. details = new PhoneCallDetails(number, formattedNumber, countryIso, geocode, callTypes, date, duration, name, ntype, label, lookupUri, null); details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, duration, name, ntype, label, lookupUri, null); } final boolean isNew = c.getInt(CallLogQuery.IS_READ) == 0; Loading
src/com/android/dialer/calllog/CallLogFragment.java +2 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ import com.android.dialer.util.EmptyLoader; import com.android.dialer.voicemail.VoicemailStatusHelper; import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage; import com.android.dialer.voicemail.VoicemailStatusHelperImpl; import com.android.internal.telephony.CallerInfo; import com.android.internal.telephony.ITelephony; import com.google.common.annotations.VisibleForTesting; Loading Loading @@ -460,10 +459,8 @@ public class CallLogFragment extends ListFragment final Cursor cursor = (Cursor)mAdapter.getItem(position); if (cursor != null) { String number = cursor.getString(CallLogQuery.NUMBER); if (TextUtils.isEmpty(number) || number.equals(CallerInfo.UNKNOWN_NUMBER) || number.equals(CallerInfo.PRIVATE_NUMBER) || number.equals(CallerInfo.PAYPHONE_NUMBER)) { int numberPresentation = cursor.getInt(CallLogQuery.NUMBER_PRESENTATION); if (!PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation)) { // This number can't be called, do nothing return; } Loading