This module aims to fix Nexus 5 ambient light sensor issues leading to random auto-brightness spikes under certain lighting.
The issue
Sometimes the light sensor goes crazy and reports 30000 lux even in a dim light because of what auto-brightness attempts to blind you in a moment. These random spikes happen when you hold a phone at certain angles and depend on light bulbs used in a room.
The solution
The fix is implemented as an Xposed module.
Basically, it is a filter inserted near a point where native HAL communicates to Android framework. It intercepts all sensor readings and replaces abnormal 30000 lux (and 0 lux following 30000) with an averaged value from a sliding window. This affects any process that use Android sensors API including system_process, so that default Android auto-brightness works fine too (no need to use apps like Lux Dash to workaround the issue).
Installation
The module provides no user interface, nor it runs any services in a background. It only injects a proxy method to the implementation of Android sensors API. You won't be able to notice it in the main menu or in a task manager. Think of it as a patch that can be turned on and off through Xposed installer.
Source
The mod is open source (with permissive MIT licence), the source code is available on my GitHub.
Thanks
The issue
Sometimes the light sensor goes crazy and reports 30000 lux even in a dim light because of what auto-brightness attempts to blind you in a moment. These random spikes happen when you hold a phone at certain angles and depend on light bulbs used in a room.
The solution
The fix is implemented as an Xposed module.
Basically, it is a filter inserted near a point where native HAL communicates to Android framework. It intercepts all sensor readings and replaces abnormal 30000 lux (and 0 lux following 30000) with an averaged value from a sliding window. This affects any process that use Android sensors API including system_process, so that default Android auto-brightness works fine too (no need to use apps like Lux Dash to workaround the issue).
Installation
- Download and install Xposed framework
- Then install Nexus 5 Light Sensor fix module and activate it
- Reboot
The module provides no user interface, nor it runs any services in a background. It only injects a proxy method to the implementation of Android sensors API. You won't be able to notice it in the main menu or in a task manager. Think of it as a patch that can be turned on and off through Xposed installer.
Source
The mod is open source (with permissive MIT licence), the source code is available on my GitHub.
Thanks
- @rovo89 for his Xposed framework
- @n3ocort3x and @wantabe for the initial attention and for kicking me up to finally create a new thread
- and you (the community) for your feedback
Last edited: