Add isLoggable checks to all verbose and debug log outputs (1/2)
Bug: 6813854
Test: built apk and verified log is seen in logcat
Change-Id: Ib17cac0d2d9553276c4271221110305ab2d70a46
diff --git a/src/com/android/contacts/ContactPhotoManager.java b/src/com/android/contacts/ContactPhotoManager.java
index b43af19..fdcc9b3 100644
--- a/src/com/android/contacts/ContactPhotoManager.java
+++ b/src/com/android/contacts/ContactPhotoManager.java
@@ -1425,8 +1425,10 @@
mPreloadStatus = PRELOAD_STATUS_DONE;
}
- Log.v(TAG, "Preloaded " + count + " photos. Cached bytes: "
- + mBitmapHolderCache.size());
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Preloaded " + count + " photos. Cached bytes: "
+ + mBitmapHolderCache.size());
+ }
requestPreloading();
}
@@ -1609,11 +1611,15 @@
uriRequest.getRequestedExtent());
mMainThreadHandler.sendEmptyMessage(MESSAGE_PHOTOS_LOADED);
} else {
- Log.v(TAG, "Cannot load photo " + uri);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Cannot load photo " + uri);
+ }
cacheBitmap(originalUri, null, false, uriRequest.getRequestedExtent());
}
} catch (final Exception | OutOfMemoryError ex) {
- Log.v(TAG, "Cannot load photo " + uri, ex);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Cannot load photo " + uri, ex);
+ }
cacheBitmap(originalUri, null, false, uriRequest.getRequestedExtent());
}
}
diff --git a/src/com/android/contacts/ContactSaveService.java b/src/com/android/contacts/ContactSaveService.java
index e05f7c6..4e2d178 100755
--- a/src/com/android/contacts/ContactSaveService.java
+++ b/src/com/android/contacts/ContactSaveService.java
@@ -304,7 +304,9 @@
@Override
protected void onHandleIntent(final Intent intent) {
if (intent == null) {
- Log.d(TAG, "onHandleIntent: could not handle null intent");
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onHandleIntent: could not handle null intent");
+ }
return;
}
if (!PermissionsUtil.hasPermission(this, WRITE_CONTACTS)) {
@@ -578,7 +580,7 @@
rawContactId);
lookupUri = RawContacts.getContactLookupUri(resolver, rawContactUri);
}
- if (lookupUri != null) {
+ if (lookupUri != null && Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Saved contact. New URI: " + lookupUri);
}
diff --git a/src/com/android/contacts/activities/AttachPhotoActivity.java b/src/com/android/contacts/activities/AttachPhotoActivity.java
index bde3dc1..b25c306 100644
--- a/src/com/android/contacts/activities/AttachPhotoActivity.java
+++ b/src/com/android/contacts/activities/AttachPhotoActivity.java
@@ -337,7 +337,9 @@
values.setPhoto(compressed);
// Finally, invoke the ContactSaveService.
- Log.v(TAG, "all prerequisites met, about to save photo to contact");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "all prerequisites met, about to save photo to contact");
+ }
Intent intent = ContactSaveService.createSaveContactIntent(
this,
deltaList,
diff --git a/src/com/android/contacts/compat/CompatUtils.java b/src/com/android/contacts/compat/CompatUtils.java
index 30ad9b8..10b627b 100644
--- a/src/com/android/contacts/compat/CompatUtils.java
+++ b/src/com/android/contacts/compat/CompatUtils.java
@@ -227,7 +227,9 @@
Class.forName(className).getMethod(methodName, parameterTypes);
return true;
} catch (ClassNotFoundException | NoSuchMethodException e) {
- Log.v(TAG, "Could not find method: " + className + "#" + methodName);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Could not find method: " + className + "#" + methodName);
+ }
return false;
} catch (Throwable t) {
Log.e(TAG, "Unexpected exception when checking if method: " + className + "#"
@@ -260,7 +262,9 @@
.invoke(instance, parameters);
} catch (ClassNotFoundException | NoSuchMethodException | IllegalArgumentException
| IllegalAccessException | InvocationTargetException e) {
- Log.v(TAG, "Could not invoke method: " + className + "#" + methodName);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Could not invoke method: " + className + "#" + methodName);
+ }
return null;
} catch (Throwable t) {
Log.e(TAG, "Unexpected exception when invoking method: " + className
diff --git a/src/com/android/contacts/detail/ContactDisplayUtils.java b/src/com/android/contacts/detail/ContactDisplayUtils.java
index 6803e9d..ef9124a 100644
--- a/src/com/android/contacts/detail/ContactDisplayUtils.java
+++ b/src/com/android/contacts/detail/ContactDisplayUtils.java
@@ -255,11 +255,15 @@
try {
uri = Uri.parse(source);
} catch (Throwable e) {
- Log.d(TAG, "Could not parse image source: " + source);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Could not parse image source: " + source);
+ }
return null;
}
if (!RES_SCHEME.equals(uri.getScheme())) {
- Log.d(TAG, "Image source does not correspond to a resource: " + source);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Image source does not correspond to a resource: " + source);
+ }
return null;
}
// The URI authority represents the package name.
@@ -267,13 +271,17 @@
Resources resources = getResourcesForResourceName(packageName);
if (resources == null) {
- Log.d(TAG, "Could not parse image source: " + source);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Could not parse image source: " + source);
+ }
return null;
}
List<String> pathSegments = uri.getPathSegments();
if (pathSegments.size() != 1) {
- Log.d(TAG, "Could not parse image source: " + source);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Could not parse image source: " + source);
+ }
return null;
}
@@ -282,14 +290,18 @@
if (resId == 0) {
// Use the default image icon in this case.
- Log.d(TAG, "Cannot resolve resource identifier: " + source);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Cannot resolve resource identifier: " + source);
+ }
return null;
}
try {
return getResourceDrawable(resources, resId);
} catch (NotFoundException e) {
- Log.d(TAG, "Resource not found: " + source, e);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Resource not found: " + source, e);
+ }
return null;
}
}
@@ -307,7 +319,9 @@
try {
return mPackageManager.getResourcesForApplication(packageName);
} catch (NameNotFoundException e) {
- Log.d(TAG, "Could not find package: " + packageName);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Could not find package: " + packageName);
+ }
return null;
}
}
diff --git a/src/com/android/contacts/detail/PhotoSelectionHandler.java b/src/com/android/contacts/detail/PhotoSelectionHandler.java
index 3053714..053ee22 100644
--- a/src/com/android/contacts/detail/PhotoSelectionHandler.java
+++ b/src/com/android/contacts/detail/PhotoSelectionHandler.java
@@ -168,7 +168,9 @@
return false;
}
} catch (SecurityException e) {
- Log.d(TAG, "Did not have read-access to uri : " + uri);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Did not have read-access to uri : " + uri);
+ }
return false;
}
}
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index afe231e..da68ec6 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -389,7 +389,10 @@
@Override
public void onLoadFinished(Loader<Contact> loader, Contact contact) {
final long loaderCurrentTime = SystemClock.elapsedRealtime();
- Log.v(TAG, "Time needed for loading: " + (loaderCurrentTime-mLoaderStartTime));
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG,
+ "Time needed for loading: " + (loaderCurrentTime-mLoaderStartTime));
+ }
if (!contact.isLoaded()) {
// Item has been deleted. Close activity without saving again.
Log.i(TAG, "No contact found. Closing activity");
@@ -403,8 +406,10 @@
final long setDataStartTime = SystemClock.elapsedRealtime();
setState(contact);
final long setDataEndTime = SystemClock.elapsedRealtime();
-
- Log.v(TAG, "Time needed for setting UI: " + (setDataEndTime - setDataStartTime));
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Time needed for setting UI: "
+ + (setDataEndTime - setDataStartTime));
+ }
}
@Override
@@ -1048,7 +1053,9 @@
private void setState(Contact contact) {
// If we have already loaded data, we do not want to change it here to not confuse the user
if (!mState.isEmpty()) {
- Log.v(TAG, "Ignoring background change. This will have to be rebased later");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Ignoring background change. This will have to be rebased later");
+ }
return;
}
mContact = contact;
@@ -1480,7 +1487,7 @@
mStatus = Status.CLOSING;
if (mListener != null) {
mListener.onContactSplit(contactLookupUri);
- } else {
+ } else if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "No listener registered, can not call onSplitFinished");
}
break;
diff --git a/src/com/android/contacts/editor/RawContactEditorView.java b/src/com/android/contacts/editor/RawContactEditorView.java
index 320a19a..7c61f64 100644
--- a/src/com/android/contacts/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/editor/RawContactEditorView.java
@@ -452,7 +452,9 @@
mPrimaryAccount = ContactEditorUtils.create(getContext())
.getOnlyOrDefaultAccount(AccountInfo.extractAccounts(mAccounts));
}
- vlog("state: primary " + mPrimaryAccount);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "state: primary " + mPrimaryAccount);
+ }
// Parse the given raw contact deltas
if (rawContactDeltas == null || rawContactDeltas.isEmpty()) {
@@ -531,10 +533,14 @@
}
private void pickRawContactDelta() {
- vlog("parse: " + mRawContactDeltas.size() + " rawContactDelta(s)");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "parse: " + mRawContactDeltas.size() + " rawContactDelta(s)");
+ }
for (int j = 0; j < mRawContactDeltas.size(); j++) {
final RawContactDelta rawContactDelta = mRawContactDeltas.get(j);
- vlog("parse: " + j + " rawContactDelta" + rawContactDelta);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "parse: " + j + " rawContactDelta" + rawContactDelta);
+ }
if (rawContactDelta == null || !rawContactDelta.isVisible()) continue;
final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
@@ -577,15 +583,19 @@
final AccountType accountType = mCurrentRawContactDelta.getAccountType(mAccountTypeManager);
final List<DataKind> dataKinds = accountType.getSortedDataKinds();
final int dataKindSize = dataKinds == null ? 0 : dataKinds.size();
- vlog("parse: " + dataKindSize + " dataKinds(s)");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "parse: " + dataKindSize + " dataKinds(s)");
+ }
for (int i = 0; i < dataKindSize; i++) {
final DataKind dataKind = dataKinds.get(i);
// Skip null and un-editable fields.
if (dataKind == null || !dataKind.editable) {
- vlog("parse: " + i +
- (dataKind == null ? " dropped null data kind"
- : " dropped uneditable mimetype: " + dataKind.mimeType));
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "parse: " + i +
+ (dataKind == null ? " dropped null data kind"
+ : " dropped uneditable mimetype: " + dataKind.mimeType));
+ }
continue;
}
final String mimeType = dataKind.mimeType;
@@ -593,14 +603,18 @@
// Skip psuedo mime types
if (DataKind.PSEUDO_MIME_TYPE_NAME.equals(mimeType) ||
DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME.equals(mimeType)) {
- vlog("parse: " + i + " " + dataKind.mimeType + " dropped pseudo type");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "parse: " + i + " " + dataKind.mimeType + " dropped pseudo type");
+ }
continue;
}
// Skip custom fields
// TODO: Handle them when we implement editing custom fields.
if (CustomDataItem.MIMETYPE_CUSTOM_FIELD.equals(mimeType)) {
- vlog("parse: " + i + " " + dataKind.mimeType + " dropped custom field");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "parse: " + i + " " + dataKind.mimeType + " dropped custom field");
+ }
continue;
}
@@ -609,11 +623,13 @@
mKindSectionDataMap.put(mimeType, kindSectionData);
mSortedMimetypes.add(mimeType);
- vlog("parse: " + i + " " + dataKind.mimeType + " " +
- kindSectionData.getValuesDeltas().size() + " value(s) " +
- kindSectionData.getNonEmptyValuesDeltas().size() + " non-empty value(s) " +
- kindSectionData.getVisibleValuesDeltas().size() +
- " visible value(s)");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "parse: " + i + " " + dataKind.mimeType + " " +
+ kindSectionData.getValuesDeltas().size() + " value(s) " +
+ kindSectionData.getNonEmptyValuesDeltas().size() + " non-empty value(s) " +
+ kindSectionData.getVisibleValuesDeltas().size() +
+ " visible value(s)");
+ }
}
}
@@ -854,7 +870,9 @@
i++;
// Ignore mime types that we've already handled
if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) {
- vlog("kind: " + i + " " + mimeType + " dropped");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "kind: " + i + " " + mimeType + " dropped");
+ }
continue;
}
final KindSectionView kindSectionView;
@@ -913,12 +931,6 @@
return false;
}
- private static void vlog(String message) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.v(TAG, message);
- }
- }
-
private static void wlog(String message) {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, message);
diff --git a/src/com/android/contacts/extensions/ExtensionsFactory.java b/src/com/android/contacts/extensions/ExtensionsFactory.java
index 33f9510..3b0ddb1 100644
--- a/src/com/android/contacts/extensions/ExtensionsFactory.java
+++ b/src/com/android/contacts/extensions/ExtensionsFactory.java
@@ -57,14 +57,20 @@
if (className != null) {
mExtendedPhoneDirectoriesManager = createInstance(className);
} else {
- Log.d(TAG, EXTENDED_PHONE_DIRECTORIES_KEY + " not found in properties file.");
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, EXTENDED_PHONE_DIRECTORIES_KEY + " not found in properties file.");
+ }
}
} catch (FileNotFoundException e) {
// No custom extensions. Ignore.
- Log.d(TAG, "No custom extensions.");
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "No custom extensions.");
+ }
} catch (IOException e) {
- Log.d(TAG, e.toString());
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, e.toString());
+ }
}
}
diff --git a/src/com/android/contacts/interactions/CalendarInteractionsLoader.java b/src/com/android/contacts/interactions/CalendarInteractionsLoader.java
index bc102e5..ec723a5 100644
--- a/src/com/android/contacts/interactions/CalendarInteractionsLoader.java
+++ b/src/com/android/contacts/interactions/CalendarInteractionsLoader.java
@@ -73,7 +73,9 @@
allInteractions.addAll(interactions);
allInteractions.addAll(interactions2);
- Log.v(TAG, "# ContactInteraction Loaded: " + allInteractions.size());
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "# ContactInteraction Loaded: " + allInteractions.size());
+ }
return allInteractions;
}
diff --git a/src/com/android/contacts/interactions/SmsInteractionsLoader.java b/src/com/android/contacts/interactions/SmsInteractionsLoader.java
index 1de7ca3..31ab831 100644
--- a/src/com/android/contacts/interactions/SmsInteractionsLoader.java
+++ b/src/com/android/contacts/interactions/SmsInteractionsLoader.java
@@ -51,14 +51,18 @@
public SmsInteractionsLoader(Context context, String[] phoneNums,
int maxToRetrieve) {
super(context);
- Log.v(TAG, "SmsInteractionsLoader");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "SmsInteractionsLoader");
+ }
mPhoneNums = phoneNums;
mMaxToRetrieve = maxToRetrieve;
}
@Override
public List<ContactInteraction> loadInBackground() {
- Log.v(TAG, "loadInBackground");
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "loadInBackground");
+ }
// Confirm the device has Telephony and numbers were provided before proceeding
if (!getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
|| mPhoneNums == null || mPhoneNums.length == 0) {
diff --git a/src/com/android/contacts/list/ContactBrowseListFragment.java b/src/com/android/contacts/list/ContactBrowseListFragment.java
index 8a6e081..dcef568 100644
--- a/src/com/android/contacts/list/ContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/ContactBrowseListFragment.java
@@ -199,7 +199,7 @@
return;
}
- Log.v(TAG, "New filter: " + filter);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "New filter: " + filter);
setListType(filter.toListType());
setLogListEvents(true);
diff --git a/src/com/android/contacts/model/RawContactDelta.java b/src/com/android/contacts/model/RawContactDelta.java
index b7d0665..6ee31ba 100644
--- a/src/com/android/contacts/model/RawContactDelta.java
+++ b/src/com/android/contacts/model/RawContactDelta.java
@@ -56,7 +56,7 @@
// TODO: optimize by using contentvalues pool, since we allocate so many of them
private static final String TAG = "EntityDelta";
- private static final boolean LOGV = false;
+ private static final boolean DEBUG = false;
/**
* Direct values from {@link Entity#getEntityValues()}.
@@ -110,7 +110,7 @@
// Create local version if none exists yet
if (local == null) local = new RawContactDelta();
- if (LOGV) {
+ if (DEBUG) {
final Long localVersion = (local.mValues == null) ? null : local.mValues
.getAsLong(RawContacts.VERSION);
final Long remoteVersion = remote.mValues.getAsLong(RawContacts.VERSION);
diff --git a/src/com/android/contacts/model/RawContactDeltaList.java b/src/com/android/contacts/model/RawContactDeltaList.java
index de007d2..2fe475a 100644
--- a/src/com/android/contacts/model/RawContactDeltaList.java
+++ b/src/com/android/contacts/model/RawContactDeltaList.java
@@ -120,99 +120,11 @@
}
/**
- * Build a list of {@link ContentProviderOperation} that will transform all
+ * Build a list of {@link CPOWrapper} that will transform all
* the "before" {@link Entity} states into the modified state which all
* {@link RawContactDelta} objects represent. This method specifically creates
* any {@link AggregationExceptions} rules needed to groups edits together.
*/
- public ArrayList<ContentProviderOperation> buildDiff() {
- if (VERBOSE_LOGGING) {
- Log.v(TAG, "buildDiff: list=" + toString());
- }
- final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
-
- final long rawContactId = this.findRawContactId();
- int firstInsertRow = -1;
-
- // First pass enforces versions remain consistent
- for (RawContactDelta delta : this) {
- delta.buildAssert(diff);
- }
-
- final int assertMark = diff.size();
- int backRefs[] = new int[size()];
-
- int rawContactIndex = 0;
-
- // Second pass builds actual operations
- for (RawContactDelta delta : this) {
- final int firstBatch = diff.size();
- final boolean isInsert = delta.isContactInsert();
- backRefs[rawContactIndex++] = isInsert ? firstBatch : -1;
-
- delta.buildDiff(diff);
-
- // If the user chose to join with some other existing raw contact(s) at save time,
- // add aggregation exceptions for all those raw contacts.
- if (mJoinWithRawContactIds != null) {
- for (Long joinedRawContactId : mJoinWithRawContactIds) {
- final Builder builder = beginKeepTogether();
- builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, joinedRawContactId);
- if (rawContactId != -1) {
- builder.withValue(AggregationExceptions.RAW_CONTACT_ID2, rawContactId);
- } else {
- builder.withValueBackReference(
- AggregationExceptions.RAW_CONTACT_ID2, firstBatch);
- }
- diff.add(builder.build());
- }
- }
-
- // Only create rules for inserts
- if (!isInsert) continue;
-
- // If we are going to split all contacts, there is no point in first combining them
- if (mSplitRawContacts) continue;
-
- if (rawContactId != -1) {
- // Has existing contact, so bind to it strongly
- final Builder builder = beginKeepTogether();
- builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, rawContactId);
- builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, firstBatch);
- diff.add(builder.build());
-
- } else if (firstInsertRow == -1) {
- // First insert case, so record row
- firstInsertRow = firstBatch;
-
- } else {
- // Additional insert case, so point at first insert
- final Builder builder = beginKeepTogether();
- builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID1,
- firstInsertRow);
- builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, firstBatch);
- diff.add(builder.build());
- }
- }
-
- if (mSplitRawContacts) {
- buildSplitContactDiff(diff, backRefs);
- }
-
- // No real changes if only left with asserts
- if (diff.size() == assertMark) {
- diff.clear();
- }
- if (VERBOSE_LOGGING) {
- Log.v(TAG, "buildDiff: ops=" + diffToString(diff));
- }
- return diff;
- }
-
- /**
- * For compatibility purpose, this method is copied from {@link #buildDiff} and returns an
- * ArrayList of CPOWrapper.
- */
public ArrayList<CPOWrapper> buildDiffWrapper() {
if (VERBOSE_LOGGING) {
Log.v(TAG, "buildDiffWrapper: list=" + toString());
@@ -334,26 +246,6 @@
* Builds {@link AggregationExceptions} to split all constituent raw contacts into
* separate contacts.
*/
- private void buildSplitContactDiff(final ArrayList<ContentProviderOperation> diff,
- int[] backRefs) {
- final int count = size();
- for (int i = 0; i < count; i++) {
- for (int j = 0; j < count; j++) {
- if (i == j) {
- continue;
- }
- final Builder builder = buildSplitContactDiffHelper(i, j, backRefs);
- if (builder != null) {
- diff.add(builder.build());
- }
- }
- }
- }
-
- /**
- * For compatibility purpose, this method is copied from {@link #buildSplitContactDiff} and
- * takes an ArrayList of CPOWrapper as parameter.
- */
private void buildSplitContactDiffWrapper(final ArrayList<CPOWrapper> diff, int[] backRefs) {
final int count = size();
for (int i = 0; i < count; i++) {
diff --git a/src/com/android/contacts/model/account/AccountTypeProvider.java b/src/com/android/contacts/model/account/AccountTypeProvider.java
index ba2788a..38d8ca6 100644
--- a/src/com/android/contacts/model/account/AccountTypeProvider.java
+++ b/src/com/android/contacts/model/account/AccountTypeProvider.java
@@ -172,8 +172,10 @@
&& isLocalAccountType(mLocalAccountTypeFactory, type)) {
accountType = mLocalAccountTypeFactory.getAccountType(type);
} else {
- Log.d(TAG, "Registering external account type=" + type
- + ", packageName=" + auth.packageName);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Registering external account type=" + type
+ + ", packageName=" + auth.packageName);
+ }
accountType = new ExternalAccountType(mContext, auth.packageName, false);
}
if (!accountType.isInitialized()) {
@@ -215,9 +217,11 @@
" doesn't match expected type " + type);
continue;
}
- Log.d(TAG, "Registering extension package account type="
- + accountType.accountType + ", dataSet=" + accountType.dataSet
- + ", packageName=" + extensionPackage);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Registering extension package account type="
+ + accountType.accountType + ", dataSet=" + accountType.dataSet
+ + ", packageName=" + extensionPackage);
+ }
result.add(extensionType);
}
diff --git a/src/com/android/contacts/quickcontact/WebAddress.java b/src/com/android/contacts/quickcontact/WebAddress.java
index ab581c2..1b6ca19 100644
--- a/src/com/android/contacts/quickcontact/WebAddress.java
+++ b/src/com/android/contacts/quickcontact/WebAddress.java
@@ -67,8 +67,6 @@
throw new NullPointerException();
}
- // android.util.Log.d(LOGTAG, "WebAddress: " + address);
-
mScheme = "";
mHost = "";
mPort = -1;
diff --git a/src/com/android/contacts/util/ContactPhotoUtils.java b/src/com/android/contacts/util/ContactPhotoUtils.java
index b351bb8..943f5dd 100644
--- a/src/com/android/contacts/util/ContactPhotoUtils.java
+++ b/src/com/android/contacts/util/ContactPhotoUtils.java
@@ -162,7 +162,9 @@
outputStream.write(buffer, 0, length);
totalLength += length;
}
- Log.v(TAG, "Wrote " + totalLength + " bytes for photo " + inputUri.toString());
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Wrote " + totalLength + " bytes for photo " + inputUri.toString());
+ }
} catch (IOException | NullPointerException e) {
Log.e(TAG, "Failed to write photo: " + inputUri.toString() + " because: " + e);
return false;
diff --git a/src/com/android/contacts/util/StopWatch.java b/src/com/android/contacts/util/StopWatch.java
index c53f346..4300eff 100644
--- a/src/com/android/contacts/util/StopWatch.java
+++ b/src/com/android/contacts/util/StopWatch.java
@@ -80,7 +80,7 @@
sb.append(" ");
last = current;
}
- Log.v(TAG, sb.toString());
+ if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, sb.toString());
}
/**