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

Commit bc7463c6 authored by Sewook Seo's avatar Sewook Seo Committed by Android (Google) Code Review
Browse files

Merge "Adding Ims Call Info to CallAttributes"

parents ca16c76b 3a819be3
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony;

import android.annotation.NonNull;
import android.content.Context;
import android.telephony.Annotation;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.SrvccState;
import android.telephony.BarringInfo;
@@ -34,6 +35,7 @@ import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager.DataEnabledReason;
import android.telephony.TelephonyRegistryManager;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsCallSession;
import android.telephony.ims.ImsReasonInfo;

import com.android.telephony.Rlog;
@@ -142,15 +144,28 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        mTelephonyRegistryMgr.notifyCellInfoChanged(subId, cellInfo);
    }

    public void notifyPreciseCallState(Phone sender) {
    /**
     * Notify precise call state of foreground, background and ringing call states.
     *
     * @param imsCallIds Array of IMS call session ID{@link ImsCallSession#getCallId} for
     *                   ringing, foreground & background calls.
     * @param imsCallServiceTypes Array of IMS call service type for ringing, foreground &
     *                        background calls.
     * @param imsCallTypes Array of IMS call type for ringing, foreground & background calls.
     */
    public void notifyPreciseCallState(Phone sender, String[] imsCallIds,
            @Annotation.ImsCallServiceType int[] imsCallServiceTypes,
            @Annotation.ImsCallType int[] imsCallTypes) {
        Call ringingCall = sender.getRingingCall();
        Call foregroundCall = sender.getForegroundCall();
        Call backgroundCall = sender.getBackgroundCall();

        if (ringingCall != null && foregroundCall != null && backgroundCall != null) {
            mTelephonyRegistryMgr.notifyPreciseCallState(sender.getPhoneId(), sender.getSubId(),
                    convertPreciseCallState(ringingCall.getState()),
            int[] callStates = {convertPreciseCallState(ringingCall.getState()),
                    convertPreciseCallState(foregroundCall.getState()),
                    convertPreciseCallState(backgroundCall.getState()));
                    convertPreciseCallState(backgroundCall.getState())};
            mTelephonyRegistryMgr.notifyPreciseCallState(sender.getPhoneId(), sender.getSubId(),
                    callStates, imsCallIds, imsCallServiceTypes, imsCallTypes);
        }
    }

+4 −1
Original line number Diff line number Diff line
@@ -749,7 +749,10 @@ public class GsmCdmaPhone extends Phone {
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public void notifyPreciseCallStateChanged() {
        /* we'd love it if this was package-scoped*/
        super.notifyPreciseCallStateChangedP();
        AsyncResult ar = new AsyncResult(null, this, null);
        mPreciseCallStateRegistrants.notifyRegistrants(ar);

        mNotifier.notifyPreciseCallState(this, null, null, null);
    }

    public void notifyNewRingingConnection(Connection c) {
+1 −12
Original line number Diff line number Diff line
@@ -396,7 +396,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    public static final String EXTRA_KEY_ALERT_SHOW = "alertShow";
    public static final String EXTRA_KEY_NOTIFICATION_MESSAGE = "notificationMessage";

    private final RegistrantList mPreciseCallStateRegistrants = new RegistrantList();
    protected final RegistrantList mPreciseCallStateRegistrants = new RegistrantList();

    private final RegistrantList mHandoverRegistrants = new RegistrantList();

@@ -977,17 +977,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mPreciseCallStateRegistrants.remove(h);
    }

    /**
     * Subclasses of Phone probably want to replace this with a
     * version scoped to their packages
     */
    protected void notifyPreciseCallStateChangedP() {
        AsyncResult ar = new AsyncResult(null, this, null);
        mPreciseCallStateRegistrants.notifyRegistrants(ar);

        mNotifier.notifyPreciseCallState(this);
    }

    /**
     * Notifies when a Handover happens due to SRVCC or Silent Redial
     */
+5 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony;

import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.telephony.Annotation;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.SrvccState;
import android.telephony.BarringInfo;
@@ -78,7 +79,10 @@ public interface PhoneNotifier {

    void notifyCellInfo(Phone sender, List<CellInfo> cellInfo);

    void notifyPreciseCallState(Phone sender);
    /** Send a notification that precise call state changed. */
    void notifyPreciseCallState(Phone sender, String[] imsCallIds,
            @Annotation.ImsCallServiceType int[] imsCallServiceTypes,
            @Annotation.ImsCallType int[] imsCallTypes);

    void notifyDisconnectCause(Phone sender, int cause, int preciseCause);

+34 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.RegistrantList;
import android.sysprop.TelephonyProperties;
import android.telephony.Annotation.DataActivityType;
import android.telephony.CallQuality;
import android.telephony.CallState;
import android.telephony.NetworkScanRequest;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
@@ -192,7 +193,39 @@ abstract class ImsPhoneBase extends Phone {
     */
    public void notifyPreciseCallStateChanged() {
        /* we'd love it if this was package-scoped*/
        super.notifyPreciseCallStateChangedP();
        AsyncResult ar = new AsyncResult(null, this, null);
        mPreciseCallStateRegistrants.notifyRegistrants(ar);

        ImsPhoneCall ringingCall = (ImsPhoneCall) getRingingCall();
        ImsPhoneCall foregroundCall = (ImsPhoneCall) getForegroundCall();
        ImsPhoneCall backgroundCall = (ImsPhoneCall) getBackgroundCall();

        if (ringingCall != null && foregroundCall != null && backgroundCall != null) {
            //Array for IMS call session ID of RINGING/FOREGROUND/BACKGROUND call
            String[] imsCallIds = new String[CallState.CALL_CLASSIFICATION_MAX];
            //Array for IMS call service type of RINGING/FOREGROUND/BACKGROUND call
            int[] imsCallServiceTypes = new int[CallState.CALL_CLASSIFICATION_MAX];
            //Array for IMS call type of RINGING/FOREGROUND/BACKGROUND call
            int[] imsCallTypes = new int[CallState.CALL_CLASSIFICATION_MAX];
            imsCallIds[CallState.CALL_CLASSIFICATION_RINGING] =
                    ringingCall.getCallSessionId();
            imsCallIds[CallState.CALL_CLASSIFICATION_FOREGROUND] =
                    foregroundCall.getCallSessionId();
            imsCallIds[CallState.CALL_CLASSIFICATION_BACKGROUND] =
                    backgroundCall.getCallSessionId();
            imsCallServiceTypes[CallState.CALL_CLASSIFICATION_RINGING] =
                    ringingCall.getServiceType();
            imsCallServiceTypes[CallState.CALL_CLASSIFICATION_FOREGROUND] =
                    foregroundCall.getServiceType();
            imsCallServiceTypes[CallState.CALL_CLASSIFICATION_BACKGROUND] =
                    backgroundCall.getServiceType();
            imsCallTypes[CallState.CALL_CLASSIFICATION_RINGING] = ringingCall.getCallType();
            imsCallTypes[CallState.CALL_CLASSIFICATION_FOREGROUND] =
                    foregroundCall.getCallType();
            imsCallTypes[CallState.CALL_CLASSIFICATION_BACKGROUND] =
                    backgroundCall.getCallType();
            mNotifier.notifyPreciseCallState(this, imsCallIds, imsCallServiceTypes, imsCallTypes);
        }
    }

    public void notifyDisconnect(Connection cn) {
Loading