Commit 7270258e authored by Xiaohui Chen's avatar Xiaohui Chen Committed by Commit Bot

Update libassistant config string

Bug: b:78589509
Test: locally build and run
Change-Id: I862691a0bb5774e9761f5202cd2a23f08099061b
Reviewed-on: https://chromium-review.googlesource.com/1031092Reviewed-by: default avatarMuyuan Li <muyuanli@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554506}
parent fd84044f
......@@ -54,6 +54,8 @@ source_set("lib") {
"platform/system_provider_impl.h",
"platform_api_impl.cc",
"platform_api_impl.h",
"utils.cc",
"utils.h",
]
deps += [
......
......@@ -15,6 +15,7 @@
#include "chromeos/assistant/internal/internal_constants.h"
#include "chromeos/assistant/internal/internal_util.h"
#include "chromeos/services/assistant/service.h"
#include "chromeos/services/assistant/utils.h"
#include "chromeos/system/version_loader.h"
#include "libassistant/shared/internal_api/assistant_manager_internal.h"
#include "url/gurl.h"
......@@ -24,7 +25,7 @@ namespace assistant {
AssistantManagerServiceImpl::AssistantManagerServiceImpl(
mojom::AudioInputPtr audio_input)
: platform_api_(kDefaultConfigStr, std::move(audio_input)),
: platform_api_(CreateLibAssistantConfig(), std::move(audio_input)),
action_module_(std::make_unique<action::CrosActionModule>(this)),
display_connection_(std::make_unique<CrosDisplayConnection>(this)),
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
......@@ -39,7 +40,7 @@ void AssistantManagerServiceImpl::Start(const std::string& access_token,
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(&assistant_client::AssistantManager::Create,
&platform_api_, kDefaultConfigStr),
&platform_api_, CreateLibAssistantConfig()),
base::BindOnce(&AssistantManagerServiceImpl::StartAssistantInternal,
base::Unretained(this), std::move(callback), access_token,
chromeos::version_loader::GetARCVersion()));
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/services/assistant/utils.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/sys_info.h"
#include "base/values.h"
#include "chromeos/assistant/internal/internal_constants.h"
#include "chromeos/system/version_loader.h"
namespace chromeos {
namespace assistant {
std::string CreateLibAssistantConfig() {
using Value = base::Value;
using Type = base::Value::Type;
Value config(Type::DICTIONARY);
Value device(Type::DICTIONARY);
device.SetKey("board_name", Value(base::SysInfo::GetLsbReleaseBoard()));
device.SetKey("board_revision", Value("1"));
device.SetKey("embedder_build_info",
Value(chromeos::version_loader::GetVersion(
chromeos::version_loader::VERSION_FULL)));
device.SetKey("model_id", Value(kModelId));
device.SetKey("model_revision", Value(1));
config.SetKey("device", std::move(device));
Value discovery(Type::DICTIONARY);
discovery.SetKey("enable_mdns", Value(false));
config.SetKey("discovery", std::move(discovery));
std::string json;
base::JSONWriter::Write(config, &json);
return json;
}
} // namespace assistant
} // namespace chromeos
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_SERVICES_ASSISTANT_UTILS_H_
#define CHROMEOS_SERVICES_ASSISTANT_UTILS_H_
#include <string>
#include "base/macros.h"
namespace chromeos {
namespace assistant {
std::string CreateLibAssistantConfig();
} // namespace assistant
} // namespace chromeos
#endif // CHROMEOS_SERVICES_ASSISTANT_UTILS_H_
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