Merge "Add number presentation column to call log"

This commit is contained in:
Jay Shrauner
2013-06-19 21:14:16 +00:00
committed by Android (Google) Code Review
3 changed files with 40 additions and 14 deletions

View File

@@ -18763,8 +18763,13 @@ package android.provider {
field public static final int MISSED_TYPE = 3; // 0x3
field public static final java.lang.String NEW = "new";
field public static final java.lang.String NUMBER = "number";
field public static final java.lang.String NUMBER_PRESENTATION = "presentation";
field public static final java.lang.String OFFSET_PARAM_KEY = "offset";
field public static final int OUTGOING_TYPE = 2; // 0x2
field public static final int PRESENTATION_ALLOWED = 1; // 0x1
field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
field public static final int PRESENTATION_UNKNOWN = 3; // 0x3
field public static final java.lang.String TYPE = "type";
}

View File

@@ -136,6 +136,22 @@ public class CallLog {
*/
public static final String NUMBER = "number";
/**
* The number presenting rules set by the network for "allowed",
* "payphone", "restricted" or "unknown".
* <P>Type: INTEGER</P>
*/
public static final String NUMBER_PRESENTATION = "presentation";
/** Number is allowed to display for caller id. */
public static final int PRESENTATION_ALLOWED = 1;
/** Number is blocked by user. */
public static final int PRESENTATION_RESTRICTED = 2;
/** Number is not specified or unknown by network. */
public static final int PRESENTATION_UNKNOWN = 3;
/** Number is a pay phone. */
public static final int PRESENTATION_PAYPHONE = 4;
/**
* The ISO 3166-1 two letters country code of the country where the
* user received or made the call.
@@ -267,7 +283,8 @@ public class CallLog {
* 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 the number presenting rules set by the network for
* @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 start time stamp for the call in milliseconds
@@ -278,24 +295,32 @@ public class CallLog {
public static Uri addCall(CallerInfo ci, Context context, String number,
int presentation, int callType, long start, int duration) {
final ContentResolver resolver = context.getContentResolver();
int numberPresentation = PRESENTATION_ALLOWED;
// If this is a private number then set the number to Private, otherwise check
// if the number field is empty and set the number to Unavailable
// Remap network specified number presentation types
// PhoneConstants.PRESENTATION_xxx to calllog number presentation types
// Calls.PRESENTATION_xxx, in order to insulate the persistent calllog
// from any future radio changes.
// If the number field is empty set the presentation type to Unknown.
if (presentation == PhoneConstants.PRESENTATION_RESTRICTED) {
number = CallerInfo.PRIVATE_NUMBER;
if (ci != null) ci.name = "";
numberPresentation = PRESENTATION_RESTRICTED;
} else if (presentation == PhoneConstants.PRESENTATION_PAYPHONE) {
number = CallerInfo.PAYPHONE_NUMBER;
if (ci != null) ci.name = "";
numberPresentation = PRESENTATION_PAYPHONE;
} else if (TextUtils.isEmpty(number)
|| presentation == PhoneConstants.PRESENTATION_UNKNOWN) {
number = CallerInfo.UNKNOWN_NUMBER;
if (ci != null) ci.name = "";
numberPresentation = PRESENTATION_UNKNOWN;
}
if (numberPresentation != PRESENTATION_ALLOWED) {
number = "";
if (ci != null) {
ci.name = "";
}
}
ContentValues values = new ContentValues(5);
ContentValues values = new ContentValues(6);
values.put(NUMBER, number);
values.put(NUMBER_PRESENTATION, Integer.valueOf(numberPresentation));
values.put(TYPE, Integer.valueOf(callType));
values.put(DATE, Long.valueOf(start));
values.put(DURATION, Long.valueOf(duration));

View File

@@ -49,10 +49,6 @@ public class CallerInfo {
private static final String TAG = "CallerInfo";
private static final boolean VDBG = Rlog.isLoggable(TAG, Log.VERBOSE);
public static final String UNKNOWN_NUMBER = "-1";
public static final String PRIVATE_NUMBER = "-2";
public static final String PAYPHONE_NUMBER = "-3";
/**
* Please note that, any one of these member variables can be null,
* and any accesses to them should be prepared to handle such a case.