Commit f0d02501 authored by Yue Li's avatar Yue Li Committed by Commit Bot

[Assistant opt-in] Fix DCHECK error

Check the enrollment status before calling stop enrollment call.

Also restore a JS method that was removed accidentally recently.

Bug: 1084388, b/157268233
Test: Manual Test
Change-Id: I86826951ee2185ca0b1635278ef5b2a84358ac35
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2213241Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772044}
parent 2b864019
......@@ -56,6 +56,13 @@ cr.define('login.AssistantOptInFlowScreen', function() {
onVoiceMatchUpdate(state) {
$('assistant-optin-flow-card').onVoiceMatchUpdate(state);
},
/**
* Called when the flow finished and close the dialog.
*/
closeDialog() {
assistant.BrowserProxyImpl.getInstance().dialogClose();
},
};
});
......
......@@ -138,7 +138,6 @@ Polymer({
case this.$['voice-match']:
if (this.flowType == this.FlowType.SPEAKER_ID_ENROLLMENT ||
this.flowType == this.FlowType.SPEAKER_ID_RETRAIN) {
chrome.send('login.AssistantOptInFlowScreen.flowFinished');
this.browserProxy_.flowFinished();
} else {
this.showScreen(this.$['get-more']);
......
......@@ -517,7 +517,8 @@ void AssistantOptInFlowScreenHandler::HandleVoiceMatchScreenUserAction(
// No need to disable hotword for retrain flow since user has a model.
prefs->SetBoolean(assistant::prefs::kAssistantHotwordEnabled, false);
}
StopSpeakerIdEnrollment();
if (voice_match_enrollment_started_)
StopSpeakerIdEnrollment();
ShowNextScreen();
} else if (action == kRecordPressed) {
if (!prefs->GetBoolean(assistant::prefs::kAssistantHotwordEnabled)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment