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

Commit 6aceee0b authored by Tony Zhu's avatar Tony Zhu Committed by android-build-merger
Browse files

Merge "[Call Screening]Logging of calls blocked by call blocking feature, call...

Merge "[Call Screening]Logging of calls blocked by call blocking feature, call screening app." am: b5e8d452 am: 20b0ca7e
am: f922fb13

Change-Id: I4c7270d0ae8ea1fd42488e0e3efe2ca1b6d33d94
parents b7b36c79 f922fb13
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -35681,6 +35681,15 @@ package android.provider {
    method public static java.lang.String getLastOutgoingCall(android.content.Context);
    field public static final int ANSWERED_EXTERNALLY_TYPE = 7; // 0x7
    field public static final int BLOCKED_TYPE = 6; // 0x6
    field public static final java.lang.String BLOCK_REASON = "block_reason";
    field public static final int BLOCK_REASON_BLOCKED_NUMBER = 3; // 0x3
    field public static final int BLOCK_REASON_CALL_SCREENING_SERVICE = 1; // 0x1
    field public static final int BLOCK_REASON_DIRECT_TO_VOICEMAIL = 2; // 0x2
    field public static final int BLOCK_REASON_NOT_BLOCKED = 0; // 0x0
    field public static final int BLOCK_REASON_NOT_IN_CONTACTS = 7; // 0x7
    field public static final int BLOCK_REASON_PAY_PHONE = 6; // 0x6
    field public static final int BLOCK_REASON_RESTRICTED_NUMBER = 5; // 0x5
    field public static final int BLOCK_REASON_UNKNOWN_NUMBER = 4; // 0x4
    field public static final java.lang.String CACHED_FORMATTED_NUMBER = "formatted_number";
    field public static final java.lang.String CACHED_LOOKUP_URI = "lookup_uri";
    field public static final java.lang.String CACHED_MATCHED_NUMBER = "matched_number";
@@ -35690,6 +35699,8 @@ package android.provider {
    field public static final java.lang.String CACHED_NUMBER_TYPE = "numbertype";
    field public static final java.lang.String CACHED_PHOTO_ID = "photo_id";
    field public static final java.lang.String CACHED_PHOTO_URI = "photo_uri";
    field public static final java.lang.String CALL_SCREENING_APP_NAME = "call_screening_app_name";
    field public static final java.lang.String CALL_SCREENING_COMPONENT_NAME = "call_screening_component_name";
    field public static final android.net.Uri CONTENT_FILTER_URI;
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/calls";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/calls";
+116 −10
Original line number Diff line number Diff line
@@ -508,6 +508,100 @@ public class CallLog {
         */
        private static final int MIN_DURATION_FOR_NORMALIZED_NUMBER_UPDATE_MS = 1000 * 10;

        /**
         * Value for {@link CallLog.Calls#BLOCK_REASON}, set as the default value when a call was
         * not blocked by a CallScreeningService or any other system call blocking method.
         */
        public static final int BLOCK_REASON_NOT_BLOCKED = 0;

        /**
         * Value for {@link CallLog.Calls#BLOCK_REASON}, set when {@link CallLog.Calls#TYPE} is
         * {@link CallLog.Calls#BLOCKED_TYPE} to indicate that a call was blocked by a
         * CallScreeningService. The {@link CallLog.Calls#CALL_SCREENING_COMPONENT_NAME} and
         * {@link CallLog.Calls#CALL_SCREENING_APP_NAME} columns will indicate which call screening
         * service was responsible for blocking the call.
         */
        public static final int BLOCK_REASON_CALL_SCREENING_SERVICE = 1;

        /**
         * Value for {@link CallLog.Calls#BLOCK_REASON}, set when {@link CallLog.Calls#TYPE} is
         * {@link CallLog.Calls#BLOCKED_TYPE} to indicate that a call was blocked because the user
         * configured a contact to be sent directly to voicemail.
         */
        public static final int BLOCK_REASON_DIRECT_TO_VOICEMAIL = 2;

        /**
         * Value for {@link CallLog.Calls#BLOCK_REASON}, set when {@link CallLog.Calls#TYPE} is
         * {@link CallLog.Calls#BLOCKED_TYPE} to indicate that a call was blocked because it is
         * in the BlockedNumbers provider.
         */
        public static final int BLOCK_REASON_BLOCKED_NUMBER = 3;

        /**
         * Value for {@link CallLog.Calls#BLOCK_REASON}, set when {@link CallLog.Calls#TYPE} is
         * {@link CallLog.Calls#BLOCKED_TYPE} to indicate that a call was blocked because the user
         * has chosen to block all calls from unknown numbers.
         */
        public static final int BLOCK_REASON_UNKNOWN_NUMBER = 4;

        /**
         * Value for {@link CallLog.Calls#BLOCK_REASON}, set when {@link CallLog.Calls#TYPE} is
         * {@link CallLog.Calls#BLOCKED_TYPE} to indicate that a call was blocked because the user
         * has chosen to block all calls from restricted numbers.
         */
        public static final int BLOCK_REASON_RESTRICTED_NUMBER = 5;

        /**
         * Value for {@link CallLog.Calls#BLOCK_REASON}, set when {@link CallLog.Calls#TYPE} is
         * {@link CallLog.Calls#BLOCKED_TYPE} to indicate that a call was blocked because the user
         * has chosen to block all calls from pay phones.
         */
        public static final int BLOCK_REASON_PAY_PHONE = 6;

        /**
         * Value for {@link CallLog.Calls#BLOCK_REASON}, set when {@link CallLog.Calls#TYPE} is
         * {@link CallLog.Calls#BLOCKED_TYPE} to indicate that a call was blocked because the user
         * has chosen to block all calls from numbers not in their contacts.
         */
        public static final int BLOCK_REASON_NOT_IN_CONTACTS = 7;

        /**
         * The ComponentName of the CallScreeningService which blocked this call. Will be
         * populated when the {@link CallLog.Calls#TYPE} is {@link CallLog.Calls#BLOCKED_TYPE}.
         * <P>Type: TEXT</P>
         */
        public static final String CALL_SCREENING_COMPONENT_NAME = "call_screening_component_name";

        /**
         * The name of the app which blocked a call. Will be populated when the
         * {@link CallLog.Calls#TYPE} is {@link CallLog.Calls#BLOCKED_TYPE}. Provided as a
         * convenience so that the call log can still indicate which app blocked a call, even if
         * that app is no longer installed.
         * <P>Type: TEXT</P>
         */
        public static final String CALL_SCREENING_APP_NAME = "call_screening_app_name";

        /**
         * Where the {@link CallLog.Calls#TYPE} is {@link CallLog.Calls#BLOCKED_TYPE},
         * indicates the reason why a call is blocked.
         * <P>Type: INTEGER</P>
         *
         * <p>
         * Allowed values:
         * <ul>
         * <li>{@link CallLog.Calls#BLOCK_REASON_NOT_BLOCKED}</li>
         * <li>{@link CallLog.Calls#BLOCK_REASON_CALL_SCREENING_SERVICE}</li>
         * <li>{@link CallLog.Calls#BLOCK_REASON_DIRECT_TO_VOICEMAIL}</li>
         * <li>{@link CallLog.Calls#BLOCK_REASON_BLOCKED_NUMBER}</li>
         * <li>{@link CallLog.Calls#BLOCK_REASON_UNKNOWN_NUMBER}</li>
         * <li>{@link CallLog.Calls#BLOCK_REASON_RESTRICTED_NUMBER}</li>
         * <li>{@link CallLog.Calls#BLOCK_REASON_PAY_PHONE}</li>
         * <li>{@link CallLog.Calls#BLOCK_REASON_NOT_IN_CONTACTS}</li>
         * </ul>
         * </p>
         */
        public static final String BLOCK_REASON = "block_reason";

        /**
         * Adds a call to the call log.
         *
@@ -530,12 +624,14 @@ public class CallLog {
         * {@hide}
         */
        public static Uri addCall(CallerInfo ci, Context context, String number,
                int presentation, int callType, int features, PhoneAccountHandle accountHandle,
                int presentation, int callType, int features,
                PhoneAccountHandle accountHandle,
                long start, int duration, Long dataUsage) {
            return addCall(ci, context, number, /* postDialDigits =*/ "", /* viaNumber =*/ "",
            return addCall(ci, context, number, "" /* postDialDigits */, "" /* viaNumber */,
                presentation, callType, features, accountHandle, start, duration,
                    dataUsage, /* addForAllUsers =*/ false, /* userToBeInsertedTo =*/ null,
                    /* is_read =*/ false);
                dataUsage, false /* addForAllUsers */, null /* userToBeInsertedTo */,
                false /* isRead */, Calls.BLOCK_REASON_NOT_BLOCKED /* callBlockReason */,
                null /* callScreeningAppName */, null /* callScreeningComponentName */);
        }


@@ -573,7 +669,9 @@ public class CallLog {
                Long dataUsage, boolean addForAllUsers, UserHandle userToBeInsertedTo) {
            return addCall(ci, context, number, postDialDigits, viaNumber, presentation, callType,
                features, accountHandle, start, duration, dataUsage, addForAllUsers,
                    userToBeInsertedTo, /* is_read =*/ false);
                userToBeInsertedTo, false /* isRead */ , Calls.BLOCK_REASON_NOT_BLOCKED
                /* callBlockReason */, null /* callScreeningAppName */,
                null /* callScreeningComponentName */);
        }

        /**
@@ -602,8 +700,11 @@ public class CallLog {
         * @param userToBeInsertedTo {@link UserHandle} of user that the call is going to be
         *                           inserted to. null if it is inserted to the current user. The
         *                           value is ignored if @{link addForAllUsers} is true.
         * @param is_read Flag to show if the missed call log has been read by the user or not.
         * @param isRead Flag to show if the missed call log has been read by the user or not.
         *                Used for call log restore of missed calls.
         * @param callBlockReason The reason why the call is blocked.
         * @param callScreeningAppName The call screening application name which block the call.
         * @param callScreeningComponentName The call screening component name which block the call.
         *
         * @result The URI of the call log entry belonging to the user that made or received this
         *        call.  This could be of the shadow provider.  Do not return it to non-system apps,
@@ -615,7 +716,8 @@ public class CallLog {
                String postDialDigits, String viaNumber, int presentation, int callType,
                int features, PhoneAccountHandle accountHandle, long start, int duration,
                Long dataUsage, boolean addForAllUsers, UserHandle userToBeInsertedTo,
                boolean is_read) {
                boolean isRead, int callBlockReason, String callScreeningAppName,
                String callScreeningComponentName) {
            if (VERBOSE_LOG) {
                Log.v(LOG_TAG, String.format("Add call: number=%s, user=%s, for all=%s",
                        number, userToBeInsertedTo, addForAllUsers));
@@ -690,9 +792,13 @@ public class CallLog {
            values.put(ADD_FOR_ALL_USERS, addForAllUsers ? 1 : 0);

            if (callType == MISSED_TYPE) {
                values.put(IS_READ, Integer.valueOf(is_read ? 1 : 0));
                values.put(IS_READ, Integer.valueOf(isRead ? 1 : 0));
            }

            values.put(BLOCK_REASON, callBlockReason);
            values.put(CALL_SCREENING_APP_NAME, callScreeningAppName);
            values.put(CALL_SCREENING_COMPONENT_NAME, callScreeningComponentName);

            if ((ci != null) && (ci.contactIdOrZero > 0)) {
                // Update usage information for the number associated with the contact ID.
                // We need to use both the number and the ID for obtaining a data ID since other
+3 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.telecom;

import android.annotation.SdkConstant;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
@@ -229,7 +230,8 @@ public abstract class CallScreeningService extends Service {
                        callDetails.getTelecomCallId(),
                        response.getRejectCall(),
                        !response.getSkipCallLog(),
                        !response.getSkipNotification());
                        !response.getSkipNotification(),
                        new ComponentName(getPackageName(), getClass().getName()));
            } else {
                mCallScreeningAdapter.allowCall(callDetails.getTelecomCallId());
            }
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telecom;

import android.content.ComponentName;

/**
 * Internal remote callback interface for call screening services.
 *
@@ -30,5 +32,6 @@ oneway interface ICallScreeningAdapter {
            String callId,
            boolean shouldReject,
            boolean shouldAddToCallLog,
            boolean shouldShowNotification);
            boolean shouldShowNotification,
            in ComponentName componentName);
}