Commit 6e3f35be authored by chirantan's avatar chirantan Committed by Commit bot

Add lucid sleep flag and debugging helper

Add a flag for lucid sleep so that apps that wish to start working with it can
do so while it's still under development.  Also to help with testing when the
lid is closed, add a class that will flash the light bar when the system is in dark
resume.

BUG=397328
Signed-off-by: default avatarChirantan Ekbote <chirantan@chromium.org>

Review URL: https://codereview.chromium.org/566993002

Cr-Commit-Position: refs/heads/master@{#294972}
parent 764ceed3
...@@ -1090,6 +1090,12 @@ Press any key to continue exploring. ...@@ -1090,6 +1090,12 @@ Press any key to continue exploring.
<message name="IDS_FLAGS_DISABLE_DISPLAY_COLOR_CALIBRATION_DESCRIPTION" desc="Description for the flag to disable the color calibration of the display."> <message name="IDS_FLAGS_DISABLE_DISPLAY_COLOR_CALIBRATION_DESCRIPTION" desc="Description for the flag to disable the color calibration of the display.">
Disable calibrating the color of the display even if the display supports the feature. Disable calibrating the color of the display even if the display supports the feature.
</message> </message>
<message name="IDS_FLAGS_WAKE_ON_PACKETS_NAME" desc="Name for the flag to enable wake on packets.">
Wake On Packets
</message>
<message name="IDS_FLAGS_WAKE_ON_PACKETS_DESCRIPTION" desc="Description for the flag to enable wake on packets.">
Enables waking the device based on the receipt of some network packets.
</message>
<message name="IDS_OFFERS_CONSENT_INFOBAR_LABEL_LEARN_MORE" desc="Text of the Learn More link in the echo dialog."> <message name="IDS_OFFERS_CONSENT_INFOBAR_LABEL_LEARN_MORE" desc="Text of the Learn More link in the echo dialog.">
Learn More Learn More
</message> </message>
......
...@@ -1905,6 +1905,15 @@ const Experiment kExperiments[] = { ...@@ -1905,6 +1905,15 @@ const Experiment kExperiments[] = {
switches::kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval) switches::kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval)
}, },
#endif #endif
#if defined(OS_CHROMEOS)
{
"wake-on-packets",
IDS_FLAGS_WAKE_ON_PACKETS_NAME,
IDS_FLAGS_WAKE_ON_PACKETS_DESCRIPTION,
kOsCrOSOwnerOnly,
SINGLE_VALUE_TYPE(chromeos::switches::kWakeOnPackets)
},
#endif // OS_CHROMEOS
// NOTE: Adding new command-line switches requires adding corresponding // NOTE: Adding new command-line switches requires adding corresponding
// entries to enum "LoginCustomFlags" in histograms.xml. See note in // entries to enum "LoginCustomFlags" in histograms.xml. See note in
// histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test.
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_local_account.h" #include "chrome/browser/chromeos/policy/device_local_account.h"
#include "chrome/browser/chromeos/power/idle_action_warning_observer.h" #include "chrome/browser/chromeos/power/idle_action_warning_observer.h"
#include "chrome/browser/chromeos/power/light_bar.h"
#include "chrome/browser/chromeos/power/peripheral_battery_observer.h" #include "chrome/browser/chromeos/power/peripheral_battery_observer.h"
#include "chrome/browser/chromeos/power/power_button_observer.h" #include "chrome/browser/chromeos/power/power_button_observer.h"
#include "chrome/browser/chromeos/power/power_data_collector.h" #include "chrome/browser/chromeos/power/power_data_collector.h"
...@@ -562,6 +563,8 @@ void ChromeBrowserMainPartsChromeos::PostProfileInit() { ...@@ -562,6 +563,8 @@ void ChromeBrowserMainPartsChromeos::PostProfileInit() {
peripheral_battery_observer_.reset(new PeripheralBatteryObserver()); peripheral_battery_observer_.reset(new PeripheralBatteryObserver());
renderer_freezer_.reset(new RendererFreezer()); renderer_freezer_.reset(new RendererFreezer());
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWakeOnPackets))
light_bar_.reset(new LightBar());
g_browser_process->platform_part()->InitializeAutomaticRebootManager(); g_browser_process->platform_part()->InitializeAutomaticRebootManager();
...@@ -679,6 +682,7 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() { ...@@ -679,6 +682,7 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() {
peripheral_battery_observer_.reset(); peripheral_battery_observer_.reset();
power_prefs_.reset(); power_prefs_.reset();
renderer_freezer_.reset(); renderer_freezer_.reset();
light_bar_.reset();
// Let the ScreenLocker unregister itself from SessionManagerClient before // Let the ScreenLocker unregister itself from SessionManagerClient before
// DBusThreadManager is shut down. // DBusThreadManager is shut down.
......
...@@ -26,6 +26,7 @@ class EventRewriter; ...@@ -26,6 +26,7 @@ class EventRewriter;
class EventRewriterController; class EventRewriterController;
class ExtensionSystemEventObserver; class ExtensionSystemEventObserver;
class IdleActionWarningObserver; class IdleActionWarningObserver;
class LightBar;
class MagnificationManager; class MagnificationManager;
class PeripheralBatteryObserver; class PeripheralBatteryObserver;
class PowerButtonObserver; class PowerButtonObserver;
...@@ -73,6 +74,7 @@ class ChromeBrowserMainPartsChromeos : public ChromeBrowserMainPartsLinux { ...@@ -73,6 +74,7 @@ class ChromeBrowserMainPartsChromeos : public ChromeBrowserMainPartsLinux {
scoped_ptr<IdleActionWarningObserver> idle_action_warning_observer_; scoped_ptr<IdleActionWarningObserver> idle_action_warning_observer_;
scoped_ptr<DataPromoNotification> data_promo_notification_; scoped_ptr<DataPromoNotification> data_promo_notification_;
scoped_ptr<RendererFreezer> renderer_freezer_; scoped_ptr<RendererFreezer> renderer_freezer_;
scoped_ptr<LightBar> light_bar_;
scoped_ptr<internal::DBusServices> dbus_services_; scoped_ptr<internal::DBusServices> dbus_services_;
......
// Copyright 2014 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 "chrome/browser/chromeos/power/light_bar.h"
#include <cstring> // needed for strlen()
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/dbus_thread_manager.h"
namespace chromeos {
namespace {
const int kDarkSuspendDelaySeconds = 4;
const char kLightBarControlPath[] =
"/sys/devices/virtual/chromeos/cros_ec/lightbar/sequence";
const char kKonamiCommand[] = "KONAMI";
} // namespace
LightBar::LightBar()
: control_path_(base::FilePath(kLightBarControlPath)),
has_light_bar_(base::PathIsWritable(control_path_)) {
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
}
LightBar::~LightBar() {
DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
}
void LightBar::DarkSuspendImminent() {
// The plan is to track the progress of push events and then re-suspend as
// soon as we know they have been processed. In the meanwhile, we can hack
// around this by just having the light bar delay for a long time so that
// people can at least start playing around with this feature for their apps.
//
// TODO(chirantan): Remove this once we can accurately track the progress of
// push events.
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
DBusThreadManager::Get()
->GetPowerManagerClient()
->GetSuspendReadinessCallback(),
base::TimeDelta::FromSeconds(kDarkSuspendDelaySeconds));
if (!has_light_bar_)
return;
if (base::WriteFile(control_path_, kKonamiCommand, strlen(kKonamiCommand)) !=
static_cast<int>(strlen(kKonamiCommand)))
PLOG(WARNING) << "Unable to flash light bar during dark resume.";
}
} // namespace chromeos
// Copyright 2014 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 CHROME_BROWSER_CHROMEOS_POWER_LIGHT_BAR_H_
#define CHROME_BROWSER_CHROMEOS_POWER_LIGHT_BAR_H_
#include "base/files/file_path.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/dbus/power_manager_client.h"
namespace chromeos {
// Flashes the light bar (on systems that have one) whenever the system comes up
// in dark resume.
class CHROMEOS_EXPORT LightBar : public PowerManagerClient::Observer {
public:
LightBar();
virtual ~LightBar();
// PowerManagerClient::Observer implementation.
virtual void DarkSuspendImminent() OVERRIDE;
private:
// Path to control the light bar.
base::FilePath control_path_;
// True if the system has a light bar.
bool has_light_bar_;
DISALLOW_COPY_AND_ASSIGN(LightBar);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_POWER_LIGHT_BAR_H_
...@@ -905,6 +905,8 @@ ...@@ -905,6 +905,8 @@
'browser/chromeos/power/idle_action_warning_dialog_view.h', 'browser/chromeos/power/idle_action_warning_dialog_view.h',
'browser/chromeos/power/idle_action_warning_observer.cc', 'browser/chromeos/power/idle_action_warning_observer.cc',
'browser/chromeos/power/idle_action_warning_observer.h', 'browser/chromeos/power/idle_action_warning_observer.h',
'browser/chromeos/power/light_bar.cc',
'browser/chromeos/power/light_bar.h',
'browser/chromeos/power/peripheral_battery_observer.cc', 'browser/chromeos/power/peripheral_battery_observer.cc',
'browser/chromeos/power/peripheral_battery_observer.h', 'browser/chromeos/power/peripheral_battery_observer.h',
'browser/chromeos/power/power_button_observer.cc', 'browser/chromeos/power/power_button_observer.cc',
......
...@@ -237,6 +237,9 @@ const char kForceFirstRunUI[] = "force-first-run-ui"; ...@@ -237,6 +237,9 @@ const char kForceFirstRunUI[] = "force-first-run-ui";
// Enables testing for auto update UI. // Enables testing for auto update UI.
const char kTestAutoUpdateUI[] = "test-auto-update-ui"; const char kTestAutoUpdateUI[] = "test-auto-update-ui";
// Enables waking the device based on the receipt of some network packets.
const char kWakeOnPackets[] = "wake-on-packets";
// Screenshot testing: specifies the directory where the golden screenshots are // Screenshot testing: specifies the directory where the golden screenshots are
// stored. // stored.
const char kGoldenScreenshotsDir[] = "golden-screenshots-dir"; const char kGoldenScreenshotsDir[] = "golden-screenshots-dir";
......
...@@ -78,6 +78,7 @@ CHROMEOS_EXPORT extern const char kShowHostPairingDemo[]; ...@@ -78,6 +78,7 @@ CHROMEOS_EXPORT extern const char kShowHostPairingDemo[];
CHROMEOS_EXPORT extern const char kSmsTestMessages[]; CHROMEOS_EXPORT extern const char kSmsTestMessages[];
CHROMEOS_EXPORT extern const char kStubCrosSettings[]; CHROMEOS_EXPORT extern const char kStubCrosSettings[];
CHROMEOS_EXPORT extern const char kTestAutoUpdateUI[]; CHROMEOS_EXPORT extern const char kTestAutoUpdateUI[];
CHROMEOS_EXPORT extern const char kWakeOnPackets[];
CHROMEOS_EXPORT extern const char kEnableScreenshotTestingWithMode[]; CHROMEOS_EXPORT extern const char kEnableScreenshotTestingWithMode[];
CHROMEOS_EXPORT extern const char kGoldenScreenshotsDir[]; CHROMEOS_EXPORT extern const char kGoldenScreenshotsDir[];
CHROMEOS_EXPORT extern const char kArtifactsDir[]; CHROMEOS_EXPORT extern const char kArtifactsDir[];
......
...@@ -44466,6 +44466,7 @@ To add a new entry, add it with any value and run test to compute valid value. ...@@ -44466,6 +44466,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="-1703709912" label="enable-new-ntp"/> <int value="-1703709912" label="enable-new-ntp"/>
<int value="-1703308540" label="disable-webaudio"/> <int value="-1703308540" label="disable-webaudio"/>
<int value="-1696366449" label="disable-permissions-bubbles"/> <int value="-1696366449" label="disable-permissions-bubbles"/>
<int value="-1662447331" label="wake-on-packets"/>
<int value="-1619757314" label="touch-scrolling-mode"/> <int value="-1619757314" label="touch-scrolling-mode"/>
<int value="-1605567628" label="disable-overlay-scrollbar"/> <int value="-1605567628" label="disable-overlay-scrollbar"/>
<int value="-1596559650" label="max-tiles-for-interest-area"/> <int value="-1596559650" label="max-tiles-for-interest-area"/>
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