Index: chromeos/dbus/power_manager_client.cc |
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc |
index a5d2322d3b1dd6fe14965d0c9e014d50a2bc8506..ab24f386ecb809bb5f3e50d9b01fb7175a04b4b3 100644 |
--- a/chromeos/dbus/power_manager_client.cc |
+++ b/chromeos/dbus/power_manager_client.cc |
@@ -773,11 +773,7 @@ class PowerManagerClientImpl : public PowerManagerClient { |
class PowerManagerClientStubImpl : public PowerManagerClient { |
public: |
PowerManagerClientStubImpl() |
mozartalouis
2015/06/24 00:50:18
Not sure if we should keep this class any longer s
|
- : discharging_(true), |
- battery_percentage_(40), |
- brightness_(50.0), |
- pause_count_(2), |
- cycle_count_(0), |
+ : brightness_(50.0), |
num_pending_suspend_readiness_callbacks_(0), |
weak_ptr_factory_(this) {} |
@@ -873,69 +869,14 @@ class PowerManagerClientStubImpl : public PowerManagerClient { |
} |
void UpdateStatus() { |
- if (pause_count_ > 0) { |
mozartalouis
2015/06/24 00:50:18
Removed the current implementation of changing the
|
- pause_count_--; |
- if (pause_count_ == 2) |
- discharging_ = !discharging_; |
- } else { |
- if (discharging_) |
- battery_percentage_ -= (battery_percentage_ <= 10 ? 1 : 10); |
- else |
- battery_percentage_ += (battery_percentage_ >= 10 ? 10 : 1); |
- battery_percentage_ = std::min(std::max(battery_percentage_, 0), 100); |
- // We pause at 0 and 100% so that it's easier to check those conditions. |
- if (battery_percentage_ == 0 || battery_percentage_ == 100) { |
- pause_count_ = 4; |
- if (battery_percentage_ == 100) |
- cycle_count_ = (cycle_count_ + 1) % 3; |
- } |
- } |
- |
const int kSecondsToEmptyFullBattery = 3 * 60 * 60; // 3 hours. |
- int64 remaining_battery_time = |
- std::max(1, battery_percentage_ * kSecondsToEmptyFullBattery / 100); |
- |
- props_.Clear(); |
- |
- switch (cycle_count_) { |
- case 0: |
- // Say that the system is charging with AC connected and |
- // discharging without any charger connected. |
- props_.set_external_power(discharging_ ? |
- power_manager::PowerSupplyProperties_ExternalPower_DISCONNECTED : |
- power_manager::PowerSupplyProperties_ExternalPower_AC); |
- break; |
- case 1: |
- // Say that the system is both charging and discharging on USB |
- // (i.e. a low-power charger). |
- props_.set_external_power( |
- power_manager::PowerSupplyProperties_ExternalPower_USB); |
- break; |
- case 2: |
- // Say that the system is both charging and discharging on AC. |
- props_.set_external_power( |
- power_manager::PowerSupplyProperties_ExternalPower_AC); |
- break; |
- default: |
- NOTREACHED() << "Unhandled cycle " << cycle_count_; |
- } |
- |
- if (battery_percentage_ == 100 && !discharging_) { |
- props_.set_battery_state( |
- power_manager::PowerSupplyProperties_BatteryState_FULL); |
- } else if (!discharging_) { |
- props_.set_battery_state( |
- power_manager::PowerSupplyProperties_BatteryState_CHARGING); |
- props_.set_battery_time_to_full_sec(std::max(static_cast<int64>(1), |
- kSecondsToEmptyFullBattery - remaining_battery_time)); |
- } else { |
- props_.set_battery_state( |
- power_manager::PowerSupplyProperties_BatteryState_DISCHARGING); |
- props_.set_battery_time_to_empty_sec(remaining_battery_time); |
- } |
- |
- props_.set_battery_percent(battery_percentage_); |
- props_.set_is_calculating_battery_time(pause_count_ > 1); |
+ props_.set_external_power( |
+ power_manager::PowerSupplyProperties_ExternalPower_DISCONNECTED); |
+ props_.set_battery_state( |
+ power_manager::PowerSupplyProperties_BatteryState_DISCHARGING); |
+ props_.set_battery_time_to_empty_sec(kSecondsToEmptyFullBattery); |
+ props_.set_battery_percent(50); |
+ props_.set_is_calculating_battery_time(false); |
FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(props_)); |
} |
@@ -971,11 +912,7 @@ class PowerManagerClientStubImpl : public PowerManagerClient { |
} |
base::TimeDelta power_cycle_delay_; // Time over which to cycle power state |
- bool discharging_; |
- int battery_percentage_; |
double brightness_; |
- int pause_count_; |
- int cycle_count_; |
base::ObserverList<Observer> observers_; |
base::RepeatingTimer<PowerManagerClientStubImpl> update_timer_; |
power_manager::PowerSupplyProperties props_; |