From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Thu, 22 Mar 2018 22:11:57 +0100
Subject: Battery API: return nothing

---
 services/device/battery/battery_status_service.cc  |  2 +-
 .../renderer/modules/battery/battery_manager.cc    | 25 ++++------------------
 2 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/services/device/battery/battery_status_service.cc b/services/device/battery/battery_status_service.cc
--- a/services/device/battery/battery_status_service.cc
+++ b/services/device/battery/battery_status_service.cc
@@ -41,7 +41,7 @@ BatteryStatusService::AddCallback(const BatteryUpdateCallback& callback) {
   if (!battery_fetcher_)
     battery_fetcher_ = BatteryStatusManager::Create(update_callback_);
 
-#if 0
+#if !defined(OS_ANDROID)
   if (callback_list_.empty()) {
     bool success = battery_fetcher_->StartListeningBatteryChange();
     // On failure pass the default values back.
diff --git a/third_party/blink/renderer/modules/battery/battery_manager.cc b/third_party/blink/renderer/modules/battery/battery_manager.cc
--- a/third_party/blink/renderer/modules/battery/battery_manager.cc
+++ b/third_party/blink/renderer/modules/battery/battery_manager.cc
@@ -42,45 +42,28 @@ ScriptPromise BatteryManager::StartRequest(ScriptState* script_state) {
 }
 
 bool BatteryManager::charging() {
-  return battery_status_.Charging();
+  return false;
 }
 
 double BatteryManager::chargingTime() {
-  return battery_status_.charging_time();
+  return 0;
 }
 
 double BatteryManager::dischargingTime() {
-  return battery_status_.discharging_time();
+  return 0;
 }
 
 double BatteryManager::level() {
-  return battery_status_.Level();
+  return 1;
 }
 
 void BatteryManager::DidUpdateData() {
   DCHECK(battery_property_);
 
-  BatteryStatus old_status = battery_status_;
-  battery_status_ = *BatteryDispatcher::Instance().LatestData();
-
   if (battery_property_->GetState() == ScriptPromisePropertyBase::kPending) {
     battery_property_->Resolve(this);
     return;
   }
-
-  Document* document = ToDocument(GetExecutionContext());
-  DCHECK(document);
-  if (document->IsContextPaused() || document->IsContextDestroyed())
-    return;
-
-  if (battery_status_.Charging() != old_status.Charging())
-    DispatchEvent(Event::Create(EventTypeNames::chargingchange));
-  if (battery_status_.charging_time() != old_status.charging_time())
-    DispatchEvent(Event::Create(EventTypeNames::chargingtimechange));
-  if (battery_status_.discharging_time() != old_status.discharging_time())
-    DispatchEvent(Event::Create(EventTypeNames::dischargingtimechange));
-  if (battery_status_.Level() != old_status.Level())
-    DispatchEvent(Event::Create(EventTypeNames::levelchange));
 }
 
 void BatteryManager::RegisterWithDispatcher() {
-- 
2.7.4

