EventLoggerV1public class EventLoggerV1 extends AbstractEventLogger Writes data about a given speech synthesis request for V1 API to the event
logs. The data that is logged includes the calling app, length of the
utterance, speech rate / pitch, the latency, and overall time taken. |
Fields Summary |
---|
private final SynthesisRequest | mRequest |
Constructors Summary |
---|
EventLoggerV1(SynthesisRequest request, int callerUid, int callerPid, String serviceApp)
super(callerUid, callerPid, serviceApp);
mRequest = request;
|
Methods Summary |
---|
private java.lang.String | getLocaleString()Returns a formatted locale string from the synthesis params of the
form lang-country-variant.
StringBuilder sb = new StringBuilder(mRequest.getLanguage());
if (!TextUtils.isEmpty(mRequest.getCountry())) {
sb.append('-");
sb.append(mRequest.getCountry());
if (!TextUtils.isEmpty(mRequest.getVariant())) {
sb.append('-");
sb.append(mRequest.getVariant());
}
}
return sb.toString();
| private int | getUtteranceLength()
final String utterance = mRequest.getText();
return utterance == null ? 0 : utterance.length();
| protected void | logFailure(int statusCode)
// We don't report stopped syntheses because their overall
// total time spent will be inaccurate (will not correlate with
// the length of the utterance).
if (statusCode != TextToSpeech.STOPPED) {
EventLogTags.writeTtsSpeakFailure(mServiceApp, mCallerUid, mCallerPid,
getUtteranceLength(), getLocaleString(),
mRequest.getSpeechRate(), mRequest.getPitch());
}
| protected void | logSuccess(long audioLatency, long engineLatency, long engineTotal)
EventLogTags.writeTtsSpeakSuccess(mServiceApp, mCallerUid, mCallerPid,
getUtteranceLength(), getLocaleString(),
mRequest.getSpeechRate(), mRequest.getPitch(),
engineLatency, engineTotal, audioLatency);
|
|