Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 92e66dd6 authored by Jim Miller's avatar Jim Miller
Browse files

Fix 5797764: don't hold PowerManager lock when changing native brightness

This fixes a bug where the device could see a priority inversion when
updating display brightness.  The problem occurs because the code that
manages screen brightness holds the master lock while waiting for the
native method to complete.  On some devices, each call can amount to
tens to hundreds of ms, which meant clients using PowerManager APIs
could block for the duration of the call.  In some cases, the animation
could block for many seconds because the unfairness of Java locks.

The solution is to handle all brightness updates in a separate thread that
does not hold the master lock while calling native methods.

This also makes the animation more consistent by animating by actual
wall clock time rather than depending on the round-trip from the driver.

Change-Id: Ifad76fb2fb77e7b2a72dd9150440d87e22581b40
parent 79952ee2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment