From d538e0b42004524abe36ac17606d3915a14f5dae Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Fri, 30 Jun 2017 15:26:17 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/160679286. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/159771812 (6/22/2017) to 160679286 (6/30/2017). These changes track the dialer V11 release. This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Change-Id: I7e7b41ce472b85a9d5a6728d5c8b3c045c09e095 Merged-In: Ie2eb735a92c577b5ae5a5e8b7efa2d699fc964bc --- java/com/android/voicemail/impl/OmtpConstants.java | 37 ++++++++++++++++++++-- .../voicemail/impl/protocol/OmtpProtocol.java | 2 +- .../impl/transcribe/TranscriptionTask.java | 15 +++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) (limited to 'java/com/android/voicemail') diff --git a/java/com/android/voicemail/impl/OmtpConstants.java b/java/com/android/voicemail/impl/OmtpConstants.java index 599d0d5f0..97da2a8e3 100644 --- a/java/com/android/voicemail/impl/OmtpConstants.java +++ b/java/com/android/voicemail/impl/OmtpConstants.java @@ -234,6 +234,39 @@ public class OmtpConstants { public static final int CHANGE_PIN_INVALID_CHARACTER = 5; public static final int CHANGE_PIN_SYSTEM_ERROR = 6; - /** Indicates the client is Google visual voicemail version 1.0. */ - public static final String CLIENT_TYPE_GOOGLE_10 = "google.vvm.10"; + public static String getClientType() { + String manufacturer = + truncate( + android.os.Build.MANUFACTURER + .replace('=', '_') + .replace(';', '_') + .replace('.', '_') + .replace(' ', '_'), + 12); + + String version = + truncate( + android.os.Build.VERSION + .RELEASE + .replace('=', '_') + .replace(';', '_') + .replace('.', '_') + .replace(' ', '_'), + 8); + + String model = + truncate( + android.os.Build.MODEL + .replace('=', '_') + .replace(';', '_') + .replace('.', '_') + .replace(' ', '_'), + 28 - manufacturer.length() - version.length()); + + return String.format("%s.%s.%s", manufacturer, model, version); + } + + private static final String truncate(String string, int length) { + return string.substring(0, Math.min(length, string.length())); + } } diff --git a/java/com/android/voicemail/impl/protocol/OmtpProtocol.java b/java/com/android/voicemail/impl/protocol/OmtpProtocol.java index 27aab8a7c..971edcf4f 100644 --- a/java/com/android/voicemail/impl/protocol/OmtpProtocol.java +++ b/java/com/android/voicemail/impl/protocol/OmtpProtocol.java @@ -35,7 +35,7 @@ public class OmtpProtocol extends VisualVoicemailProtocol { phoneAccountHandle, applicationPort, destinationNumber, - OmtpConstants.CLIENT_TYPE_GOOGLE_10, + OmtpConstants.getClientType(), OmtpConstants.PROTOCOL_VERSION1_1, null /*clientPrefix*/); } 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); } } -- cgit v1.2.3