diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-03 23:18:35 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-03 23:18:35 +0000 |
commit | 2034759538273aed8a0b412d8fb90994eba1f7ea (patch) | |
tree | 1a45d60921e293c6088efeaf4d9c408456f3e0e2 /java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java | |
parent | 86baedee44a4902097310c689ee3ae7f0cdb1c8d (diff) | |
parent | d67f1627521b174f12e0c247f154c7c93c5e408e (diff) |
This change reflects the Dialer V10 RC00 branch. am: 8369df095a
am: d67f162752
Change-Id: I94f923a6a8af0a580723017002922e299bd335f3
Diffstat (limited to 'java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java')
-rw-r--r-- | java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java index 83a3960dd..af934dd3c 100644 --- a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java +++ b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java @@ -24,8 +24,7 @@ import android.support.v4.os.BuildCompat; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import android.util.ArrayMap; -import com.android.dialer.logging.Logger; -import com.android.dialer.logging.nano.DialerImpression; +import com.android.dialer.logging.DialerImpression; import com.android.voicemail.VoicemailComponent; import com.android.voicemail.impl.ActivationTask; import com.android.voicemail.impl.Assert; @@ -41,6 +40,7 @@ import com.android.voicemail.impl.scheduling.BaseTask; import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil; import com.android.voicemail.impl.sync.VvmNetworkRequest.NetworkWrapper; import com.android.voicemail.impl.sync.VvmNetworkRequest.RequestFailedException; +import com.android.voicemail.impl.utils.LoggerUtils; import com.android.voicemail.impl.utils.VoicemailDatabaseUtil; import java.util.List; import java.util.Map; @@ -98,7 +98,7 @@ public class OmtpVvmSyncService { } OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(mContext, phoneAccount); - Logger.get(mContext).logImpression(DialerImpression.Type.VVM_SYNC_STARTED); + LoggerUtils.logImpressionOnMainThread(mContext, DialerImpression.Type.VVM_SYNC_STARTED); // DATA_IMAP_OPERATION_STARTED posting should not be deferred. This event clears all data // channel errors, which should happen when the task starts, not when it ends. It is the // "Sync in progress..." status. @@ -136,7 +136,7 @@ public class OmtpVvmSyncService { imapHelper.updateQuota(); autoDeleteAndArchiveVM(imapHelper, phoneAccount); imapHelper.handleEvent(OmtpEvents.DATA_IMAP_OPERATION_COMPLETED); - Logger.get(mContext).logImpression(DialerImpression.Type.VVM_SYNC_COMPLETED); + LoggerUtils.logImpressionOnMainThread(mContext, DialerImpression.Type.VVM_SYNC_COMPLETED); } else { task.fail(); } @@ -158,14 +158,15 @@ public class OmtpVvmSyncService { > AUTO_DELETE_ARCHIVE_VM_THRESHOLD) { deleteAndArchiveVM(imapHelper); imapHelper.updateQuota(); - Logger.get(mContext) - .logImpression(DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETED_VM_FROM_SERVER); + LoggerUtils.logImpressionOnMainThread( + mContext, DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETED_VM_FROM_SERVER); } else { VvmLog.i(TAG, "no need to archive and auto delete VM, quota below threshold"); } } else { - VvmLog.i(TAG, "isArchiveAllowedAndEnabled is false"); - Logger.get(mContext).logImpression(DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETE_TURNED_OFF); + VvmLog.i(TAG, "autoDeleteAndArchiveVM is turned off"); + LoggerUtils.logImpressionOnMainThread( + mContext, DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETE_TURNED_OFF); } } @@ -214,7 +215,7 @@ public class OmtpVvmSyncService { boolean downloadSuccess = true; if (SYNC_FULL_SYNC.equals(action) || SYNC_UPLOAD_ONLY.equals(action)) { - uploadSuccess = upload(imapHelper); + uploadSuccess = upload(account, imapHelper); } if (SYNC_FULL_SYNC.equals(action) || SYNC_DOWNLOAD_ONLY.equals(action)) { downloadSuccess = download(imapHelper, account); @@ -242,9 +243,9 @@ public class OmtpVvmSyncService { new TranscriptionFetchedCallback(mContext, voicemail), voicemail.getSourceData()); } - private boolean upload(ImapHelper imapHelper) { - List<Voicemail> readVoicemails = mQueryHelper.getReadVoicemails(); - List<Voicemail> deletedVoicemails = mQueryHelper.getDeletedVoicemails(); + private boolean upload(PhoneAccountHandle phoneAccountHandle, ImapHelper imapHelper) { + List<Voicemail> readVoicemails = mQueryHelper.getReadVoicemails(phoneAccountHandle); + List<Voicemail> deletedVoicemails = mQueryHelper.getDeletedVoicemails(phoneAccountHandle); boolean success = true; @@ -271,7 +272,7 @@ public class OmtpVvmSyncService { private boolean download(ImapHelper imapHelper, PhoneAccountHandle account) { List<Voicemail> serverVoicemails = imapHelper.fetchAllVoicemails(); - List<Voicemail> localVoicemails = mQueryHelper.getAllVoicemails(); + List<Voicemail> localVoicemails = mQueryHelper.getAllVoicemails(account); if (localVoicemails == null || serverVoicemails == null) { // Null value means the query failed. @@ -302,7 +303,8 @@ public class OmtpVvmSyncService { if (!TextUtils.isEmpty(remoteVoicemail.getTranscription()) && TextUtils.isEmpty(localVoicemail.getTranscription())) { - Logger.get(mContext).logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_DOWNLOADED); + LoggerUtils.logImpressionOnMainThread( + mContext, DialerImpression.Type.VVM_TRANSCRIPTION_DOWNLOADED); mQueryHelper.updateWithTranscription(localVoicemail, remoteVoicemail.getTranscription()); } } @@ -312,7 +314,8 @@ public class OmtpVvmSyncService { boolean prefetchEnabled = shouldPerformPrefetch(account, imapHelper); for (Voicemail remoteVoicemail : remoteMap.values()) { if (!TextUtils.isEmpty(remoteVoicemail.getTranscription())) { - Logger.get(mContext).logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_DOWNLOADED); + LoggerUtils.logImpressionOnMainThread( + mContext, DialerImpression.Type.VVM_TRANSCRIPTION_DOWNLOADED); } Uri uri = VoicemailDatabaseUtil.insert(mContext, remoteVoicemail); if (prefetchEnabled) { |