AOD: Add toggle for waking up instead of ambient display on sensors
Bug: 30876804 Test: Open SysUI tuner -> Ambient Display -> Toggle wake up on sensors setting, verify that double tap and lift wake up phone instead of triggering ambient display. Change-Id: Ia33ab1ab5ed532f239262d70e00dac3fec0330e2
This commit is contained in:
@@ -1725,6 +1725,10 @@
|
||||
not appear on production builds ever. -->
|
||||
<string name="tuner_doze" translatable="false">Ambient Display</string>
|
||||
|
||||
<!-- Ambient display, Sensors wake up device of the tuner. Non-translatable since it should
|
||||
not appear on production builds ever. -->
|
||||
<string name="tuner_doze_sensors_wake_up_fully" translatable="false">Wake up device on double tap or lift</string>
|
||||
|
||||
<!-- Ambient display always-on of the tuner. Non-translatable since it should
|
||||
not appear on production builds ever. -->
|
||||
<string name="tuner_doze_always_on" translatable="false">Always on</string>
|
||||
|
||||
@@ -143,6 +143,11 @@
|
||||
android:title="@string/tuner_doze_always_on"
|
||||
sysui:defValue="false" />
|
||||
|
||||
<com.android.systemui.tuner.TunerSwitch
|
||||
android:key="doze_sensors_wake_up_fully"
|
||||
android:title="@string/tuner_doze_sensors_wake_up_fully"
|
||||
sysui:defValue="false" />
|
||||
|
||||
</PreferenceScreen>
|
||||
-->
|
||||
|
||||
|
||||
@@ -97,7 +97,11 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
}
|
||||
|
||||
private void onSensor(int pulseReason, boolean sensorPerformedProxCheck) {
|
||||
requestPulse(pulseReason, sensorPerformedProxCheck);
|
||||
if (mDozeParameters.getSensorsWakeUpFully()) {
|
||||
mMachine.wakeUp();
|
||||
} else {
|
||||
requestPulse(pulseReason, sensorPerformedProxCheck);
|
||||
}
|
||||
|
||||
if (pulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP) {
|
||||
final long timeSinceNotification =
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.io.PrintWriter;
|
||||
|
||||
public class DozeParameters {
|
||||
private static final int MAX_DURATION = 60 * 1000;
|
||||
public static final String DOZE_SENSORS_WAKE_UP_FULLY = "doze_sensors_wake_up_fully";
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
@@ -56,6 +57,10 @@ public class DozeParameters {
|
||||
pw.print(" getPickupVibrationThreshold(): "); pw.println(getPickupVibrationThreshold());
|
||||
pw.print(" getPickupSubtypePerformsProxCheck(): ");pw.println(
|
||||
dumpPickupSubtypePerformsProxCheck());
|
||||
if (Build.IS_DEBUGGABLE) {
|
||||
pw.print(" getAlwaysOn(): "); pw.println(getAlwaysOn());
|
||||
pw.print(" getSensorsWakeUpFully(): "); pw.println(getSensorsWakeUpFully());
|
||||
}
|
||||
}
|
||||
|
||||
private String dumpPickupSubtypePerformsProxCheck() {
|
||||
@@ -118,6 +123,12 @@ public class DozeParameters {
|
||||
Settings.Secure.DOZE_ALWAYS_ON, 0, UserHandle.USER_CURRENT) != 0;
|
||||
}
|
||||
|
||||
public boolean getSensorsWakeUpFully() {
|
||||
return Build.IS_DEBUGGABLE
|
||||
&& Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||
DOZE_SENSORS_WAKE_UP_FULLY, 0, UserHandle.USER_CURRENT) != 0;
|
||||
}
|
||||
|
||||
private boolean getBoolean(String propName, int resId) {
|
||||
return SystemProperties.getBoolean(propName, mContext.getResources().getBoolean(resId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user