Commit 9fc44937 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Disable HideShelfControlsInTabletMode by default

We're disabling the buttons on 83 to mitigate concerns with issues where
users have reported that their devices unintentionally enter tablet mode
(even though they're physically in clamshell). Not showing home and
overview button in those cases would make the issue even worse.

The exception is kukui.

BUG=1084226

Change-Id: I390315dfe8f130a562e085abd51958a649581773
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2207020Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769878}
parent f3578dcb
......@@ -4,15 +4,32 @@
#include "ash/public/cpp/ash_features.h"
#include <vector>
#include "ash/public/cpp/ash_switches.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/strings/string_split.h"
#include "base/system/sys_info.h"
#include "build/build_config.h"
#include "chromeos/constants/chromeos_switches.h"
namespace ash {
namespace features {
namespace {
bool IsBoardKukui() {
std::vector<std::string> board =
base::SplitString(base::SysInfo::GetLsbReleaseBoard(), "-",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (board.empty())
return false;
return board[0] == "kukui";
}
} // namespace
const base::Feature kAllowAmbientEQ{"AllowAmbientEQ",
base::FEATURE_DISABLED_BY_DEFAULT};
......@@ -122,7 +139,7 @@ const base::Feature kDragFromShelfToHomeOrOverview{
"DragFromShelfToHomeOrOverview", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kHideShelfControlsInTabletMode{
"HideShelfControlsInTabletMode", base::FEATURE_ENABLED_BY_DEFAULT};
"HideShelfControlsInTabletMode", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kSystemTrayMicGainSetting{
"SystemTrayMicGainSetting", base::FEATURE_DISABLED_BY_DEFAULT};
......@@ -237,8 +254,17 @@ bool IsReduceDisplayNotificationsEnabled() {
}
bool IsHideShelfControlsInTabletModeEnabled() {
return base::FeatureList::IsEnabled(kHideShelfControlsInTabletMode) &&
IsDragFromShelfToHomeOrOverviewEnabled();
if (!IsDragFromShelfToHomeOrOverviewEnabled())
return false;
// Enable shelf navigation buttons by default on kukui.
// TODO(https://crbug.com/1084226): A better approach would be to have login
// manager enable the feature by setting an appropriate enable_features flag.
static const bool is_kukui = IsBoardKukui();
if (is_kukui)
return true;
return base::FeatureList::IsEnabled(kHideShelfControlsInTabletMode);
}
bool IsDisplayChangeModalEnabled() {
......
......@@ -81,7 +81,9 @@ class HomeToOverviewNudgeControllerWithNudgesDisabledTest : public AshTestBase {
class HomeToOverviewNudgeControllerTest : public AshTestBase {
public:
HomeToOverviewNudgeControllerTest() {
scoped_feature_list_.InitAndEnableFeature(ash::features::kContextualNudges);
scoped_feature_list_.InitWithFeatures(
{features::kContextualNudges, features::kHideShelfControlsInTabletMode},
{});
}
~HomeToOverviewNudgeControllerTest() override = default;
......
......@@ -995,8 +995,10 @@ class ScrollableShelfViewWithAppScalingTest : public ScrollableShelfViewTest {
~ScrollableShelfViewWithAppScalingTest() override = default;
void SetUp() override {
scoped_feature_list_.InitWithFeatures({ash::features::kShelfAppScaling},
{});
scoped_feature_list_.InitWithFeatures(
{ash::features::kShelfAppScaling,
features::kHideShelfControlsInTabletMode},
{});
ScrollableShelfViewTest::SetUp();
// Display should be big enough (width and height are bigger than 600).
......
......@@ -38,7 +38,10 @@ ShelfLayoutManager* GetShelfLayoutManager() {
class DragHandleContextualNudgeTest : public ShelfLayoutManagerTestBase {
public:
DragHandleContextualNudgeTest() {
scoped_feature_list_.InitAndEnableFeature(ash::features::kContextualNudges);
scoped_feature_list_.InitWithFeatures(
{ash::features::kContextualNudges,
ash::features::kHideShelfControlsInTabletMode},
{});
}
~DragHandleContextualNudgeTest() override = default;
......
......@@ -4,6 +4,7 @@
#include "ash/system/gesture_education/gesture_education_notification_controller.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/notification_utils.h"
#include "ash/public/cpp/shelf_config.h"
......@@ -40,7 +41,8 @@ GestureEducationNotificationController::
void GestureEducationNotificationController::MaybeShowNotification() {
bool is_user_session_blocked =
Shell::Get()->session_controller()->IsUserSessionBlocked();
if (TabletModeController::Get()->InTabletMode() && !is_user_session_blocked &&
if (features::IsHideShelfControlsInTabletModeEnabled() &&
TabletModeController::Get()->InTabletMode() && !is_user_session_blocked &&
(active_user_prefs_ && !active_user_prefs_->GetBoolean(
prefs::kGestureEducationNotificationShown)) &&
!ShelfConfig::Get()->ShelfControlsForcedShownForAccessibility()) {
......
......@@ -4,10 +4,12 @@
#include "ash/system/gesture_education/gesture_education_notification_controller.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
#include "base/test/scoped_feature_list.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_types.h"
......@@ -16,7 +18,10 @@ namespace ash {
class GestureEducationNotificationControllerTest : public AshTestBase {
public:
GestureEducationNotificationControllerTest() = default;
GestureEducationNotificationControllerTest() {
scoped_feature_list_.InitWithFeatures(
{ash::features::kHideShelfControlsInTabletMode}, {});
}
~GestureEducationNotificationControllerTest() override = default;
// AshTestBase:
......@@ -67,6 +72,8 @@ class GestureEducationNotificationControllerTest : public AshTestBase {
private:
std::unique_ptr<GestureEducationNotificationController> controller_;
std::unique_ptr<TabletModeControllerTestApi> test_api_;
base::test::ScopedFeatureList scoped_feature_list_;
};
TEST_F(GestureEducationNotificationControllerTest, Notification) {
......
......@@ -43,7 +43,9 @@ class BackGestureContextualNudgeControllerTest : public NoSessionAshTestBase {
}
NoSessionAshTestBase::SetUp(std::move(delegate));
scoped_feature_list_.InitAndEnableFeature(features::kContextualNudges);
scoped_feature_list_.InitWithFeatures(
{features::kContextualNudges, features::kHideShelfControlsInTabletMode},
{});
nudge_controller_ =
std::make_unique<BackGestureContextualNudgeControllerImpl>();
......
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