Hide calllog entries for unregistered phone accounts
Cherry-picked from master Change-Id: If1f873dd41c973442fa7a24020e56d13b7b5ad2c
This commit is contained in:
committed by
Nancy Chen
parent
2782f31a73
commit
2d2bc16f2d
@@ -30394,6 +30394,7 @@ package android.telecom {
|
||||
method public void unregisterPhoneAccount(android.telecom.PhoneAccountHandle);
|
||||
field public static final java.lang.String ACTION_CHANGE_PHONE_ACCOUNTS = "android.telecom.action.CHANGE_PHONE_ACCOUNTS";
|
||||
field public static final java.lang.String ACTION_CONNECTION_SERVICE_CONFIGURE = "android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
|
||||
field public static final java.lang.String ACTION_PHONE_ACCOUNT_REGISTERED = "android.telecom.action.PHONE_ACCOUNT_REGISTERED";
|
||||
field public static final java.lang.String ACTION_SHOW_CALL_SETTINGS = "android.telecom.action.SHOW_CALL_SETTINGS";
|
||||
field public static final char DTMF_CHARACTER_PAUSE = 44; // 0x002c ','
|
||||
field public static final char DTMF_CHARACTER_WAIT = 59; // 0x003b ';'
|
||||
|
||||
@@ -38,6 +38,7 @@ import android.telecom.PhoneAccountHandle;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.telephony.CallerInfo;
|
||||
import com.android.internal.telephony.PhoneConstants;
|
||||
@@ -48,6 +49,8 @@ import java.util.List;
|
||||
* The CallLog provider contains information about placed and received calls.
|
||||
*/
|
||||
public class CallLog {
|
||||
private static final String LOG_TAG = "CallLog";
|
||||
|
||||
public static final String AUTHORITY = "call_log";
|
||||
|
||||
/**
|
||||
@@ -358,6 +361,15 @@ public class CallLog {
|
||||
*/
|
||||
public static final String PHONE_ACCOUNT_ADDRESS = "phone_account_address";
|
||||
|
||||
/**
|
||||
* Indicates that the entry will be hidden from all queries until the associated
|
||||
* {@link android.telecom.PhoneAccount} is registered with the system.
|
||||
* <P>Type: INTEGER</P>
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String PHONE_ACCOUNT_HIDDEN = "phone_account_hidden";
|
||||
|
||||
/**
|
||||
* The subscription ID used to place this call. This is no longer used and has been
|
||||
* replaced with PHONE_ACCOUNT_COMPONENT_NAME/PHONE_ACCOUNT_ID.
|
||||
@@ -434,6 +446,7 @@ public class CallLog {
|
||||
long start, int duration, Long dataUsage, boolean addForAllUsers) {
|
||||
final ContentResolver resolver = context.getContentResolver();
|
||||
int numberPresentation = PRESENTATION_ALLOWED;
|
||||
boolean isHidden = false;
|
||||
|
||||
TelecomManager tm = null;
|
||||
try {
|
||||
@@ -444,7 +457,16 @@ public class CallLog {
|
||||
if (tm != null && accountHandle != null) {
|
||||
PhoneAccount account = tm.getPhoneAccount(accountHandle);
|
||||
if (account != null) {
|
||||
accountAddress = account.getSubscriptionAddress().getSchemeSpecificPart();
|
||||
Uri address = account.getSubscriptionAddress();
|
||||
if (address != null) {
|
||||
accountAddress = address.getSchemeSpecificPart();
|
||||
}
|
||||
} else {
|
||||
// We could not find the account through telecom. For call log entries that
|
||||
// are added with a phone account which is not registered, we automatically
|
||||
// mark them as hidden. They are unhidden once the account is registered.
|
||||
Log.i(LOG_TAG, "Marking call log entry as hidden.");
|
||||
isHidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,6 +512,7 @@ public class CallLog {
|
||||
values.put(PHONE_ACCOUNT_COMPONENT_NAME, accountComponentString);
|
||||
values.put(PHONE_ACCOUNT_ID, accountId);
|
||||
values.put(PHONE_ACCOUNT_ADDRESS, accountAddress);
|
||||
values.put(PHONE_ACCOUNT_HIDDEN, Integer.valueOf(isHidden ? 1 : 0));
|
||||
values.put(NEW, Integer.valueOf(1));
|
||||
|
||||
if (callType == MISSED_TYPE) {
|
||||
|
||||
@@ -91,6 +91,15 @@ public class TelecomManager {
|
||||
public static final String ACTION_CHANGE_PHONE_ACCOUNTS =
|
||||
"android.telecom.action.CHANGE_PHONE_ACCOUNTS";
|
||||
|
||||
/**
|
||||
* The {@link android.content.Intent} action used indicate that a new phone account was
|
||||
* just registered.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final String ACTION_PHONE_ACCOUNT_REGISTERED =
|
||||
"android.telecom.action.PHONE_ACCOUNT_REGISTERED";
|
||||
|
||||
/**
|
||||
* Optional extra for {@link android.content.Intent#ACTION_CALL} containing a boolean that
|
||||
* determines whether the speakerphone should be automatically turned on for an outgoing call.
|
||||
|
||||
Reference in New Issue
Block a user