|
|
|
|
@@ -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));
|
|
|
|
|
@@ -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
|
|
|
|
|
|