Commit 63a2a55f authored by alanlxl's avatar alanlxl Committed by Commit Bot

Replace DeviceType check in smart dim with Flags

Smart dim only works on Chromebook; previously we use DeviceType to
check this, this CL replace it with base::FeatureList.

default on all Chromebook devices

Bug: 994011, 980826
Test: tested in conjunction with CrOS CLs that enable the flag by
Change-Id: I92e685728b173302d21e678051cfc463eaa0d85a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757410Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarAndrew Moylan <amoylan@chromium.org>
Commit-Queue: Xinglong Luan <alanlxl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696678}
parent 9f2bac9b
......@@ -5,8 +5,9 @@
#include "chrome/browser/chromeos/dbus/machine_learning_decision_service_provider.h"
#include "base/bind.h"
#include "base/feature_list.h"
#include "chrome/browser/chromeos/power/ml/user_activity_controller.h"
#include "chromeos/constants/devicetype.h"
#include "chrome/common/chrome_features.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
......@@ -47,9 +48,9 @@ void MachineLearningDecisionServiceProvider::ShouldDeferScreenDim(
std::unique_ptr<dbus::Response> response =
dbus::Response::FromMethodCall(method_call);
// Smart dim only works on chromebook devices. Simply return false on other
// device types.
if (chromeos::GetDeviceType() != chromeos::DeviceType::kChromebook) {
// Smart dim only works when features::kSmartDim is enabled. Simply return
// false otherwise.
if (!base::FeatureList::IsEnabled(features::kSmartDim)) {
SendSmartDimDecision(std::move(response), std::move(response_sender),
false);
return;
......
......@@ -4,8 +4,9 @@
#include "chrome/browser/chromeos/power/ml/user_activity_controller.h"
#include "base/feature_list.h"
#include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
#include "chromeos/constants/devicetype.h"
#include "chrome/common/chrome_features.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/session_manager/session_manager_types.h"
#include "components/viz/host/host_frame_sink_manager.h"
......@@ -18,7 +19,7 @@ namespace power {
namespace ml {
UserActivityController::UserActivityController() {
if (chromeos::GetDeviceType() != chromeos::DeviceType::kChromebook)
if (!base::FeatureList::IsEnabled(features::kSmartDim))
return;
chromeos::PowerManagerClient* power_manager_client =
......
......@@ -797,6 +797,9 @@ const base::Feature kCrOSEnableUSMUserService{"CrOSEnableUSMUserService",
const base::Feature kMachineLearningService{"MachineLearningService",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables or disables SmartDim on Chrome OS.
const base::Feature kSmartDim{"SmartDim", base::FEATURE_DISABLED_BY_DEFAULT};
// Enable USBGuard at the lockscreen on Chrome OS.
// TODO(crbug.com/874630): Remove this kill-switch
const base::Feature kUsbguard{"USBGuard", base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -501,6 +501,8 @@ extern const base::Feature kCrOSEnableUSMUserService;
COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kMachineLearningService;
COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kSmartDim;
COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kUsbguard;
COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kUsbbouncer;
......
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