am 3397727b: Merge "disable verbose logs from people notifications." into mnc-dev

* commit '3397727b165a432ab5d82789798375f4688c6b1e':
  disable verbose logs from people notifications.
This commit is contained in:
Chris Wren
2015-06-16 20:07:39 +00:00
committed by Android Git Automerger

View File

@@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit;
public class ValidateNotificationPeople implements NotificationSignalExtractor { public class ValidateNotificationPeople implements NotificationSignalExtractor {
// Using a shorter log tag since setprop has a limit of 32chars on variable name. // Using a shorter log tag since setprop has a limit of 32chars on variable name.
private static final String TAG = "ValidateNoPeople"; private static final String TAG = "ValidateNoPeople";
private static final boolean INFO = true; private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);;
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
private static final boolean ENABLE_PEOPLE_VALIDATOR = true; private static final boolean ENABLE_PEOPLE_VALIDATOR = true;
@@ -100,7 +100,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
public void onChange(boolean selfChange, Uri uri, int userId) { public void onChange(boolean selfChange, Uri uri, int userId) {
super.onChange(selfChange, uri, userId); super.onChange(selfChange, uri, userId);
if (DEBUG || mEvictionCount % 100 == 0) { if (DEBUG || mEvictionCount % 100 == 0) {
if (INFO) Slog.i(TAG, "mEvictionCount: " + mEvictionCount); if (VERBOSE) Slog.i(TAG, "mEvictionCount: " + mEvictionCount);
} }
mPeopleCache.evictAll(); mPeopleCache.evictAll();
mEvictionCount++; mEvictionCount++;
@@ -113,20 +113,20 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
public RankingReconsideration process(NotificationRecord record) { public RankingReconsideration process(NotificationRecord record) {
if (!mEnabled) { if (!mEnabled) {
if (INFO) Slog.i(TAG, "disabled"); if (VERBOSE) Slog.i(TAG, "disabled");
return null; return null;
} }
if (record == null || record.getNotification() == null) { if (record == null || record.getNotification() == null) {
if (INFO) Slog.i(TAG, "skipping empty notification"); if (VERBOSE) Slog.i(TAG, "skipping empty notification");
return null; return null;
} }
if (record.getUserId() == UserHandle.USER_ALL) { if (record.getUserId() == UserHandle.USER_ALL) {
if (INFO) Slog.i(TAG, "skipping global notification"); if (VERBOSE) Slog.i(TAG, "skipping global notification");
return null; return null;
} }
Context context = getContextAsUser(record.getUser()); Context context = getContextAsUser(record.getUser());
if (context == null) { if (context == null) {
if (INFO) Slog.i(TAG, "skipping notification that lacks a context"); if (VERBOSE) Slog.i(TAG, "skipping notification that lacks a context");
return null; return null;
} }
return validatePeople(context, record); return validatePeople(context, record);
@@ -220,7 +220,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
return null; return null;
} }
if (INFO) Slog.i(TAG, "Validating: " + key + " for " + context.getUserId()); if (VERBOSE) Slog.i(TAG, "Validating: " + key + " for " + context.getUserId());
final LinkedList<String> pendingLookups = new LinkedList<String>(); final LinkedList<String> pendingLookups = new LinkedList<String>();
for (int personIdx = 0; personIdx < people.length && personIdx < MAX_PEOPLE; personIdx++) { for (int personIdx = 0; personIdx < people.length && personIdx < MAX_PEOPLE; personIdx++) {
final String handle = people[personIdx]; final String handle = people[personIdx];
@@ -244,7 +244,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
affinityOut[0] = affinity; affinityOut[0] = affinity;
if (pendingLookups.isEmpty()) { if (pendingLookups.isEmpty()) {
if (INFO) Slog.i(TAG, "final affinity: " + affinity); if (VERBOSE) Slog.i(TAG, "final affinity: " + affinity);
if (affinity != NONE) MetricsLogger.count(mBaseContext, "note_with_people", 1); if (affinity != NONE) MetricsLogger.count(mBaseContext, "note_with_people", 1);
return null; return null;
} }
@@ -422,7 +422,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
@Override @Override
public void work() { public void work() {
if (INFO) Slog.i(TAG, "Executing: validation for: " + mKey); if (VERBOSE) Slog.i(TAG, "Executing: validation for: " + mKey);
long timeStartMs = System.currentTimeMillis(); long timeStartMs = System.currentTimeMillis();
for (final String handle: mPendingLookups) { for (final String handle: mPendingLookups) {
LookupResult lookupResult = null; LookupResult lookupResult = null;
@@ -463,7 +463,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
public void applyChangesLocked(NotificationRecord operand) { public void applyChangesLocked(NotificationRecord operand) {
float affinityBound = operand.getContactAffinity(); float affinityBound = operand.getContactAffinity();
operand.setContactAffinity(Math.max(mContactAffinity, affinityBound)); operand.setContactAffinity(Math.max(mContactAffinity, affinityBound));
if (INFO) Slog.i(TAG, "final affinity: " + operand.getContactAffinity()); if (VERBOSE) Slog.i(TAG, "final affinity: " + operand.getContactAffinity());
} }
public float getContactAffinity() { public float getContactAffinity() {