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

Commit 19dfe456 authored by qqzhou's avatar qqzhou Committed by Linux Build Service Account
Browse files

CallLog: Support duration type for CDMA call log

Display the type(Active time/Call out time) in call log
of CDMA call.

Change-Id: Icdc459b0e6aff2ae7f9d44395b6886232de16efe
parent a655f059
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
@@ -223,6 +223,25 @@ public class CallLog {
         */
        public static final String DURATION = "duration";

        /**
         * The type of the duration
         * <P>Type: INTEGER (long)</P>
         * @hide
         */
        public static final String DURATION_TYPE = "duration_type";

        /**
         * duration type for active.
         * @hide
         */
        public static final int DURATION_TYPE_ACTIVE = 0;

        /**
         * duration type for call out.
         * @hide
         */
        public static final int DURATION_TYPE_CALLOUT = 1;

        /**
         * The data usage of the call in bytes.
         * <P>Type: INTEGER (long)</P>
@@ -418,6 +437,39 @@ public class CallLog {
        public static Uri addCall(CallerInfo ci, Context context, String number,
                int presentation, int callType, int features, PhoneAccountHandle accountHandle,
                long start, int duration, Long dataUsage, boolean addForAllUsers) {
            return addCall(ci, context, number, presentation, callType, features, accountHandle,
                    start, duration, dataUsage, addForAllUsers, DURATION_TYPE_ACTIVE);
        }

        /**
         * Adds a call to the call log.
         *
         * @param ci the CallerInfo object to get the target contact from.  Can be null
         * if the contact is unknown.
         * @param context the context used to get the ContentResolver
         * @param number the phone number to be added to the calls db
         * @param presentation enum value from PhoneConstants.PRESENTATION_xxx, which
         *        is set by the network and denotes the number presenting rules for
         *        "allowed", "payphone", "restricted" or "unknown"
         * @param callType enumerated values for "incoming", "outgoing", or "missed"
         * @param features features of the call (e.g. Video).
         * @param accountHandle The accountHandle object identifying the provider of the call
         * @param start time stamp for the call in milliseconds
         * @param duration call duration in seconds
         * @param dataUsage data usage for the call in bytes, null if data usage was not tracked for
         *                  the call.
         * @param addForAllUsers If true, the call is added to the call log of all currently
         *        running users. The caller must have the MANAGE_USERS permission if this is true.
         * @param durationType valid value is 0 or 1.
         *
         * @result The URI of the call log entry belonging to the user that made or received this
         *        call.
         * {@hide}
         */
        public static Uri addCall(CallerInfo ci, Context context, String number,
                int presentation, int callType, int features, PhoneAccountHandle accountHandle,
                long start, int duration, Long dataUsage, boolean addForAllUsers,
                int durationType) {
            final ContentResolver resolver = context.getContentResolver();
            int numberPresentation = PRESENTATION_ALLOWED;

@@ -457,6 +509,7 @@ public class CallLog {
            values.put(FEATURES, features);
            values.put(DATE, Long.valueOf(start));
            values.put(DURATION, Long.valueOf(duration));
            values.put(DURATION_TYPE, Integer.valueOf(durationType));
            if (dataUsage != null) {
                values.put(DATA_USAGE, dataUsage);
            }