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

Commit 5054dfa7 authored by Pavel Zhamaitsiak's avatar Pavel Zhamaitsiak
Browse files

Use TelephonyEventLog to send events to TelephonyDebugService

Send following:
- RIL Data call events
- RIL Voice call events
- RIL SMS events
- Service State changes
- IMS call events

Change-Id: I865d8852982aca03b770e8712aac707afecb0f79
parent 7041d1d6
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -269,6 +269,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

    private Integer mInstanceId;

    private TelephonyEventLog mEventLog;

    //***** Events

    static final int EVENT_SEND                 = 1;
@@ -680,6 +682,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        TelephonyDevController tdc = TelephonyDevController.getInstance();
        tdc.registerRIL(this);

        mEventLog = TelephonyEventLog.getInstance(mContext, mInstanceId);
    }

    //***** CommandsInterface implementation
@@ -960,6 +964,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilDial(rr.mSerial, clirMode, uusInfo);

        send(rr);
    }

@@ -1015,6 +1021,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " +
                gsmIndex);

        mEventLog.writeRilHangup(rr.mSerial, RIL_REQUEST_HANGUP, gsmIndex);

        rr.mParcel.writeInt(1);
        rr.mParcel.writeInt(gsmIndex);

@@ -1029,6 +1037,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilHangup(rr.mSerial, RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, -1);

        send(rr);
    }

@@ -1041,6 +1051,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
                                        result);
        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilHangup(rr.mSerial, RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, -1);

        send(rr);
    }

@@ -1109,6 +1121,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilAnswer(rr.mSerial);

        send(rr);
    }

@@ -1318,6 +1332,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilSendSms(rr.mSerial, rr.mRequest);

        send(rr);
    }

@@ -1331,6 +1347,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilSendSms(rr.mSerial, rr.mRequest);

        send(rr);
    }

@@ -1383,6 +1401,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilSendSms(rr.mSerial, rr.mRequest);

        send(rr);
    }

@@ -1399,6 +1419,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilSendSms(rr.mSerial, rr.mRequest);

        send(rr);
    }

@@ -1414,6 +1436,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        mEventLog.writeRilSendSms(rr.mSerial, rr.mRequest);

        send(rr);
    }

@@ -1525,6 +1549,9 @@ public final class RIL extends BaseCommands implements CommandsInterface {
                + profile + " " + apn + " " + user + " "
                + password + " " + authType + " " + protocol);

        mEventLog.writeRilSetupDataCall(rr.mSerial, radioTechnology, profile, apn,
                user, password, authType, protocol);

        send(rr);
    }

@@ -1541,6 +1568,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        if (RILJ_LOGD) riljLog(rr.serialString() + "> " +
                requestToString(rr.mRequest) + " " + cid + " " + reason);

        mEventLog.writeRilDeactivateDataCall(rr.mSerial, cid, reason);

        send(rr);
    }

@@ -2688,6 +2717,9 @@ public final class RIL extends BaseCommands implements CommandsInterface {
                rr.mResult.sendToTarget();
            }
        }

        mEventLog.writeOnRilSolicitedResponse(rr.mSerial, error, rr.mRequest, ret);

        return rr;
    }

@@ -2888,6 +2920,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            case RIL_UNSOL_RESPONSE_NEW_SMS: {
                if (RILJ_LOGD) unsljLog(response);

                mEventLog.writeRilNewSms(response);

                // FIXME this should move up a layer
                String a[] = new String[2];

@@ -3074,6 +3108,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS:
                if (RILJ_LOGD) unsljLog(response);

                mEventLog.writeRilNewSms(response);

                SmsMessage sms = (SmsMessage) ret;

                if (mCdmaSmsRegistrant != null) {
@@ -3233,6 +3269,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            case RIL_UNSOL_SRVCC_STATE_NOTIFY: {
                if (RILJ_LOGD) unsljLogRet(response, ret);

                mEventLog.writeRilSrvcc(((int[])ret)[0]);

                if (mSrvccStateRegistrants != null) {
                    mSrvccStateRegistrants
                            .notifyRegistrants(new AsyncResult(null, ret, null));
@@ -3631,6 +3669,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            response.add(getDataCallResponse(p, ver));
        }

        mEventLog.writeRilDataCallList(response);

        return response;
    }

@@ -3870,6 +3910,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        response[2] = (char) p.readInt();    // alertPitch
        response[3] = (char) p.readInt();    // signal

        mEventLog.writeRilCallRing(response);

        return response;
    }

+5 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public class ServiceStateTracker extends Handler {
    private UiccController mUiccController = null;
    private UiccCardApplication mUiccApplcation = null;
    private IccRecords mIccRecords = null;
    private TelephonyEventLog mEventLog;

    private boolean mVoiceCapable;

@@ -527,6 +528,8 @@ public class ServiceStateTracker extends Handler {
        filter = new IntentFilter();
        filter.addAction(ACTION_RADIO_OFF);
        context.registerReceiver(mIntentReceiver, filter);

        mEventLog = TelephonyEventLog.getInstance(mPhone.getContext(), mPhone.getPhoneId());
    }

    protected void updatePhoneType() {
@@ -2718,6 +2721,8 @@ public class ServiceStateTracker extends Handler {
            setRoamingType(mSS);
            log("Broadcasting ServiceState : " + mSS);
            mPhone.notifyServiceStateChanged(mSS);

            mEventLog.writeServiceStateChanged(mSS);
        }

        if (hasGprsAttached) {
+481 −0

File added.

Preview size limit exceeded, changes collapsed.

+56 −5
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.text.TextUtils;
import android.preference.PreferenceManager;
import android.telecom.ConferenceParticipant;
import android.telecom.VideoProfile;
import android.telephony.CarrierConfigManager;
import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
import android.telephony.Rlog;
@@ -70,6 +69,7 @@ import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyEventLog;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.gsm.SuppServiceNotification;

@@ -90,6 +90,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
    private final String[] mImsFeatureStrings = {"VoLTE", "ViLTE", "VoWiFi", "ViWiFi",
            "UTLTE", "UTWiFi"};

    private TelephonyEventLog mEventLog;

    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
@@ -129,6 +131,8 @@ public final class ImsPhoneCallTracker extends CallTracker {

                    setVideoCallProvider(conn, imsCall);

                    mEventLog.writeOnImsCallReceive(imsCall.getSession());

                    if (isUnknown) {
                        mPhone.notifyUnknownConnection(conn);
                    } else {
@@ -218,6 +222,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
    ImsPhoneCallTracker(ImsPhone phone) {
        this.mPhone = phone;

        mEventLog = TelephonyEventLog.getInstance(mPhone.getContext(), mPhone.getPhoneId());

        IntentFilter intentfilter = new IntentFilter();
        intentfilter.addAction(ImsManager.ACTION_IMS_INCOMING_CALL);
        intentfilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
@@ -505,6 +511,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
                    callees, mImsCallListener);
            conn.setImsCall(imsCall);

            mEventLog.writeOnImsCallStart(imsCall.getSession(), callees[0]);

            setVideoCallProvider(conn, imsCall);
        } catch (ImsException e) {
            loge("dialInternal : " + e);
@@ -543,6 +551,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
                ImsCall imsCall = mRingingCall.getImsCall();
                if (imsCall != null) {
                    imsCall.accept(ImsCallProfile.getCallTypeFromVideoState(videoState));
                    mEventLog.writeOnImsCallAccept(imsCall.getSession());
                } else {
                    throw new CallStateException("no valid ims call");
                }
@@ -600,6 +609,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
            // be resumed.
            try {
                imsCall.hold();
                mEventLog.writeOnImsCallHold(imsCall.getSession());

                // If there is no background call to resume, then don't expect there to be a switch.
                if (mCallExpectedToResume == null) {
@@ -740,6 +750,7 @@ public final class ImsPhoneCallTracker extends CallTracker {

        if (mState != oldState) {
            mPhone.notifyPhoneStateChanged();
            mEventLog.writeImsPhoneState(mState);
        }
    }

@@ -887,8 +898,13 @@ public final class ImsPhoneCallTracker extends CallTracker {

        try {
            if (imsCall != null) {
                if (rejectCall) imsCall.reject(ImsReasonInfo.CODE_USER_DECLINE);
                else imsCall.terminate(ImsReasonInfo.CODE_USER_TERMINATED);
                if (rejectCall) {
                    imsCall.reject(ImsReasonInfo.CODE_USER_DECLINE);
                    mEventLog.writeOnImsCallReject(imsCall.getSession());
                } else {
                    imsCall.terminate(ImsReasonInfo.CODE_USER_TERMINATED);
                    mEventLog.writeOnImsCallTerminate(imsCall.getSession());
                }
            } else if (mPendingMO != null && call == mForegroundCall) {
                // is holding a foreground call
                mPendingMO.update(null, ImsPhoneCall.State.DISCONNECTED);
@@ -923,13 +939,17 @@ public final class ImsPhoneCallTracker extends CallTracker {
                //resume foreground call after holding background call
                //they were switched before holding
                ImsCall imsCall = mForegroundCall.getImsCall();
                if (imsCall != null) imsCall.resume();
                if (imsCall != null) {
                    imsCall.resume();
                    mEventLog.writeOnImsCallResume(imsCall.getSession());
                }
            } else if (mRingingCall.getState() == ImsPhoneCall.State.WAITING) {
                //accept waiting call after holding background call
                ImsCall imsCall = mRingingCall.getImsCall();
                if (imsCall != null) {
                    imsCall.accept(
                        ImsCallProfile.getCallTypeFromVideoState(mPendingCallVideoState));
                    mEventLog.writeOnImsCallAccept(imsCall.getSession());
                }
            } else {
                //Just resume background call.
@@ -937,7 +957,10 @@ public final class ImsPhoneCallTracker extends CallTracker {
                //we do not switch calls.here
                //ImsPhoneConnection.update will chnage the parent when completed
                ImsCall imsCall = mBackgroundCall.getImsCall();
                if (imsCall != null) imsCall.resume();
                if (imsCall != null) {
                    imsCall.resume();
                    mEventLog.writeOnImsCallResume(imsCall.getSession());
                }
            }
        } catch (ImsException e) {
            throw new CallStateException(e.getMessage());
@@ -1140,6 +1163,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
            mPendingMO = null;
            processCallStateChange(imsCall, ImsPhoneCall.State.ALERTING,
                    DisconnectCause.NOT_DISCONNECTED);
            mEventLog.writeOnImsCallProgressing(imsCall.getCallSession());
        }

        @Override
@@ -1149,6 +1173,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
            mPendingMO = null;
            processCallStateChange(imsCall, ImsPhoneCall.State.ACTIVE,
                    DisconnectCause.NOT_DISCONNECTED);
            mEventLog.writeOnImsCallStarted(imsCall.getCallSession());
        }

        @Override
@@ -1161,6 +1186,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
            if (conn != null) {
                processCallStateChange(imsCall, conn.getCall().mState,
                        DisconnectCause.NOT_DISCONNECTED, true /*ignore state update*/);
                mEventLog.writeImsCallState(imsCall.getCallSession(), conn.getCall().mState);
            }
        }

@@ -1189,6 +1215,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
                    int cause = getDisconnectCauseFromReasonInfo(reasonInfo);
                    processCallStateChange(imsCall, ImsPhoneCall.State.DISCONNECTED, cause);
                }
                mEventLog.writeOnImsCallStartFailed(imsCall.getCallSession(), reasonInfo);
            }
        }

@@ -1251,6 +1278,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
                    mCallExpectedToResume = null;
                }
            }

            mEventLog.writeOnImsCallTerminated(imsCall.getCallSession(), reasonInfo);
        }

        @Override
@@ -1303,6 +1332,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
                    }
                }
            }
            mEventLog.writeOnImsCallHeld(imsCall.getCallSession());
        }

        @Override
@@ -1325,6 +1355,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
                    }
                }
            }
            mEventLog.writeOnImsCallHoldFailed(imsCall.getCallSession(), reasonInfo);
        }

        @Override
@@ -1345,6 +1376,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
            }
            processCallStateChange(imsCall, ImsPhoneCall.State.ACTIVE,
                    DisconnectCause.NOT_DISCONNECTED);
            mEventLog.writeOnImsCallResumed(imsCall.getCallSession());
        }

        @Override
@@ -1361,6 +1393,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
                mSwitchingFgAndBgCalls = false;
            }
            mPhone.notifySuppServiceFailed(Phone.SuppService.RESUME);
            mEventLog.writeOnImsCallResumeFailed(imsCall.getCallSession(), reasonInfo);
        }

        @Override
@@ -1378,6 +1411,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
            supp.notificationType = 1;
            supp.code = SuppServiceNotification.MT_CODE_CALL_RETRIEVED;
            mPhone.notifySuppSvcNotification(supp);
            mEventLog.writeOnImsCallResumeReceived(imsCall.getCallSession());
        }

        @Override
@@ -1398,6 +1432,7 @@ public final class ImsPhoneCallTracker extends CallTracker {
            supp.notificationType = 1;
            supp.code = SuppServiceNotification.MT_CODE_CALL_ON_HOLD;
            mPhone.notifySuppSvcNotification(supp);
            mEventLog.writeOnImsCallHoldReceived(imsCall.getCallSession());
        }

        @Override
@@ -1516,6 +1551,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
                log("onCallHandover ::  srcAccessTech=" + srcAccessTech + ", targetAccessTech=" +
                    targetAccessTech + ", reasonInfo=" + reasonInfo);
            }
            mEventLog.writeOnImsCallHandover(imsCall.getCallSession(),
                    srcAccessTech, targetAccessTech, reasonInfo);
        }

        @Override
@@ -1525,6 +1562,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
                log("onCallHandoverFailed :: srcAccessTech=" + srcAccessTech +
                    ", targetAccessTech=" + targetAccessTech + ", reasonInfo=" + reasonInfo);
            }
            mEventLog.writeOnImsCallHandoverFailed(imsCall.getCallSession(),
                    srcAccessTech, targetAccessTech, reasonInfo);
        }

        /**
@@ -1619,6 +1658,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
            if (DBG) log("onImsConnected");
            mPhone.setServiceState(ServiceState.STATE_IN_SERVICE);
            mPhone.setImsRegistered(true);
            mEventLog.writeOnImsConnectionState(
                    TelephonyEventLog.IMS_CONNECTION_STATE_CONNECTED, null);
        }

        @Override
@@ -1627,6 +1668,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
            mPhone.setServiceState(ServiceState.STATE_OUT_OF_SERVICE);
            mPhone.setImsRegistered(false);
            mPhone.processDisconnectReason(imsReasonInfo);
            mEventLog.writeOnImsConnectionState(
                    TelephonyEventLog.IMS_CONNECTION_STATE_DISCONNECTED, imsReasonInfo);
        }

        @Override
@@ -1634,18 +1677,24 @@ public final class ImsPhoneCallTracker extends CallTracker {
            if (DBG) log("onImsProgressing");
            mPhone.setServiceState(ServiceState.STATE_OUT_OF_SERVICE);
            mPhone.setImsRegistered(false);
            mEventLog.writeOnImsConnectionState(
                    TelephonyEventLog.IMS_CONNECTION_STATE_PROGRESSING, null);
        }

        @Override
        public void onImsResumed() {
            if (DBG) log("onImsResumed");
            mPhone.setServiceState(ServiceState.STATE_IN_SERVICE);
            mEventLog.writeOnImsConnectionState(
                    TelephonyEventLog.IMS_CONNECTION_STATE_RESUMED, null);
        }

        @Override
        public void onImsSuspended() {
            if (DBG) log("onImsSuspended");
            mPhone.setServiceState(ServiceState.STATE_OUT_OF_SERVICE);
            mEventLog.writeOnImsConnectionState(
                    TelephonyEventLog.IMS_CONNECTION_STATE_SUSPENDED, null);
        }

        @Override
@@ -1706,6 +1755,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
                }

                mPhone.onFeatureCapabilityChanged();

                mEventLog.writeOnImsCapabilities(mImsFeatureEnabled);
            }
        }