diff options
author | mdooley <mdooley@google.com> | 2017-11-23 08:31:05 -0800 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-11-28 14:34:47 -0800 |
commit | 70fedf8d6caee1177ee891bbfff404dc48867c16 (patch) | |
tree | c59375133ee2f7236c17758706e88a492db81259 /java/com/android/voicemail/impl/transcribe/grpc | |
parent | 5b6d823a45fe56cf9c36e5b00908831049c1d827 (diff) |
Adding transcription rating feedback
Allow users who have agreed to donate their voicemails to also provide
transcription quality feedback.
screenshot:
https://drive.google.com/open?id=0B9o_KvtLkcuIajVtdFN3Y0Qydmx2NXJYN2N3OVA3N0h5UEdR
Bug: 68712148
Test: manual and new unit tests
PiperOrigin-RevId: 176774942
Change-Id: I08b9afbbefaedfb0de5199038a1d2769bd983855
Diffstat (limited to 'java/com/android/voicemail/impl/transcribe/grpc')
3 files changed, 47 insertions, 1 deletions
diff --git a/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java b/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java index b18d95627..381cb3268 100644 --- a/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java +++ b/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java @@ -17,6 +17,7 @@ package com.android.voicemail.impl.transcribe.grpc; import android.support.annotation.WorkerThread; import com.google.internal.communications.voicemailtranscription.v1.GetTranscriptRequest; +import com.google.internal.communications.voicemailtranscription.v1.SendTranscriptionFeedbackRequest; import com.google.internal.communications.voicemailtranscription.v1.TranscribeVoicemailAsyncRequest; import com.google.internal.communications.voicemailtranscription.v1.TranscribeVoicemailRequest; import com.google.internal.communications.voicemailtranscription.v1.VoicemailTranscriptionServiceGrpc; @@ -58,4 +59,14 @@ public class TranscriptionClient { return new GetTranscriptResponseAsync(e.getStatus()); } } + + @WorkerThread + public TranscriptionFeedbackResponseAsync sendTranscriptFeedbackRequest( + SendTranscriptionFeedbackRequest request) { + try { + return new TranscriptionFeedbackResponseAsync(stub.sendTranscriptionFeedback(request)); + } catch (StatusRuntimeException e) { + return new TranscriptionFeedbackResponseAsync(e.getStatus()); + } + } } diff --git a/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionFeedbackResponseAsync.java b/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionFeedbackResponseAsync.java new file mode 100644 index 000000000..bc6155bbd --- /dev/null +++ b/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionFeedbackResponseAsync.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ +package com.android.voicemail.impl.transcribe.grpc; + +import android.support.annotation.VisibleForTesting; +import com.android.dialer.common.Assert; +import com.google.internal.communications.voicemailtranscription.v1.SendTranscriptionFeedbackResponse; +import io.grpc.Status; + +/** Container for response and status objects for an asynchronous transcription feedback request */ +public class TranscriptionFeedbackResponseAsync extends TranscriptionResponse { + + @VisibleForTesting + public TranscriptionFeedbackResponseAsync(SendTranscriptionFeedbackResponse response) { + Assert.checkArgument(response != null); + } + + @VisibleForTesting + public TranscriptionFeedbackResponseAsync(Status status) { + super(status); + } +} diff --git a/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto b/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto index c46fb2176..8248b02a7 100644 --- a/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto +++ b/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto @@ -184,7 +184,7 @@ service VoicemailTranscriptionService { // Uploads user's transcription feedback. Feedback will only be collected from // user's who have consented to donate their voicemails. - rpc SendTranscriptionFeedback(SendTranscriptionFeedbackResponse) + rpc SendTranscriptionFeedback(SendTranscriptionFeedbackRequest) returns (SendTranscriptionFeedbackResponse) { } } |