Merge "Convert ns to ms when averaging light values" into tm-qpr-dev am: e885bd18ac
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20168810 Change-Id: I4b2063bddabe72dcb9f05de1755283f556e4a5c5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -46,6 +46,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
class CameraPrivacyLightController implements AppOpsManager.OnOpActiveChangedListener,
|
class CameraPrivacyLightController implements AppOpsManager.OnOpActiveChangedListener,
|
||||||
SensorEventListener {
|
SensorEventListener {
|
||||||
@@ -275,7 +277,7 @@ class CameraPrivacyLightController implements AppOpsManager.OnOpActiveChangedLis
|
|||||||
public void onSensorChanged(SensorEvent event) {
|
public void onSensorChanged(SensorEvent event) {
|
||||||
// Using log space to represent human sensation (Fechner's Law) instead of lux
|
// Using log space to represent human sensation (Fechner's Law) instead of lux
|
||||||
// because lux values causes bright flashes to skew the average very high.
|
// because lux values causes bright flashes to skew the average very high.
|
||||||
addElement(event.timestamp, Math.max(0,
|
addElement(TimeUnit.NANOSECONDS.toMillis(event.timestamp), Math.max(0,
|
||||||
(int) (Math.log(event.values[0]) * LIGHT_VALUE_MULTIPLIER)));
|
(int) (Math.log(event.values[0]) * LIGHT_VALUE_MULTIPLIER)));
|
||||||
updateLightSession();
|
updateLightSession();
|
||||||
mHandler.removeCallbacksAndMessages(mDelayedUpdateToken);
|
mHandler.removeCallbacksAndMessages(mDelayedUpdateToken);
|
||||||
|
|||||||
Reference in New Issue
Block a user