diff --git a/core/java/android/hardware/display/AmbientDisplayConfiguration.java b/core/java/android/hardware/display/AmbientDisplayConfiguration.java
index a1f7aa12264b9..f2c294ad83910 100644
--- a/core/java/android/hardware/display/AmbientDisplayConfiguration.java
+++ b/core/java/android/hardware/display/AmbientDisplayConfiguration.java
@@ -22,6 +22,7 @@ import android.os.Build;
import android.os.SystemProperties;
import android.provider.Settings;
import android.text.TextUtils;
+import android.util.Log;
import com.android.internal.R;
@@ -32,7 +33,7 @@ import com.android.internal.R;
*/
@TestApi
public class AmbientDisplayConfiguration {
-
+ private static final String TAG = "AmbientDisplayConfig";
private final Context mContext;
private final boolean mAlwaysOnByDefault;
@@ -141,10 +142,19 @@ public class AmbientDisplayConfiguration {
}
/** {@hide} */
- public String tapSensorType() {
+ private String tapSensorType() {
return mContext.getResources().getString(R.string.config_dozeTapSensorType);
}
+ /** {@hide} */
+ public String tapSensorType(int posture) {
+ return getSensorTypeForPosture(
+ mContext.getResources().getStringArray(R.array.config_dozeTapSensorPostureMapping),
+ tapSensorType(),
+ posture
+ );
+ }
+
/** {@hide} */
public String longPressSensorType() {
return mContext.getResources().getString(R.string.config_dozeLongPressSensorType);
@@ -241,4 +251,18 @@ public class AmbientDisplayConfiguration {
private boolean boolSetting(String name, int user, int def) {
return Settings.Secure.getIntForUser(mContext.getContentResolver(), name, def, user) != 0;
}
+
+ private String getSensorTypeForPosture(
+ String[] postureMapping,
+ String defaultSensorType,
+ int posture) {
+ String sensorType = defaultSensorType;
+ if (posture < postureMapping.length) {
+ sensorType = postureMapping[posture];
+ } else {
+ Log.e(TAG, "Unsupported doze posture " + posture);
+ }
+
+ return TextUtils.isEmpty(sensorType) ? defaultSensorType : sensorType;
+ }
}
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 689d75b9cfeab..4596e96ab3cde 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2323,6 +2323,15 @@
+
+
+
+
+
+
+
+
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 4e8d915ca295e..7af6b7181c573 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3255,6 +3255,7 @@
+
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 5e495f0cd1a68..fd2b0e0845fb3 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -191,6 +191,15 @@
low powered state yet. -->
true
+
+
+ - 1
+ - 1
+ - 1
+ - 1
+
+