Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1792,6 +1792,9 @@ <!-- Boolean indicating if placing the phone face down will result in a screen off. --> <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 use cases --> <bool name="config_bluetooth_sco_off_call">true</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ <java-symbol type="bool" name="config_avoidGfxAccel" /> <java-symbol type="bool" name="config_bluetooth_address_validation" /> <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_le_peripheral_mode_supported" /> <java-symbol type="bool" name="config_bluetooth_hfp_inband_ringing_support" /> Loading services/core/java/com/android/server/power/FaceDownDetector.java +14 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ public class FaceDownDetector implements SensorEventListener { private boolean mIsEnabled; private int mSensorMaxLatencyMicros; /** * DeviceConfig flag name, determines how long to disable sensor when user interacts while * device is flipped. Loading Loading @@ -202,7 +204,11 @@ public class FaceDownDetector implements SensorEventListener { if (mActive != shouldBeActive) { if (shouldBeActive) { mSensorManager.registerListener( this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL, mSensorMaxLatencyMicros ); if (mPreviousResultType == SCREEN_OFF_RESULT) { logScreenOff(); } Loading @@ -226,6 +232,7 @@ public class FaceDownDetector implements SensorEventListener { pw.println(" mFaceDown=" + mFaceDown); pw.println(" mActive=" + mActive); pw.println(" mLastFlipTime=" + mLastFlipTime); pw.println(" mSensorMaxLatencyMicros=" + mSensorMaxLatencyMicros); pw.println(" mUserInteractionBackoffMillis=" + mUserInteractionBackoffMillis); pw.println(" mPreviousResultTime=" + mPreviousResultTime); pw.println(" mPreviousResultType=" + mPreviousResultType); Loading Loading @@ -356,6 +363,11 @@ public class FaceDownDetector implements SensorEventListener { 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) { final float value = DeviceConfig.getFloat(NAMESPACE_ATTENTION_MANAGER_SERVICE, key, Loading Loading @@ -416,6 +428,7 @@ public class FaceDownDetector implements SensorEventListener { mZAccelerationThreshold = getZAccelerationThreshold(); mZAccelerationThresholdLenient = mZAccelerationThreshold + 1.0f; mTimeThreshold = getTimeThreshold(); mSensorMaxLatencyMicros = getSensorMaxLatencyMicros(); mUserInteractionBackoffMillis = getUserInteractionBackoffMillis(); final boolean oldEnabled = mIsEnabled; mIsEnabled = isEnabled(); Loading Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1792,6 +1792,9 @@ <!-- Boolean indicating if placing the phone face down will result in a screen off. --> <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 use cases --> <bool name="config_bluetooth_sco_off_call">true</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ <java-symbol type="bool" name="config_avoidGfxAccel" /> <java-symbol type="bool" name="config_bluetooth_address_validation" /> <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_le_peripheral_mode_supported" /> <java-symbol type="bool" name="config_bluetooth_hfp_inband_ringing_support" /> Loading
services/core/java/com/android/server/power/FaceDownDetector.java +14 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ public class FaceDownDetector implements SensorEventListener { private boolean mIsEnabled; private int mSensorMaxLatencyMicros; /** * DeviceConfig flag name, determines how long to disable sensor when user interacts while * device is flipped. Loading Loading @@ -202,7 +204,11 @@ public class FaceDownDetector implements SensorEventListener { if (mActive != shouldBeActive) { if (shouldBeActive) { mSensorManager.registerListener( this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL, mSensorMaxLatencyMicros ); if (mPreviousResultType == SCREEN_OFF_RESULT) { logScreenOff(); } Loading @@ -226,6 +232,7 @@ public class FaceDownDetector implements SensorEventListener { pw.println(" mFaceDown=" + mFaceDown); pw.println(" mActive=" + mActive); pw.println(" mLastFlipTime=" + mLastFlipTime); pw.println(" mSensorMaxLatencyMicros=" + mSensorMaxLatencyMicros); pw.println(" mUserInteractionBackoffMillis=" + mUserInteractionBackoffMillis); pw.println(" mPreviousResultTime=" + mPreviousResultTime); pw.println(" mPreviousResultType=" + mPreviousResultType); Loading Loading @@ -356,6 +363,11 @@ public class FaceDownDetector implements SensorEventListener { 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) { final float value = DeviceConfig.getFloat(NAMESPACE_ATTENTION_MANAGER_SERVICE, key, Loading Loading @@ -416,6 +428,7 @@ public class FaceDownDetector implements SensorEventListener { mZAccelerationThreshold = getZAccelerationThreshold(); mZAccelerationThresholdLenient = mZAccelerationThreshold + 1.0f; mTimeThreshold = getTimeThreshold(); mSensorMaxLatencyMicros = getSensorMaxLatencyMicros(); mUserInteractionBackoffMillis = getUserInteractionBackoffMillis(); final boolean oldEnabled = mIsEnabled; mIsEnabled = isEnabled(); Loading