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

Update assistant util to use the IsGoogleBrandedDevice method

Update to use the newly added util method for Google branded devices.

Bug: None
Test: Manual Test
Change-Id: I0c8c10c6d4dce5f6e556826c7ee0a6595a116d23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1985636Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729711}
parent e9559e59
......@@ -14,6 +14,7 @@
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/constants/devicetype.h"
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
#include "components/language/core/browser/pref_names.h"
#include "components/prefs/pref_service.h"
......@@ -24,35 +25,6 @@
#include "third_party/icu/source/common/unicode/locid.h"
#include "ui/chromeos/events/keyboard_layout_util.h"
namespace {
constexpr char kAtlasBoardType[] = "atlas";
constexpr char kEveBoardType[] = "eve";
constexpr char kNocturneBoardType[] = "nocturne";
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);
}
// TODO(updowndota): Merge this method with the IsGoogleDevice method in
// ash::assistant::util, probably move to ash::public:cpp.
//
// Returns whether the device has a dedicated Assistant key.
bool IsAssistantDevice() {
const std::string board_name = base::SysInfo::GetLsbReleaseBoard();
return IsBoardType(board_name, kAtlasBoardType) ||
IsBoardType(board_name, kEveBoardType) ||
IsBoardType(board_name, kNocturneBoardType);
}
} // namespace
namespace assistant {
ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile(
......@@ -126,7 +98,8 @@ ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile(
// Bypass the account type check when using fake gaia login, e.g. in Tast
// tests, or the account is logged in a device with dedicated Assistant key.
if (!chromeos::switches::IsGaiaServicesDisabled() && !(IsAssistantDevice())) {
if (!chromeos::switches::IsGaiaServicesDisabled() &&
!chromeos::IsGoogleBrandedDevice()) {
// Only enable non-dasher accounts for devices without physical key.
bool account_supported = false;
auto* identity_manager =
......
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