D8462: [batterymonitor] Fix brightness resetting to 1 on startup

Bhushan Shah noreply at phabricator.kde.org
Wed Oct 25 05:39:08 UTC 2017


bshah created this revision.
bshah added reviewers: Plasma, broulik.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.

REVISION SUMMARY
  This was tricky bug to track down, needed to add debug statements in
  literally every functions.
  
  The flow of events is something like this, At startup:
  
  - We don't have information about actual brightness for few seconds
  - In this period, brightness slider have default value of 1
  - This triggers the function which sets batterymonitor.screenBrightness
  - onScreenBrightnessChanged gets called, which sets the actual
  
  brightness
  
  - onScreenBrightnessChanged have a guard for disableBrightnessUpdate but
  
  since we have it marked as false initially, we proceed to set actual
  brightness to 1
  
  - However before we set value of brightness to 1, we do get actual
  
  brightness back from dataengine, and our call overrides it to 1 later.
  
  - On desktop we do get 2nd dataChanged event from somewhere, so
  
  brightness is proper, but on mobile that is not case and results in
  brightness staying at 1.
  
  To fix this bug, we set disableBrightnessUpdate true at startup, and
  when there is actual brightness change from powerdevil or
  powermanagement engine, Logic.js takes care of enabling and disabling
  brightness change.
  
  (I quite like the boolean trap there in variable name :P .. will fix in
  another change in master)

TEST PLAN
  Tested on desktop and mobile, verified that
  
  - Brightness keys work
  - Brightness slider works
  - Scroll to change brightness works

REPOSITORY
  R120 Plasma Workspace

BRANCH
  fix-brightness-reset

REVISION DETAIL
  https://phabricator.kde.org/D8462

AFFECTED FILES
  applets/batterymonitor/package/contents/ui/batterymonitor.qml

To: bshah, #plasma, broulik
Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20171025/b5e24d91/attachment.html>


More information about the Plasma-devel mailing list