Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ac4568e authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge fb9c5651 on remote branch

Change-Id: I9a147f96e763dafd2381b4983d2e0b1ccac48cfb
parents b9599332 fb9c5651
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -452,17 +452,19 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe
                final int numberPresentation = firstDetails.numberPresentation;
                final Uri contactUri = firstDetails.contactUri;
                final Uri photoUri = firstDetails.photoUri;
                final long subId = firstDetails.accountId;

                // Cache the details about the phone number.
                final boolean canPlaceCallsTo =
                    PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation);
                final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper();
                final boolean isVoicemailNumber = phoneUtils.isVoicemailNumber(mNumber);
                final boolean isVoicemailNumber = phoneUtils.isVoicemailNumber(subId, mNumber);
                final boolean isSipNumber = phoneUtils.isSipNumber(mNumber);

                final CharSequence callLocationOrType = getNumberTypeOrLocation(firstDetails);

                final CharSequence displayNumber = mPhoneNumberHelper.getDisplayNumber(
                        subId,
                        firstDetails.number,
                        firstDetails.numberPresentation,
                        firstDetails.formattedNumber);
@@ -513,7 +515,9 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe

                String nameForDefaultImage;
                if (TextUtils.isEmpty(firstDetails.name)) {
                    nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(firstDetails.number,
                    nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(
                            firstDetails.accountId,
                            firstDetails.number,
                            firstDetails.numberPresentation,
                            firstDetails.formattedNumber).toString();
                } else {
@@ -574,6 +578,11 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe
                    PhoneAccountUtils.getAccount(
                    callCursor.getString(ACCOUNT_COMPONENT_NAME),
                    callCursor.getString(ACCOUNT_ID)));
            String accId = callCursor.getString(ACCOUNT_ID);
            long subId = SubscriptionManager.DEFAULT_SUB_ID;
            if (accId!=null && !accId.equals("E") && !accId.toLowerCase().contains("sip")) {
                subId = Long.parseLong(accId);
            }

            if (TextUtils.isEmpty(countryIso)) {
                countryIso = mDefaultCountryIso;
@@ -591,11 +600,11 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe
            // If this is not a regular number, there is no point in looking it up in the contacts.
            ContactInfo info =
                    PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)
                    && !new PhoneNumberUtilsWrapper().isVoicemailNumber(number)
                    && !new PhoneNumberUtilsWrapper().isVoicemailNumber(subId, number)
                            ? mContactInfoHelper.lookupNumber(number, countryIso)
                            : null;
            if (info == null) {
                formattedNumber = mPhoneNumberHelper.getDisplayNumber(number,
                formattedNumber = mPhoneNumberHelper.getDisplayNumber(subId, number,
                        numberPresentation, null);
                nameText = "";
                numberType = 0;
@@ -621,7 +630,8 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe
                    formattedNumber, countryIso, geocode,
                    new int[]{ callType }, date, duration,
                    nameText, numberType, numberLabel, lookupUri, photoUri, sourceType,
                    accountLabel, null, features, dataUsage, transcription, durationType);
                    accountLabel, null, features, dataUsage, transcription, durationType,
                    subId);
        } finally {
            if (callCursor != null) {
                callCursor.close();
+1 −1
Original line number Diff line number Diff line
@@ -714,7 +714,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O

        final FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.show(mDialpadFragment);
        ft.commit();
        ft.commitAllowingStateLoss();

        if (animate) {
            mFloatingActionButtonController.scaleOut();
+25 −5
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.telephony.SubscriptionManager;

/**
 * The details of a phone call to be shown in the UI.
@@ -74,6 +75,10 @@ public class PhoneCallDetails {
     * The icon for the account associated with the call.
     */
    public final Drawable accountIcon;
    /**
     * The account id associated with the call.
     */
    public final long accountId;
    /**
     * Features applicable to this call.
     */
@@ -90,6 +95,10 @@ public class PhoneCallDetails {
     * Duration type for this call.
     */
    public final int durationType;
    /**
     * Default phone Id
     */
    public final static int DEFAULT_PHONE_ID = 0;

    /**
     * Create the details for a call, with empty defaults specified for extra fields that are
@@ -100,7 +109,8 @@ public class PhoneCallDetails {
            CharSequence formattedNumber, String countryIso, String geocode,
            int[] callTypes, long date, long duration) {
        this (number, numberPresentation, formattedNumber, countryIso, geocode,
        callTypes, date, duration, "", 0, "", null, null, 0, null, null, 0, null, null);
                callTypes, date, duration, "", 0, "", null, null, 0, null, null, 0, null,
                null, Calls.DURATION_TYPE_ACTIVE, DEFAULT_PHONE_ID);
    }

    /** Create the details for a call with a number not associated with a contact. */
@@ -110,10 +120,19 @@ public class PhoneCallDetails {
            int features, Long dataUsage, String transcription) {
        this(number, numberPresentation, formattedNumber, countryIso, geocode,
                callTypes, date, duration, "", 0, "", null, null, 0, accountLabel, accountIcon,
                features, dataUsage, transcription);
                features, dataUsage, transcription, Calls.DURATION_TYPE_ACTIVE, DEFAULT_PHONE_ID);
    }

    /** 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, String accountLabel, Drawable accountIcon,
            int features, Long dataUsage, String transcription, long accountId) {
        this(number, numberPresentation, formattedNumber, countryIso, geocode,
                callTypes, date, duration, "", 0, "", null, null, 0, accountLabel, accountIcon,
                features, dataUsage, transcription, Calls.DURATION_TYPE_ACTIVE, accountId);
    }

    /** Create the details for a call with a number associated with a contact. */
    public PhoneCallDetails(CharSequence number, int numberPresentation,
            CharSequence formattedNumber, String countryIso, String geocode,
            int[] callTypes, long date, long duration, CharSequence name,
@@ -123,7 +142,7 @@ public class PhoneCallDetails {
        this(number, numberPresentation, formattedNumber, countryIso, geocode,
                callTypes, date, duration, name, numberType, numberLabel, contactUri,
                photoUri, sourceType, accountLabel, accountIcon, features, dataUsage,
                transcription, Calls.DURATION_TYPE_ACTIVE);
                transcription, Calls.DURATION_TYPE_ACTIVE, DEFAULT_PHONE_ID);
    }

    /** Create the details for a call with a number associated with a contact. */
@@ -132,7 +151,7 @@ public class PhoneCallDetails {
            int[] callTypes, long date, long duration, CharSequence name,
            int numberType, CharSequence numberLabel, Uri contactUri,
            Uri photoUri, int sourceType, String accountLabel, Drawable accountIcon, int features,
            Long dataUsage, String transcription, int durationType) {
            Long dataUsage, String transcription, int durationType, long accountId) {
        this.number = number;
        this.numberPresentation = numberPresentation;
        this.formattedNumber = formattedNumber;
@@ -153,5 +172,6 @@ public class PhoneCallDetails {
        this.dataUsage = dataUsage;
        this.transcription = transcription;
        this.durationType = durationType;
        this.accountId = accountId;
    }
}
+7 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.graphics.Typeface;
import android.text.SpannableString;
import android.text.Spanned;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.style.StyleSpan;
@@ -122,7 +123,7 @@ public class PhoneCallDetailsHelper {

        CharSequence nameText;
        CharSequence displayNumber =
            mPhoneNumberHelper.getDisplayNumber(details.number,
            mPhoneNumberHelper.getDisplayNumber(details.accountId, details.number,
                    details.numberPresentation, details.formattedNumber);
        String phoneNum = (String) details.number;
        if (!TextUtils.isEmpty(filter) && phoneNum.contains(filter)) {
@@ -198,7 +199,7 @@ public class PhoneCallDetailsHelper {
        // Only show a label if the number is shown and it is not a SIP address.
        if (!TextUtils.isEmpty(details.number)
                && !PhoneNumberHelper.isUriNumber(details.number.toString())
                && !mPhoneNumberUtilsWrapper.isVoicemailNumber(details.number)) {
                && !mPhoneNumberUtilsWrapper.isVoicemailNumber(details.accountId, details.number)) {

            if (details.numberLabel == ContactInfo.GEOCODE_AS_LABEL) {
                numberFormattedLabel = details.geocode;
@@ -209,8 +210,8 @@ public class PhoneCallDetailsHelper {
        }

        if (!TextUtils.isEmpty(details.name) && TextUtils.isEmpty(numberFormattedLabel)) {
            numberFormattedLabel = mPhoneNumberHelper.getDisplayNumber(details.number,
                    details.numberPresentation, details.formattedNumber);
            numberFormattedLabel = mPhoneNumberHelper.getDisplayNumber(details.accountId,
                    details.number, details.numberPresentation, details.formattedNumber);
        }
        return numberFormattedLabel;
    }
@@ -233,7 +234,8 @@ public class PhoneCallDetailsHelper {
    public void setCallDetailsHeader(TextView nameView, PhoneCallDetails details) {
        final CharSequence nameText;
        final CharSequence displayNumber =
            mPhoneNumberHelper.getDisplayNumber(details.number, details.numberPresentation,
            mPhoneNumberHelper.getDisplayNumber(details.accountId, details.number,
                        details.numberPresentation,
                        mResources.getString(R.string.recentCalls_addToContact));
        if (TextUtils.isEmpty(details.name)) {
            nameText = displayNumber;
+14 −5
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.os.Message;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.PhoneLookup;
import android.telecom.PhoneAccountHandle;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -651,6 +652,12 @@ public class CallLogAdapter extends GroupingListAdapter
        final long rowId = c.getLong(CallLogQuery.ID);
        views.rowId = rowId;

        String accId = c.getString(CallLogQuery.ACCOUNT_ID);
        long subId = SubscriptionManager.DEFAULT_SUB_ID;
        if (accId!= null && !accId.equals("E") && !accId.toLowerCase().contains("sip")) {
             subId = Long.parseLong(accId);
        }

        // For entries in the call log, check if the day group has changed and display a header
        // if necessary.
        if (mIsCallLog) {
@@ -680,7 +687,7 @@ public class CallLogAdapter extends GroupingListAdapter
        final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c);

        final boolean isVoicemailNumber =
                PhoneNumberUtilsWrapper.INSTANCE.isVoicemailNumber(number);
                PhoneNumberUtilsWrapper.INSTANCE.isVoicemailNumber(subId, number);

        // Where binding and not in the call log, use default behaviour of invoking a call when
        // tapping the primary view.
@@ -777,12 +784,13 @@ public class CallLogAdapter extends GroupingListAdapter
        if (TextUtils.isEmpty(name)) {
            details = new PhoneCallDetails(number, numberPresentation,
                    formattedNumber, countryIso, geocode, callTypes, date,
                    duration, null, accountIcon, features, dataUsage, transcription);
                    duration, null, accountIcon, features, dataUsage, transcription, subId);
        } else {
            details = new PhoneCallDetails(number, numberPresentation,
                    formattedNumber, countryIso, geocode, callTypes, date,
                    duration, name, ntype, label, lookupUri, photoUri, sourceType,
                    null, accountIcon, features, dataUsage, transcription);
                    null, accountIcon, features, dataUsage, transcription,
                    Calls.DURATION_TYPE_ACTIVE, subId);
        }

        mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details);
@@ -800,8 +808,9 @@ public class CallLogAdapter extends GroupingListAdapter

        String nameForDefaultImage = null;
        if (TextUtils.isEmpty(name)) {
            nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(details.number,
                    details.numberPresentation, details.formattedNumber).toString();
            nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(details.accountId,
                    details.number, details.numberPresentation,
                    details.formattedNumber).toString();
        } else {
            nameForDefaultImage = name;
        }
Loading