Fixed some logs verbosity

This commit is contained in:
Sylvain Berfini 2019-07-01 15:28:41 +02:00
parent 0f3061c928
commit 5fd28edb36
2 changed files with 26 additions and 25 deletions

View file

@ -209,26 +209,24 @@ class AndroidContact implements Serializable {
}
void updateNativeContactWithPresenceInfo(String value) {
if (!isLinphoneAddressMimeEntryAlreadyExisting(value)) {
Log.d("[Contact] Adding presence information " + value);
addChangesToCommit(
ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValue(ContactsContract.Data.RAW_CONTACT_ID, mAndroidRawId)
.withValue(
ContactsContract.Data.MIMETYPE,
ContactsManager.getInstance()
.getString(R.string.linphone_address_mime_type))
.withValue("data1", value) // phone number
.withValue(
"data2",
ContactsManager.getInstance()
.getString(R.string.app_name)) // Summary
.withValue("data3", value) // Detail
.build());
}
Log.d("[Contact] Adding presence information " + value);
addChangesToCommit(
ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValue(ContactsContract.Data.RAW_CONTACT_ID, mAndroidRawId)
.withValue(
ContactsContract.Data.MIMETYPE,
ContactsManager.getInstance()
.getString(R.string.linphone_address_mime_type))
.withValue("data1", value) // phone number
.withValue(
"data2",
ContactsManager.getInstance()
.getString(R.string.app_name)) // Summary
.withValue("data3", value) // Detail
.build());
}
private boolean isLinphoneAddressMimeEntryAlreadyExisting(String value) {
boolean isLinphoneAddressMimeEntryAlreadyExisting(String value) {
boolean result = false;
ContentResolver resolver = LinphoneService.instance().getContentResolver();
@ -603,17 +601,17 @@ class AndroidContact implements Serializable {
if (LinphoneService.instance().getResources().getBoolean(R.bool.use_linphone_tag)) {
if (mAndroidId != null && (mAndroidRawId == null || !isAndroidRawIdLinphone)) {
if (mAndroidRawId == null) {
Log.i("[Contact] RAW ID not found for contact " + mAndroidId);
Log.d("[Contact] RAW ID not found for contact " + mAndroidId);
mAndroidRawId = findRawContactID();
}
Log.i("[Contact] Found RAW ID for contact " + mAndroidId + " : " + mAndroidRawId);
Log.d("[Contact] Found RAW ID for contact " + mAndroidId + " : " + mAndroidRawId);
String linphoneRawId = findLinphoneRawContactId();
if (linphoneRawId == null) {
Log.i("[Contact] Linphone RAW ID not found for contact " + mAndroidId);
Log.d("[Contact] Linphone RAW ID not found for contact " + mAndroidId);
createRawLinphoneContactFromExistingAndroidContact();
} else {
Log.i(
Log.d(
"[Contact] Linphone RAW ID found for contact "
+ mAndroidId
+ " : "

View file

@ -559,12 +559,13 @@ public class LinphoneContact extends AndroidContact
Log.d("[Linphone Contact] Found first name " + data2 + " and last name " + data3);
setFirstNameAndLastName(data2, data3, false);
} else {
Log.w("[Linphone Contact] Unexpected MIME type " + mime);
Log.d("[Linphone Contact] Skipping unused MIME type " + mime);
}
}
public synchronized void updateNativeContactWithPresenceInfo() {
Log.d("[Contact] Trying to update native contact with presence information");
// Creation of the raw contact with the presence information (tablet)
createRawLinphoneContactFromExistingAndroidContactIfNeeded();
@ -583,8 +584,10 @@ public class LinphoneContact extends AndroidContact
// If presence is not null
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
Log.d("[Contact] Found presence information for phone number " + value);
// Do the action on the contact only once if it has not been done yet
updateNativeContactWithPresenceInfo(value);
if (!isLinphoneAddressMimeEntryAlreadyExisting(value)) {
// Do the action on the contact only once if it has not been done yet
updateNativeContactWithPresenceInfo(value);
}
}
}
saveChangesCommited();