sdm845-common: pocketmode: Ensure FP is always left enabled when screen is turned on
*) If you turn the screen on whilst the device is still in a pocket the fp sensor stays disabled even when the device is moved out into the open. *) This commit ensures that the FP sensor is always reenabled when the screen is turned on. Change-Id: If27967a468673f29d9c1a4742cc9dda95adaab59
This commit is contained in:
parent
f836f3e62e
commit
a61b42edf7
@ -55,12 +55,7 @@ public class ProximitySensor implements SensorEventListener {
|
||||
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
boolean isNear = event.values[0] < mSensor.getMaximumRange();
|
||||
try {
|
||||
FileUtils.stringToFile(FP_PROX_NODE, isNear ? "1" : "0");
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to write to " + FP_PROX_NODE, e);
|
||||
}
|
||||
setFPProximityState(event.values[0] < mSensor.getMaximumRange());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,6 +63,14 @@ public class ProximitySensor implements SensorEventListener {
|
||||
/* Empty */
|
||||
}
|
||||
|
||||
private void setFPProximityState(boolean isNear) {
|
||||
try {
|
||||
FileUtils.stringToFile(FP_PROX_NODE, isNear ? "1" : "0");
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to write to " + FP_PROX_NODE, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void enable() {
|
||||
if (DEBUG) Log.d(TAG, "Enabling");
|
||||
submit(() -> {
|
||||
@ -81,5 +84,7 @@ public class ProximitySensor implements SensorEventListener {
|
||||
submit(() -> {
|
||||
mSensorManager.unregisterListener(this, mSensor);
|
||||
});
|
||||
// Ensure FP is left enabled
|
||||
setFPProximityState(/* isNear */ false);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user