diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/logging/dialer_impression.proto | 10 | ||||
-rw-r--r-- | java/com/android/voicemail/impl/transcribe/TranscriptionTask.java | 15 |
2 files changed, 24 insertions, 1 deletions
diff --git a/java/com/android/dialer/logging/dialer_impression.proto b/java/com/android/dialer/logging/dialer_impression.proto index cda4bd19c..bc35900af 100644 --- a/java/com/android/dialer/logging/dialer_impression.proto +++ b/java/com/android/dialer/logging/dialer_impression.proto @@ -12,7 +12,6 @@ message DialerImpression { // Event enums to be used for Impression Logging in Dialer. // It's perfectly acceptable for this enum to be large // Values should be from 1000 to 100000. - // Next Tag:1229 enum Type { UNKNOWN_AOSP_EVENT_TYPE = 1000; @@ -466,5 +465,14 @@ message DialerImpression { // Impressions for dialer reporting caller id as inaccurate CALLER_ID_REPORTED = 1227; CALLER_ID_REPORT_FAILED = 1228; + + // Impressions for interactions with the voicemail transcription server + VVM_TRANSCRIPTION_REQUEST_SENT = 1229; + VVM_TRANSCRIPTION_REQUEST_RETRY = 1230; + VVM_TRANSCRIPTION_RESPONSE_SUCCESS = 1231; + VVM_TRANSCRIPTION_RESPONSE_EMPTY = 1232; + VVM_TRANSCRIPTION_RESPONSE_INVALID = 1233; + VVM_TRANSCRIPTION_RESPONSE_RECOVERABLE_ERROR = 1234; + VVM_TRANSCRIPTION_RESPONSE_FATAL_ERROR = 1235; } } diff --git a/java/com/android/voicemail/impl/transcribe/TranscriptionTask.java b/java/com/android/voicemail/impl/transcribe/TranscriptionTask.java index 0fbc33ad5..a14b6df91 100644 --- a/java/com/android/voicemail/impl/transcribe/TranscriptionTask.java +++ b/java/com/android/voicemail/impl/transcribe/TranscriptionTask.java @@ -21,6 +21,8 @@ import android.content.Context; import android.net.Uri; import android.text.TextUtils; import com.android.dialer.common.concurrent.ThreadUtil; +import com.android.dialer.logging.DialerImpression; +import com.android.dialer.logging.Logger; import com.android.voicemail.impl.VvmLog; import com.android.voicemail.impl.transcribe.TranscriptionService.JobCallback; import com.android.voicemail.impl.transcribe.grpc.TranscriptionClient; @@ -98,24 +100,37 @@ public class TranscriptionTask implements Runnable { String transcript = null; for (int i = 0; transcript == null && i < MAX_RETRIES; i++) { VvmLog.i(TAG, "transcribeVoicemail, try: " + (i + 1)); + if (i == 0) { + Logger.get(context).logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_REQUEST_SENT); + } else { + Logger.get(context).logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_REQUEST_RETRY); + } TranscriptionClient.TranscriptionResponseWrapper responseWrapper = client.transcribeVoicemail(request); if (responseWrapper.status != null) { VvmLog.i(TAG, "transcribeVoicemail, status: " + responseWrapper.status.getCode()); if (shouldRetryRequest(responseWrapper.status)) { + Logger.get(context) + .logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_RESPONSE_RECOVERABLE_ERROR); backoff(i); } else { + Logger.get(context) + .logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_RESPONSE_FATAL_ERROR); break; } } else if (responseWrapper.response != null) { if (!TextUtils.isEmpty(responseWrapper.response.getTranscript())) { VvmLog.i(TAG, "transcribeVoicemail, got response"); transcript = responseWrapper.response.getTranscript(); + Logger.get(context) + .logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_RESPONSE_SUCCESS); } else { VvmLog.i(TAG, "transcribeVoicemail, empty transcription"); + Logger.get(context).logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_RESPONSE_EMPTY); } } else { VvmLog.w(TAG, "transcribeVoicemail, no response"); + Logger.get(context).logImpression(DialerImpression.Type.VVM_TRANSCRIPTION_RESPONSE_INVALID); } } |