Merge "Add batching to Flip to Screen Off." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bee94e56ed
@@ -1792,6 +1792,9 @@
|
|||||||
<!-- Boolean indicating if placing the phone face down will result in a screen off. -->
|
<!-- Boolean indicating if placing the phone face down will result in a screen off. -->
|
||||||
<bool name="config_flipToScreenOffEnabled">true</bool>
|
<bool name="config_flipToScreenOffEnabled">true</bool>
|
||||||
|
|
||||||
|
<!-- Integer to set a max latency the accelerometer will batch sensor requests with. -->
|
||||||
|
<integer name="config_flipToScreenOffMaxLatencyMicros">2000000</integer>
|
||||||
|
|
||||||
<!-- Boolean indicating if current platform supports bluetooth SCO for off call
|
<!-- Boolean indicating if current platform supports bluetooth SCO for off call
|
||||||
use cases -->
|
use cases -->
|
||||||
<bool name="config_bluetooth_sco_off_call">true</bool>
|
<bool name="config_bluetooth_sco_off_call">true</bool>
|
||||||
|
|||||||
@@ -276,6 +276,7 @@
|
|||||||
<java-symbol type="bool" name="config_avoidGfxAccel" />
|
<java-symbol type="bool" name="config_avoidGfxAccel" />
|
||||||
<java-symbol type="bool" name="config_bluetooth_address_validation" />
|
<java-symbol type="bool" name="config_bluetooth_address_validation" />
|
||||||
<java-symbol type="bool" name="config_flipToScreenOffEnabled" />
|
<java-symbol type="bool" name="config_flipToScreenOffEnabled" />
|
||||||
|
<java-symbol type="integer" name="config_flipToScreenOffMaxLatencyMicros" />
|
||||||
<java-symbol type="bool" name="config_bluetooth_sco_off_call" />
|
<java-symbol type="bool" name="config_bluetooth_sco_off_call" />
|
||||||
<java-symbol type="bool" name="config_bluetooth_le_peripheral_mode_supported" />
|
<java-symbol type="bool" name="config_bluetooth_le_peripheral_mode_supported" />
|
||||||
<java-symbol type="bool" name="config_bluetooth_hfp_inband_ringing_support" />
|
<java-symbol type="bool" name="config_bluetooth_hfp_inband_ringing_support" />
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ public class FaceDownDetector implements SensorEventListener {
|
|||||||
|
|
||||||
private boolean mIsEnabled;
|
private boolean mIsEnabled;
|
||||||
|
|
||||||
|
private int mSensorMaxLatencyMicros;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DeviceConfig flag name, determines how long to disable sensor when user interacts while
|
* DeviceConfig flag name, determines how long to disable sensor when user interacts while
|
||||||
* device is flipped.
|
* device is flipped.
|
||||||
@@ -202,7 +204,11 @@ public class FaceDownDetector implements SensorEventListener {
|
|||||||
if (mActive != shouldBeActive) {
|
if (mActive != shouldBeActive) {
|
||||||
if (shouldBeActive) {
|
if (shouldBeActive) {
|
||||||
mSensorManager.registerListener(
|
mSensorManager.registerListener(
|
||||||
this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
|
this,
|
||||||
|
mAccelerometer,
|
||||||
|
SensorManager.SENSOR_DELAY_NORMAL,
|
||||||
|
mSensorMaxLatencyMicros
|
||||||
|
);
|
||||||
if (mPreviousResultType == SCREEN_OFF_RESULT) {
|
if (mPreviousResultType == SCREEN_OFF_RESULT) {
|
||||||
logScreenOff();
|
logScreenOff();
|
||||||
}
|
}
|
||||||
@@ -226,6 +232,7 @@ public class FaceDownDetector implements SensorEventListener {
|
|||||||
pw.println(" mFaceDown=" + mFaceDown);
|
pw.println(" mFaceDown=" + mFaceDown);
|
||||||
pw.println(" mActive=" + mActive);
|
pw.println(" mActive=" + mActive);
|
||||||
pw.println(" mLastFlipTime=" + mLastFlipTime);
|
pw.println(" mLastFlipTime=" + mLastFlipTime);
|
||||||
|
pw.println(" mSensorMaxLatencyMicros=" + mSensorMaxLatencyMicros);
|
||||||
pw.println(" mUserInteractionBackoffMillis=" + mUserInteractionBackoffMillis);
|
pw.println(" mUserInteractionBackoffMillis=" + mUserInteractionBackoffMillis);
|
||||||
pw.println(" mPreviousResultTime=" + mPreviousResultTime);
|
pw.println(" mPreviousResultTime=" + mPreviousResultTime);
|
||||||
pw.println(" mPreviousResultType=" + mPreviousResultType);
|
pw.println(" mPreviousResultType=" + mPreviousResultType);
|
||||||
@@ -356,6 +363,11 @@ public class FaceDownDetector implements SensorEventListener {
|
|||||||
3600_000);
|
3600_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getSensorMaxLatencyMicros() {
|
||||||
|
return mContext.getResources().getInteger(
|
||||||
|
com.android.internal.R.integer.config_flipToScreenOffMaxLatencyMicros);
|
||||||
|
}
|
||||||
|
|
||||||
private float getFloatFlagValue(String key, float defaultValue, float min, float max) {
|
private float getFloatFlagValue(String key, float defaultValue, float min, float max) {
|
||||||
final float value = DeviceConfig.getFloat(NAMESPACE_ATTENTION_MANAGER_SERVICE,
|
final float value = DeviceConfig.getFloat(NAMESPACE_ATTENTION_MANAGER_SERVICE,
|
||||||
key,
|
key,
|
||||||
@@ -416,6 +428,7 @@ public class FaceDownDetector implements SensorEventListener {
|
|||||||
mZAccelerationThreshold = getZAccelerationThreshold();
|
mZAccelerationThreshold = getZAccelerationThreshold();
|
||||||
mZAccelerationThresholdLenient = mZAccelerationThreshold + 1.0f;
|
mZAccelerationThresholdLenient = mZAccelerationThreshold + 1.0f;
|
||||||
mTimeThreshold = getTimeThreshold();
|
mTimeThreshold = getTimeThreshold();
|
||||||
|
mSensorMaxLatencyMicros = getSensorMaxLatencyMicros();
|
||||||
mUserInteractionBackoffMillis = getUserInteractionBackoffMillis();
|
mUserInteractionBackoffMillis = getUserInteractionBackoffMillis();
|
||||||
final boolean oldEnabled = mIsEnabled;
|
final boolean oldEnabled = mIsEnabled;
|
||||||
mIsEnabled = isEnabled();
|
mIsEnabled = isEnabled();
|
||||||
|
|||||||
Reference in New Issue
Block a user