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

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

Merge "CallAttributes uses the call network type"

am: 0a04598a

Change-Id: I05c392a2a53c295e1edca2341b2d618d5def0dc9
parents 5af7ce8d 0a04598a
Loading
Loading
Loading
Loading
+9 −33
Original line number Diff line number Diff line
@@ -177,8 +177,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {

    private ServiceState[] mServiceState;

    private int[] mNetworkType;

    private int[] mVoiceActivationState;

    private int[] mDataActivationState;
@@ -213,6 +211,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
    private CallAttributes mCallAttributes = new CallAttributes(new PreciseCallState(),
            TelephonyManager.NETWORK_TYPE_UNKNOWN, new CallQuality());

    // network type of the call associated with the mCallAttributes and mCallQuality
    private int mCallNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;

    private int[] mSrvccState;

    private int mDefaultSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -374,7 +375,6 @@ 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];
@@ -395,7 +395,6 @@ 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;
@@ -997,21 +996,6 @@ 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
@@ -1039,14 +1023,6 @@ 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);
@@ -1573,7 +1549,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                log("notifyPreciseCallState: mCallQuality is null, skipping call attributes");
                notifyCallAttributes = false;
            } else {
                mCallAttributes = new CallAttributes(mPreciseCallState, mNetworkType[phoneId],
                mCallAttributes = new CallAttributes(mPreciseCallState, mCallNetworkType,
                        mCallQuality);
            }

@@ -1840,16 +1816,16 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
    }

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

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

        synchronized (mRecords) {
            TelephonyManager tm = (TelephonyManager) mContext.getSystemService(
@@ -1886,7 +1862,6 @@ 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]);
@@ -1900,6 +1875,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                pw.println("mImsCallDisconnectCause=" + mImsReasonInfo.get(i).toString());
                pw.decreaseIndent();
            }
            pw.println("mCallNetworkType=" + mCallNetworkType);
            pw.println("mPreciseDataConnectionState=" + mPreciseDataConnectionState);
            pw.println("mPreciseCallState=" + mPreciseCallState);
            pw.println("mCallDisconnectCause=" + mCallDisconnectCause);
+1 −1
Original line number Diff line number Diff line
@@ -84,6 +84,6 @@ interface ITelephonyRegistry {
    void notifyPreferredDataSubIdChanged(int preferredSubId);
    void notifyRadioPowerStateChanged(in int state);
    void notifyEmergencyNumberList();
    void notifyCallQualityChanged(in CallQuality callQuality, int phoneId);
    void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int callNetworkType);
    void notifyImsDisconnectCause(int subId, in ImsReasonInfo imsReasonInfo);
}