Loading core/java/android/hardware/display/AmbientDisplayConfiguration.java +5 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import java.util.Arrays; import com.android.internal.R; /** Loading Loading @@ -258,10 +260,11 @@ public class AmbientDisplayConfiguration { String defaultValue, int posture) { String sensorType = defaultValue; if (posture < postureMapping.length) { if (postureMapping != null && posture < postureMapping.length) { sensorType = postureMapping[posture]; } else { Log.e(TAG, "Unsupported doze posture " + posture); Log.e(TAG, "Unsupported doze posture " + posture + " postureMapping=" + Arrays.toString(postureMapping)); } return TextUtils.isEmpty(sensorType) ? defaultValue : sensorType; Loading packages/SystemUI/res/values/config.xml +21 −4 Original line number Diff line number Diff line Loading @@ -224,15 +224,23 @@ display brightness, suitable to listen to while the device is asleep (e.g. during always-on display) --> <string-array name="doze_brightness_sensor_name_posture_mapping" translatable="false"> <item></item> <!-- UNKNOWN --> <item></item> <!-- CLOSED --> <item></item> <!-- HALF_OPENED --> <item></item> <!-- OPENED --> <!-- UNKNOWN --> <!-- CLOSED --> <!-- HALF_OPENED --> <!-- OPENED --> </string-array> <!-- Override value to use for proximity sensor. --> <string name="proximity_sensor_type" translatable="false"></string> <!-- Sensor type per posture state to use for proximity sensor --> <string-array name="proximity_sensor_posture_mapping" translatable="false"> <!-- UNKNOWN --> <!-- CLOSED --> <!-- HALF_OPENED --> <!-- OPENED --> </string-array> <!-- If using proximity_sensor_type, specifies a threshold value to distinguish near and far break points. A sensor value less than this is considered "near". --> <item name="proximity_sensor_threshold" translatable="false" format="float" type="dimen"></item> Loading @@ -246,6 +254,15 @@ <!-- Override value to use for proximity sensor as confirmation for proximity_sensor_type. --> <string name="proximity_sensor_secondary_type" translatable="false"></string> <!-- Sensor type per posture state to use for proximity sensor as a confirmation for proximity_sensor_type. --> <string-array name="proximity_sensor_secondary_posture_mapping" translatable="false"> <!-- UNKNOWN --> <!-- CLOSED --> <!-- HALF_OPENED --> <!-- OPENED --> </string-array> <!-- If using proximity_sensor_secondary_type, specifies a threshold value to distinguish near and far break points. A sensor value less than this is considered "near". --> <item name="proximity_sensor_secondary_threshold" translatable="false" format="float" Loading packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorImpl.java +4 −3 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.sensors.ProximitySensor; import com.android.systemui.util.sensors.ThresholdSensor; import com.android.systemui.util.sensors.ThresholdSensorEvent; import com.android.systemui.util.time.SystemClock; import java.util.Collections; Loading Loading @@ -405,7 +406,7 @@ class FalsingCollectorImpl implements FalsingCollector { mProximitySensor.unregister(mSensorEventListener); } private void onProximityEvent(ThresholdSensor.ThresholdSensorEvent proximityEvent) { private void onProximityEvent(ThresholdSensorEvent proximityEvent) { // TODO: some of these classifiers might allow us to abort early, meaning we don't have to // make these calls. mFalsingManager.onProximityEvent(new ProximityEventImpl(proximityEvent)); Loading @@ -423,9 +424,9 @@ class FalsingCollectorImpl implements FalsingCollector { } private static class ProximityEventImpl implements FalsingManager.ProximityEvent { private ThresholdSensor.ThresholdSensorEvent mThresholdSensorEvent; private ThresholdSensorEvent mThresholdSensorEvent; ProximityEventImpl(ThresholdSensor.ThresholdSensorEvent thresholdSensorEvent) { ProximityEventImpl(ThresholdSensorEvent thresholdSensorEvent) { mThresholdSensorEvent = thresholdSensorEvent; } @Override Loading packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +4 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.Assert; import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.sensors.AsyncSensorManager; import com.android.systemui.util.sensors.ProximityCheck; import com.android.systemui.util.sensors.ProximitySensor; import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.wakelock.WakeLock; Loading Loading @@ -90,7 +91,7 @@ public class DozeTriggers implements DozeMachine.Part { private final TriggerReceiver mBroadcastReceiver = new TriggerReceiver(); private final DockEventListener mDockEventListener = new DockEventListener(); private final DockManager mDockManager; private final ProximitySensor.ProximityCheck mProxCheck; private final ProximityCheck mProxCheck; private final BroadcastDispatcher mBroadcastDispatcher; private final AuthController mAuthController; private final DelayableExecutor mMainExecutor; Loading Loading @@ -181,7 +182,8 @@ public class DozeTriggers implements DozeMachine.Part { AmbientDisplayConfiguration config, DozeParameters dozeParameters, AsyncSensorManager sensorManager, WakeLock wakeLock, DockManager dockManager, ProximitySensor proximitySensor, ProximitySensor.ProximityCheck proxCheck, ProximitySensor proximitySensor, ProximityCheck proxCheck, DozeLog dozeLog, BroadcastDispatcher broadcastDispatcher, SecureSettings secureSettings, AuthController authController, @Main DelayableExecutor mainExecutor, Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/DevicePostureController.java +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ public interface DevicePostureController extends CallbackController<Callback> { int DEVICE_POSTURE_HALF_OPENED = 2; int DEVICE_POSTURE_OPENED = 3; int DEVICE_POSTURE_FLIPPED = 4; int SUPPORTED_POSTURES_SIZE = DEVICE_POSTURE_FLIPPED + 1; /** Return the current device posture. */ @DevicePostureInt int getDevicePosture(); Loading Loading
core/java/android/hardware/display/AmbientDisplayConfiguration.java +5 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import java.util.Arrays; import com.android.internal.R; /** Loading Loading @@ -258,10 +260,11 @@ public class AmbientDisplayConfiguration { String defaultValue, int posture) { String sensorType = defaultValue; if (posture < postureMapping.length) { if (postureMapping != null && posture < postureMapping.length) { sensorType = postureMapping[posture]; } else { Log.e(TAG, "Unsupported doze posture " + posture); Log.e(TAG, "Unsupported doze posture " + posture + " postureMapping=" + Arrays.toString(postureMapping)); } return TextUtils.isEmpty(sensorType) ? defaultValue : sensorType; Loading
packages/SystemUI/res/values/config.xml +21 −4 Original line number Diff line number Diff line Loading @@ -224,15 +224,23 @@ display brightness, suitable to listen to while the device is asleep (e.g. during always-on display) --> <string-array name="doze_brightness_sensor_name_posture_mapping" translatable="false"> <item></item> <!-- UNKNOWN --> <item></item> <!-- CLOSED --> <item></item> <!-- HALF_OPENED --> <item></item> <!-- OPENED --> <!-- UNKNOWN --> <!-- CLOSED --> <!-- HALF_OPENED --> <!-- OPENED --> </string-array> <!-- Override value to use for proximity sensor. --> <string name="proximity_sensor_type" translatable="false"></string> <!-- Sensor type per posture state to use for proximity sensor --> <string-array name="proximity_sensor_posture_mapping" translatable="false"> <!-- UNKNOWN --> <!-- CLOSED --> <!-- HALF_OPENED --> <!-- OPENED --> </string-array> <!-- If using proximity_sensor_type, specifies a threshold value to distinguish near and far break points. A sensor value less than this is considered "near". --> <item name="proximity_sensor_threshold" translatable="false" format="float" type="dimen"></item> Loading @@ -246,6 +254,15 @@ <!-- Override value to use for proximity sensor as confirmation for proximity_sensor_type. --> <string name="proximity_sensor_secondary_type" translatable="false"></string> <!-- Sensor type per posture state to use for proximity sensor as a confirmation for proximity_sensor_type. --> <string-array name="proximity_sensor_secondary_posture_mapping" translatable="false"> <!-- UNKNOWN --> <!-- CLOSED --> <!-- HALF_OPENED --> <!-- OPENED --> </string-array> <!-- If using proximity_sensor_secondary_type, specifies a threshold value to distinguish near and far break points. A sensor value less than this is considered "near". --> <item name="proximity_sensor_secondary_threshold" translatable="false" format="float" Loading
packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorImpl.java +4 −3 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.sensors.ProximitySensor; import com.android.systemui.util.sensors.ThresholdSensor; import com.android.systemui.util.sensors.ThresholdSensorEvent; import com.android.systemui.util.time.SystemClock; import java.util.Collections; Loading Loading @@ -405,7 +406,7 @@ class FalsingCollectorImpl implements FalsingCollector { mProximitySensor.unregister(mSensorEventListener); } private void onProximityEvent(ThresholdSensor.ThresholdSensorEvent proximityEvent) { private void onProximityEvent(ThresholdSensorEvent proximityEvent) { // TODO: some of these classifiers might allow us to abort early, meaning we don't have to // make these calls. mFalsingManager.onProximityEvent(new ProximityEventImpl(proximityEvent)); Loading @@ -423,9 +424,9 @@ class FalsingCollectorImpl implements FalsingCollector { } private static class ProximityEventImpl implements FalsingManager.ProximityEvent { private ThresholdSensor.ThresholdSensorEvent mThresholdSensorEvent; private ThresholdSensorEvent mThresholdSensorEvent; ProximityEventImpl(ThresholdSensor.ThresholdSensorEvent thresholdSensorEvent) { ProximityEventImpl(ThresholdSensorEvent thresholdSensorEvent) { mThresholdSensorEvent = thresholdSensorEvent; } @Override Loading
packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +4 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.Assert; import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.sensors.AsyncSensorManager; import com.android.systemui.util.sensors.ProximityCheck; import com.android.systemui.util.sensors.ProximitySensor; import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.wakelock.WakeLock; Loading Loading @@ -90,7 +91,7 @@ public class DozeTriggers implements DozeMachine.Part { private final TriggerReceiver mBroadcastReceiver = new TriggerReceiver(); private final DockEventListener mDockEventListener = new DockEventListener(); private final DockManager mDockManager; private final ProximitySensor.ProximityCheck mProxCheck; private final ProximityCheck mProxCheck; private final BroadcastDispatcher mBroadcastDispatcher; private final AuthController mAuthController; private final DelayableExecutor mMainExecutor; Loading Loading @@ -181,7 +182,8 @@ public class DozeTriggers implements DozeMachine.Part { AmbientDisplayConfiguration config, DozeParameters dozeParameters, AsyncSensorManager sensorManager, WakeLock wakeLock, DockManager dockManager, ProximitySensor proximitySensor, ProximitySensor.ProximityCheck proxCheck, ProximitySensor proximitySensor, ProximityCheck proxCheck, DozeLog dozeLog, BroadcastDispatcher broadcastDispatcher, SecureSettings secureSettings, AuthController authController, @Main DelayableExecutor mainExecutor, Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/DevicePostureController.java +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ public interface DevicePostureController extends CallbackController<Callback> { int DEVICE_POSTURE_HALF_OPENED = 2; int DEVICE_POSTURE_OPENED = 3; int DEVICE_POSTURE_FLIPPED = 4; int SUPPORTED_POSTURES_SIZE = DEVICE_POSTURE_FLIPPED + 1; /** Return the current device posture. */ @DevicePostureInt int getDevicePosture(); Loading