Merge "Add logging to indicate how many call log rows are cleaned up on insert." into udc-d1-dev am: 1e7ed25da4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24248372 Change-Id: I27144d72cf38d74d0e79e4d869a82ae67f9133f4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -63,6 +63,7 @@ import java.io.InputStream;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@@ -1956,9 +1957,8 @@ public class CallLog {
|
||||
userManager.isUserUnlocked(user) ? CONTENT_URI : SHADOW_CONTENT_URI,
|
||||
user.getIdentifier());
|
||||
|
||||
if (VERBOSE_LOG) {
|
||||
Log.v(LOG_TAG, String.format("Inserting to %s", uri));
|
||||
}
|
||||
Log.i(LOG_TAG, String.format(Locale.getDefault(),
|
||||
"addEntryAndRemoveExpiredEntries: provider uri=%s", uri));
|
||||
|
||||
try {
|
||||
// When cleaning up the call log, try to delete older call long entries on a per
|
||||
@@ -1985,13 +1985,14 @@ public class CallLog {
|
||||
Log.w(LOG_TAG, "Failed to insert into call log; null result uri.");
|
||||
}
|
||||
|
||||
int numDeleted;
|
||||
if (values.containsKey(PHONE_ACCOUNT_ID)
|
||||
&& !TextUtils.isEmpty(values.getAsString(PHONE_ACCOUNT_ID))
|
||||
&& values.containsKey(PHONE_ACCOUNT_COMPONENT_NAME)
|
||||
&& !TextUtils.isEmpty(values.getAsString(PHONE_ACCOUNT_COMPONENT_NAME))) {
|
||||
// Only purge entries for the same phone account.
|
||||
resolver.delete(uri, "_id IN " +
|
||||
"(SELECT _id FROM calls"
|
||||
numDeleted = resolver.delete(uri, "_id IN "
|
||||
+ "(SELECT _id FROM calls"
|
||||
+ " WHERE " + PHONE_ACCOUNT_COMPONENT_NAME + " = ?"
|
||||
+ " AND " + PHONE_ACCOUNT_ID + " = ?"
|
||||
+ " ORDER BY " + DEFAULT_SORT_ORDER
|
||||
@@ -2001,14 +2002,15 @@ public class CallLog {
|
||||
});
|
||||
} else {
|
||||
// No valid phone account specified, so default to the old behavior.
|
||||
resolver.delete(uri, "_id IN " +
|
||||
"(SELECT _id FROM calls ORDER BY " + DEFAULT_SORT_ORDER
|
||||
numDeleted = resolver.delete(uri, "_id IN "
|
||||
+ "(SELECT _id FROM calls ORDER BY " + DEFAULT_SORT_ORDER
|
||||
+ " LIMIT -1 OFFSET 500)", null);
|
||||
}
|
||||
Log.i(LOG_TAG, "addEntry: cleaned up " + numDeleted + " old entries");
|
||||
|
||||
return result;
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w(LOG_TAG, "Failed to insert calllog", e);
|
||||
Log.e(LOG_TAG, "Failed to insert calllog", e);
|
||||
// Even though we make sure the target user is running and decrypted before calling
|
||||
// this method, there's a chance that the user just got shut down, in which case
|
||||
// we'll still get "IllegalArgumentException: Unknown URL content://call_log/calls".
|
||||
|
||||
Reference in New Issue
Block a user