[Call Screening]Logging of calls blocked by call blocking feature, call screening app.
Add three call log entries, ALL_SCREENING_COMPONENT_NAME, CALL_SCREENING_APP_NAME, BLOCK_REASON, and call block reasons. Add new parameter to get the package name and component name of the implementation of CallScreenService.java. Bug: 113243596 Test: Build pass Change-Id: I63debd80d7f4a92278fdbb84b64ff1199591349c
This commit is contained in:
@@ -34999,6 +34999,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";
|
||||
@@ -35008,6 +35017,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";
|
||||
|
||||
@@ -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 =*/ "",
|
||||
presentation, callType, features, accountHandle, start, duration,
|
||||
dataUsage, /* addForAllUsers =*/ false, /* userToBeInsertedTo =*/ null,
|
||||
/* is_read =*/ false);
|
||||
return addCall(ci, context, number, "" /* postDialDigits */, "" /* viaNumber */,
|
||||
presentation, callType, features, accountHandle, start, duration,
|
||||
dataUsage, false /* addForAllUsers */, null /* userToBeInsertedTo */,
|
||||
false /* isRead */, Calls.BLOCK_REASON_NOT_BLOCKED /* callBlockReason */,
|
||||
null /* callScreeningAppName */, null /* callScreeningComponentName */);
|
||||
}
|
||||
|
||||
|
||||
@@ -572,8 +668,10 @@ public class CallLog {
|
||||
int features, PhoneAccountHandle accountHandle, long start, int duration,
|
||||
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);
|
||||
features, accountHandle, start, duration, dataUsage, addForAllUsers,
|
||||
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));
|
||||
@@ -687,9 +789,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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user