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

Commit 403675bd authored by Shaotang Li's avatar Shaotang Li Committed by Leo Hsu
Browse files

Add new telecom metrics for emergency dialer

These includes,
1. The source where user initiated the call.
2. The duration between START_CONNECTION and REQUEST_DISCONNECT.

Bug: 112168722
Bug: 111818008

Test: manual and check the result of
'adb shell dumpsys telecom' for metrics data
Change-Id: Iddc7f256362abe9fe252bd12cead05a7d77d329e
Merged-In: Iddc7f256362abe9fe252bd12cead05a7d77d329e
parent ebffdbd4
Loading
Loading
Loading
Loading
+38 −0
Original line number Original line Diff line number Diff line
@@ -195,6 +195,8 @@ public class ParcelableCallAnalytics implements Parcelable {
        public static final int BLOCK_CHECK_FINISHED_TIMING = 9;
        public static final int BLOCK_CHECK_FINISHED_TIMING = 9;
        public static final int FILTERING_COMPLETED_TIMING = 10;
        public static final int FILTERING_COMPLETED_TIMING = 10;
        public static final int FILTERING_TIMED_OUT_TIMING = 11;
        public static final int FILTERING_TIMED_OUT_TIMING = 11;
        /** {@hide} */
        public static final int START_CONNECTION_TO_REQUEST_DISCONNECT_TIMING = 12;


        public static final int INVALID = 999999;
        public static final int INVALID = 999999;


@@ -256,6 +258,27 @@ public class ParcelableCallAnalytics implements Parcelable {
    public static final int SIP_PHONE = 0x8;
    public static final int SIP_PHONE = 0x8;
    public static final int THIRD_PARTY_PHONE = 0x10;
    public static final int THIRD_PARTY_PHONE = 0x10;


    /**
     * Indicating the call source is not specified.
     *
     * @hide
     */
    public static final int CALL_SOURCE_UNSPECIFIED = 0;

    /**
     * Indicating the call is initiated via emergency dialer's dialpad.
     *
     * @hide
     */
    public static final int CALL_SOURCE_EMERGENCY_DIALPAD = 1;

    /**
     * Indicating the call is initiated via emergency dialer's shortcut button.
     *
     * @hide
     */
    public static final int CALL_SOURCE_EMERGENCY_SHORTCUT = 2;

    public static final long MILLIS_IN_5_MINUTES = 1000 * 60 * 5;
    public static final long MILLIS_IN_5_MINUTES = 1000 * 60 * 5;
    public static final long MILLIS_IN_1_SECOND = 1000;
    public static final long MILLIS_IN_1_SECOND = 1000;


@@ -319,6 +342,9 @@ public class ParcelableCallAnalytics implements Parcelable {
    // A list of video events that have occurred.
    // A list of video events that have occurred.
    private List<VideoEvent> videoEvents;
    private List<VideoEvent> videoEvents;


    // The source where user initiated this call. ONE OF the CALL_SOURCE_* constants.
    private int callSource = CALL_SOURCE_UNSPECIFIED;

    public ParcelableCallAnalytics(long startTimeMillis, long callDurationMillis, int callType,
    public ParcelableCallAnalytics(long startTimeMillis, long callDurationMillis, int callType,
            boolean isAdditionalCall, boolean isInterrupted, int callTechnologies,
            boolean isAdditionalCall, boolean isInterrupted, int callTechnologies,
            int callTerminationCode, boolean isEmergencyCall, String connectionService,
            int callTerminationCode, boolean isEmergencyCall, String connectionService,
@@ -356,6 +382,7 @@ public class ParcelableCallAnalytics implements Parcelable {
        isVideoCall = readByteAsBoolean(in);
        isVideoCall = readByteAsBoolean(in);
        videoEvents = new LinkedList<>();
        videoEvents = new LinkedList<>();
        in.readTypedList(videoEvents, VideoEvent.CREATOR);
        in.readTypedList(videoEvents, VideoEvent.CREATOR);
        callSource = in.readInt();
    }
    }


    public void writeToParcel(Parcel out, int flags) {
    public void writeToParcel(Parcel out, int flags) {
@@ -373,6 +400,7 @@ public class ParcelableCallAnalytics implements Parcelable {
        out.writeTypedList(eventTimings);
        out.writeTypedList(eventTimings);
        writeBooleanAsByte(out, isVideoCall);
        writeBooleanAsByte(out, isVideoCall);
        out.writeTypedList(videoEvents);
        out.writeTypedList(videoEvents);
        out.writeInt(callSource);
    }
    }


    /** {@hide} */
    /** {@hide} */
@@ -385,6 +413,11 @@ public class ParcelableCallAnalytics implements Parcelable {
        this.videoEvents = videoEvents;
        this.videoEvents = videoEvents;
    }
    }


    /** {@hide} */
    public void setCallSource(int callSource) {
        this.callSource = callSource;
    }

    public long getStartTimeMillis() {
    public long getStartTimeMillis() {
        return startTimeMillis;
        return startTimeMillis;
    }
    }
@@ -443,6 +476,11 @@ public class ParcelableCallAnalytics implements Parcelable {
        return videoEvents;
        return videoEvents;
    }
    }


    /** {@hide} */
    public int getCallSource() {
        return callSource;
    }

    @Override
    @Override
    public int describeContents() {
    public int describeContents() {
        return 0;
        return 0;
+12 −0
Original line number Original line Diff line number Diff line
@@ -618,6 +618,18 @@ public class TelecomManager {
    public static final String EXTRA_USE_ASSISTED_DIALING =
    public static final String EXTRA_USE_ASSISTED_DIALING =
            "android.telecom.extra.USE_ASSISTED_DIALING";
            "android.telecom.extra.USE_ASSISTED_DIALING";


    /**
     * Optional extra for {@link #placeCall(Uri, Bundle)} containing an integer that specifies
     * the source where user initiated this call. This data is used in metrics.
     * Valid source are:
     * {@link ParcelableCallAnalytics#CALL_SOURCE_UNSPECIFIED},
     * {@link ParcelableCallAnalytics#CALL_SOURCE_EMERGENCY_DIALPAD},
     * {@link ParcelableCallAnalytics#CALL_SOURCE_EMERGENCY_SHORTCUT}.
     *
     * @hide
     */
    public static final String EXTRA_CALL_SOURCE = "android.telecom.extra.CALL_SOURCE";

    /**
    /**
     * The following 4 constants define how properties such as phone numbers and names are
     * The following 4 constants define how properties such as phone numbers and names are
     * displayed to the user.
     * displayed to the user.