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

Commit 3be2df7b authored by Jordan Liu's avatar Jordan Liu Committed by android-build-merger
Browse files

Merge "Trigger PhoneStateListener onCallAttributesChanged" am: cd4ca49b

am: bbd7b917

Change-Id: Iefb3d9845b95e22f45ecfeb47f770b708951438a
parents f67e867f bbd7b917
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6109,6 +6109,7 @@ package android.telephony.ims {
  }

  public class ImsCallSessionListener {
    method public void callQualityChanged(android.telephony.CallQuality);
    method public void callSessionConferenceExtendFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionConferenceExtendReceived(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
    method public void callSessionConferenceExtended(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
+96 −1
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.UserHandle;
import android.telephony.CallAttributes;
import android.telephony.CallQuality;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.DataFailCause;
@@ -173,6 +175,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {

    private ServiceState[] mServiceState;

    private int[] mNetworkType;

    private int[] mVoiceActivationState;

    private int[] mDataActivationState;
@@ -202,6 +206,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {

    private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList;

    private CallQuality mCallQuality;

    private CallAttributes mCallAttributes;

    private int[] mSrvccState;

    private int mDefaultSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -358,6 +366,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        mDataConnectionNetworkType = new int[numPhones];
        mCallIncomingNumber = new String[numPhones];
        mServiceState = new ServiceState[numPhones];
        mNetworkType = new int[numPhones];
        mVoiceActivationState = new int[numPhones];
        mDataActivationState = new int[numPhones];
        mUserMobileDataState = new boolean[numPhones];
@@ -377,6 +386,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
            mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
            mCallIncomingNumber[i] =  "";
            mServiceState[i] =  new ServiceState();
            mNetworkType[i] = mServiceState[i].getVoiceNetworkType();
            mSignalStrength[i] =  new SignalStrength();
            mUserMobileDataState[i] = false;
            mMessageWaiting[i] =  false;
@@ -807,6 +817,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                            remove(r.binder);
                        }
                    }
                    if ((events & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) {
                        try {
                            r.callback.onCallAttributesChanged(mCallAttributes);
                        } catch (RemoteException ex) {
                            remove(r.binder);
                        }
                    }
                }
            }
        } else {
@@ -957,6 +974,21 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
            if (validatePhoneId(phoneId)) {
                mServiceState[phoneId] = state;

                boolean notifyCallAttributes = true;
                if (mNetworkType[phoneId] != mServiceState[phoneId].getVoiceNetworkType()) {
                    mNetworkType[phoneId] = state.getVoiceNetworkType();
                    mCallAttributes = new CallAttributes(mPreciseCallState, mNetworkType[phoneId],
                            mCallQuality);
                } else {
                    // No change to network type, so no need to notify call attributes
                    notifyCallAttributes = false;
                }

                if (mCallQuality == null) {
                    // No call quality reported yet, so no need to notify call attributes
                    notifyCallAttributes = false;
                }

                for (Record r : mRecords) {
                    if (VDBG) {
                        log("notifyServiceStateForSubscriber: r=" + r + " subId=" + subId
@@ -975,6 +1007,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                            mRemoveList.add(r.binder);
                        }
                    }
                    if (notifyCallAttributes && r.matchPhoneStateListenerEvent(
                                    PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) {
                        try {
                            r.callback.onCallAttributesChanged(mCallAttributes);
                        } catch (RemoteException ex) {
                            mRemoveList.add(r.binder);
                        }
                    }
                }
            } else {
                log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId);
@@ -1484,7 +1524,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
    }

    public void notifyPreciseCallState(int ringingCallState, int foregroundCallState,
            int backgroundCallState) {
            int backgroundCallState, int phoneId) {
        if (!checkNotifyPermission("notifyPreciseCallState()")) {
            return;
        }
@@ -1496,6 +1536,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    backgroundCallState,
                    DisconnectCause.NOT_VALID,
                    PreciseDisconnectCause.NOT_VALID);
            boolean notifyCallAttributes = true;
            if (mCallQuality == null) {
                log("notifyPreciseCallState: mCallQuality is null, skipping call attributes");
                notifyCallAttributes = false;
            } else {
                mCallAttributes = new CallAttributes(mPreciseCallState, mNetworkType[phoneId],
                        mCallQuality);
            }

            for (Record r : mRecords) {
                if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) {
                    try {
@@ -1504,6 +1553,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                        mRemoveList.add(r.binder);
                    }
                }
                if (notifyCallAttributes && r.matchPhoneStateListenerEvent(
                        PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) {
                    try {
                        r.callback.onCallAttributesChanged(mCallAttributes);
                    } catch (RemoteException ex) {
                        mRemoveList.add(r.binder);
                    }
                }
            }
            handleRemoveListLocked();
        }
@@ -1722,6 +1779,36 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        }
    }

    @Override
    public void notifyCallQualityChanged(CallQuality callQuality, int phoneId) {
        if (!checkNotifyPermission("notifyCallQualityChanged()")) {
            return;
        }

        // merge CallQuality with PreciseCallState and network type
        mCallQuality = callQuality;
        mCallAttributes = new CallAttributes(mPreciseCallState,
                mNetworkType[phoneId],
                callQuality);

        synchronized (mRecords) {
            TelephonyManager tm = (TelephonyManager) mContext.getSystemService(
                    Context.TELEPHONY_SERVICE);

            for (Record r : mRecords) {
                if (r.matchPhoneStateListenerEvent(
                        PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) {
                    try {
                        r.callback.onCallAttributesChanged(mCallAttributes);
                    } catch (RemoteException ex) {
                        mRemoveList.add(r.binder);
                    }
                }
            }
            handleRemoveListLocked();
        }
    }


    @Override
    public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
@@ -1739,6 +1826,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                pw.println("mCallState=" + mCallState[i]);
                pw.println("mCallIncomingNumber=" + mCallIncomingNumber[i]);
                pw.println("mServiceState=" + mServiceState[i]);
                pw.println("mNetworkType=" + mNetworkType[i]);
                pw.println("mVoiceActivationState= " + mVoiceActivationState[i]);
                pw.println("mDataActivationState= " + mDataActivationState[i]);
                pw.println("mUserMobileDataState= " + mUserMobileDataState[i]);
@@ -1764,6 +1852,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
            pw.println("mPreferredDataSubId=" + mPreferredDataSubId);
            pw.println("mRadioPowerState=" + mRadioPowerState);
            pw.println("mEmergencyNumberList=" + mEmergencyNumberList);
            pw.println("mCallQuality=" + mCallQuality);
            pw.println("mCallAttributes=" + mCallAttributes);

            pw.decreaseIndent();

@@ -2021,6 +2111,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);
        }

        if ((events & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) {
            mContext.enforceCallingOrSelfPermission(
                    android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);
        }

        return true;
    }

+18 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.telephony.ims;

import android.os.Message;
import android.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.aidl.IImsCallSessionListener;
import android.util.Log;

@@ -450,6 +451,13 @@ public class ImsCallSession {
        public void callSessionRttAudioIndicatorChanged(ImsStreamMediaProfile profile) {
            // no-op
        }

        /**
         * Called when the IMS service reports a change to the call quality.
         */
        public void callQualityChanged(CallQuality callQuality) {
            // no-op
        }
    }

    private final IImsCallSession miSession;
@@ -1414,6 +1422,16 @@ public class ImsCallSession {
                mListener.callSessionRttAudioIndicatorChanged(profile);
            }
        }

        /**
         * Call quality updated
         */
        @Override
        public void callQualityChanged(CallQuality callQuality) {
            if (mListener != null) {
                mListener.callQualityChanged(callQuality);
            }
        }
    }

    /**
+14 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.telephony.ims;

import android.annotation.SystemApi;
import android.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.aidl.IImsCallSessionListener;
import android.telephony.ims.stub.ImsCallSessionImplBase;

@@ -612,5 +613,18 @@ public class ImsCallSessionListener {
            throw new RuntimeException(e);
        }
    }

    /**
     * The call quality has changed.
     *
     * @param callQuality The new call quality
     */
    public void callQualityChanged(CallQuality callQuality) {
        try {
            mListener.callQualityChanged(callQuality);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    }
}
+11 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.telephony.ims.aidl;

import android.telephony.CallQuality;
import android.telephony.ims.ImsStreamMediaProfile;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsReasonInfo;
@@ -126,22 +127,29 @@ oneway interface IImsCallSessionListener {
     */
    void callSessionRttModifyRequestReceived(in ImsCallProfile callProfile);

    /* Device issued RTT modify request and inturn received response
    /**
     * Device issued RTT modify request and inturn received response
     * from Remote UE
     * @param status Will be one of the following values from:
     * - {@link Connection.RttModifyStatus}
     */
    void callSessionRttModifyResponseReceived(int status);

    /*
    /**
     * While in call, device received RTT message from Remote UE
     * @param rttMessage Received RTT message
     */
    void callSessionRttMessageReceived(in String rttMessage);

    /*
    /**
     * While in call, there has been a change in RTT audio indicator.
     * @param profile updated ImsStreamMediaProfile
     */
    void callSessionRttAudioIndicatorChanged(in ImsStreamMediaProfile profile);

    /**
     * Notifies of a change to the call quality.
     * @param callQuality then updated call quality
     */
    void callQualityChanged(in CallQuality callQuality);
}
Loading