Loading packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -262,6 +262,9 @@ <!-- Doze: alpha to apply to small icons when dozing --> <integer name="doze_small_icon_alpha">222</integer><!-- 87% of 0xff --> <!-- Doze: whether the double tap sensor reports 2D touch coordinates --> <bool name="doze_double_tap_reports_touch_coordinates">false</bool> <!-- Hotspot tile: number of days to show after feature is used. --> <integer name="days_to_show_hotspot_tile">30</integer> Loading packages/SystemUI/src/com/android/systemui/doze/DozeHost.java +2 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,8 @@ public interface DozeHost { void setAnimateWakeup(boolean animateWakeup); void onDoubleTap(float x, float y); interface Callback { default void onNotificationHeadsUp() {} default void onPowerSaveChanged(boolean active) {} Loading packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java +21 −6 Original line number Diff line number Diff line Loading @@ -81,17 +81,18 @@ public class DozeSensors { mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION), null /* setting */, dozeParameters.getPulseOnSigMotion(), DozeLog.PULSE_REASON_SENSOR_SIGMOTION), DozeLog.PULSE_REASON_SENSOR_SIGMOTION, false /* touchCoords */), mPickupSensor = new TriggerSensor( mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE), Settings.Secure.DOZE_PULSE_ON_PICK_UP, config.pulseOnPickupAvailable(), DozeLog.PULSE_REASON_SENSOR_PICKUP), DozeLog.PULSE_REASON_SENSOR_PICKUP, false /* touchCoords */), new TriggerSensor( findSensorWithType(config.doubleTapSensorType()), Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, true /* configured */, DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP) DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP, dozeParameters.doubleTapReportsTouchCoordinates()) }; mProxSensor = new ProxSensor(); Loading Loading @@ -207,16 +208,19 @@ public class DozeSensors { final boolean mConfigured; final int mPulseReason; final String mSetting; final boolean mReportsTouchCoordinates; private boolean mRequested; private boolean mRegistered; private boolean mDisabled; public TriggerSensor(Sensor sensor, String setting, boolean configured, int pulseReason) { public TriggerSensor(Sensor sensor, String setting, boolean configured, int pulseReason, boolean reportsTouchCoordinates) { mSensor = sensor; mSetting = setting; mConfigured = configured; mPulseReason = pulseReason; mReportsTouchCoordinates = reportsTouchCoordinates; } public void setListening(boolean listen) { Loading Loading @@ -276,7 +280,13 @@ public class DozeSensors { } mRegistered = false; mCallback.onSensorPulse(mPulseReason, sensorPerformsProxCheck); float screenX = -1; float screenY = -1; if (mReportsTouchCoordinates && event.values.length >= 2) { screenX = event.values[0]; screenY = event.values[1]; } mCallback.onSensorPulse(mPulseReason, sensorPerformsProxCheck, screenX, screenY); updateListener(); // reregister, this sensor only fires once })); } Loading Loading @@ -309,7 +319,12 @@ public class DozeSensors { * Called when a sensor requests a pulse * @param pulseReason Requesting sensor, e.g. {@link DozeLog#PULSE_REASON_SENSOR_PICKUP} * @param sensorPerformedProxCheck true if the sensor already checked for FAR proximity. * @param screenX the location on the screen where the sensor fired or -1 * if the sensor doesn't support reporting screen locations. * @param screenY the location on the screen where the sensor fired or -1 * if the sensor doesn't support reporting screen locations. */ void onSensorPulse(int pulseReason, boolean sensorPerformedProxCheck); void onSensorPulse(int pulseReason, boolean sensorPerformedProxCheck, float screenX, float screenY); } } packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +3 −1 Original line number Diff line number Diff line Loading @@ -98,12 +98,14 @@ public class DozeTriggers implements DozeMachine.Part { requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */); } private void onSensor(int pulseReason, boolean sensorPerformedProxCheck) { private void onSensor(int pulseReason, boolean sensorPerformedProxCheck, float screenX, float screenY) { boolean isDoubleTap = pulseReason == DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP; boolean isPickup = pulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP; if (mConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)) { if (isDoubleTap) { mDozeHost.onDoubleTap(screenX, screenY); mMachine.wakeUp(); } else { mDozeHost.extendPulse(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java +4 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,10 @@ public class DozeParameters { return 2 * getPulseVisibleDuration(); } public boolean doubleTapReportsTouchCoordinates() { return mContext.getResources().getBoolean(R.bool.doze_double_tap_reports_touch_coordinates); } /** * Parses a spec of the form `1,2,3,!5,*`. The resulting object will match numbers that are Loading Loading
packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -262,6 +262,9 @@ <!-- Doze: alpha to apply to small icons when dozing --> <integer name="doze_small_icon_alpha">222</integer><!-- 87% of 0xff --> <!-- Doze: whether the double tap sensor reports 2D touch coordinates --> <bool name="doze_double_tap_reports_touch_coordinates">false</bool> <!-- Hotspot tile: number of days to show after feature is used. --> <integer name="days_to_show_hotspot_tile">30</integer> Loading
packages/SystemUI/src/com/android/systemui/doze/DozeHost.java +2 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,8 @@ public interface DozeHost { void setAnimateWakeup(boolean animateWakeup); void onDoubleTap(float x, float y); interface Callback { default void onNotificationHeadsUp() {} default void onPowerSaveChanged(boolean active) {} Loading
packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java +21 −6 Original line number Diff line number Diff line Loading @@ -81,17 +81,18 @@ public class DozeSensors { mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION), null /* setting */, dozeParameters.getPulseOnSigMotion(), DozeLog.PULSE_REASON_SENSOR_SIGMOTION), DozeLog.PULSE_REASON_SENSOR_SIGMOTION, false /* touchCoords */), mPickupSensor = new TriggerSensor( mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE), Settings.Secure.DOZE_PULSE_ON_PICK_UP, config.pulseOnPickupAvailable(), DozeLog.PULSE_REASON_SENSOR_PICKUP), DozeLog.PULSE_REASON_SENSOR_PICKUP, false /* touchCoords */), new TriggerSensor( findSensorWithType(config.doubleTapSensorType()), Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, true /* configured */, DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP) DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP, dozeParameters.doubleTapReportsTouchCoordinates()) }; mProxSensor = new ProxSensor(); Loading Loading @@ -207,16 +208,19 @@ public class DozeSensors { final boolean mConfigured; final int mPulseReason; final String mSetting; final boolean mReportsTouchCoordinates; private boolean mRequested; private boolean mRegistered; private boolean mDisabled; public TriggerSensor(Sensor sensor, String setting, boolean configured, int pulseReason) { public TriggerSensor(Sensor sensor, String setting, boolean configured, int pulseReason, boolean reportsTouchCoordinates) { mSensor = sensor; mSetting = setting; mConfigured = configured; mPulseReason = pulseReason; mReportsTouchCoordinates = reportsTouchCoordinates; } public void setListening(boolean listen) { Loading Loading @@ -276,7 +280,13 @@ public class DozeSensors { } mRegistered = false; mCallback.onSensorPulse(mPulseReason, sensorPerformsProxCheck); float screenX = -1; float screenY = -1; if (mReportsTouchCoordinates && event.values.length >= 2) { screenX = event.values[0]; screenY = event.values[1]; } mCallback.onSensorPulse(mPulseReason, sensorPerformsProxCheck, screenX, screenY); updateListener(); // reregister, this sensor only fires once })); } Loading Loading @@ -309,7 +319,12 @@ public class DozeSensors { * Called when a sensor requests a pulse * @param pulseReason Requesting sensor, e.g. {@link DozeLog#PULSE_REASON_SENSOR_PICKUP} * @param sensorPerformedProxCheck true if the sensor already checked for FAR proximity. * @param screenX the location on the screen where the sensor fired or -1 * if the sensor doesn't support reporting screen locations. * @param screenY the location on the screen where the sensor fired or -1 * if the sensor doesn't support reporting screen locations. */ void onSensorPulse(int pulseReason, boolean sensorPerformedProxCheck); void onSensorPulse(int pulseReason, boolean sensorPerformedProxCheck, float screenX, float screenY); } }
packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +3 −1 Original line number Diff line number Diff line Loading @@ -98,12 +98,14 @@ public class DozeTriggers implements DozeMachine.Part { requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */); } private void onSensor(int pulseReason, boolean sensorPerformedProxCheck) { private void onSensor(int pulseReason, boolean sensorPerformedProxCheck, float screenX, float screenY) { boolean isDoubleTap = pulseReason == DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP; boolean isPickup = pulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP; if (mConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)) { if (isDoubleTap) { mDozeHost.onDoubleTap(screenX, screenY); mMachine.wakeUp(); } else { mDozeHost.extendPulse(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java +4 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,10 @@ public class DozeParameters { return 2 * getPulseVisibleDuration(); } public boolean doubleTapReportsTouchCoordinates() { return mContext.getResources().getBoolean(R.bool.doze_double_tap_reports_touch_coordinates); } /** * Parses a spec of the form `1,2,3,!5,*`. The resulting object will match numbers that are Loading