summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Santos Cordon <santoscordon@google.com> 2015-02-27 15:22:07 -0800
committer Santos Cordon <santoscordon@google.com> 2015-03-03 00:33:35 +0000
commitc66f3baa42b8a732952abf1967c68f77d3e26131 (patch)
tree83840e043491214f8116bb71d564735041b98dd1
parent20d58e2af7738209b068038197db516d365d887a (diff)
Hide calllog entries for unregistered phone accounts
Change-Id: If1f873dd41c973442fa7a24020e56d13b7b5ad2c
-rw-r--r--api/system-current.txt1
-rw-r--r--core/java/android/provider/CallLog.java25
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java9
3 files changed, 34 insertions, 1 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 0a680003ba19..4992d8d87ccb 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -30894,6 +30894,7 @@ package android.telecom {
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_SHOW_CALL_ACCESSIBILITY_SETTINGS = "android.telecom.action.SHOW_CALL_ACCESSIBILITY_SETTINGS";
+ 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 java.lang.String ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS = "android.telecom.action.SHOW_RESPOND_VIA_SMS_SETTINGS";
field public static final char DTMF_CHARACTER_PAUSE = 44; // 0x002c ','
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 266922d95dff..2df9dbfb467b 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -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";
/**
@@ -359,6 +362,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.
* For ContactsProvider internal use only.
@@ -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) {
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 9739d4e3f073..b40afbfc647b 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -104,6 +104,15 @@ public class TelecomManager {
"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.
*/