Commit 9e470ebe authored by Yue Li's avatar Yue Li Committed by Commit Bot

Update borad type check rule for AssistantUtil

Generalize the board type check rule to match different sub-types of the
board.

Bug: b/140766051
Test: Manual Test
Change-Id: Iecd194dbccb2f8b6ceb299632d301e6b58f1797e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1794202Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695297}
parent 1ffb3583
......@@ -5,15 +5,26 @@
#include "ash/assistant/util/assistant_util.h"
#include "ash/assistant/model/assistant_ui_model.h"
#include "base/strings/string_util.h"
#include "base/system/sys_info.h"
namespace {
constexpr char kEveBoardName[] = "eve";
constexpr char kNocturneBoardName[] = "nocturne";
constexpr char kEveBoardType[] = "eve";
constexpr char kNocturneBoardType[] = "nocturne";
bool g_override_is_google_device = false;
bool IsBoardType(const std::string& board_name, const std::string& board_type) {
// The sub-types of the board will have the form boardtype-XXX.
// To prevent the possibility of common prefix in board names we check the
// board type with '-' here. For example there might be two board types with
// codename boardtype1 and boardtype123.
return board_name == board_type ||
base::StartsWith(board_name, board_type + '-',
base::CompareCase::SENSITIVE);
}
} // namespace
namespace ash {
......@@ -69,8 +80,9 @@ bool ShouldAttemptWarmerWelcome(AssistantEntryPoint entry_point) {
bool IsGoogleDevice() {
const std::string board_name = base::SysInfo::GetLsbReleaseBoard();
return g_override_is_google_device || board_name == kEveBoardName ||
board_name == kNocturneBoardName;
return g_override_is_google_device ||
IsBoardType(board_name, kEveBoardType) ||
IsBoardType(board_name, kNocturneBoardType);
}
void OverrideIsGoogleDeviceForTesting() {
......
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