sm6150-common: parts: Enable doze_status on screen off
* This allows to enter the doze state faster when unlocking from lockscreen Change-Id: I1900436c974a605555275ef67b283ead2cf720b5
This commit is contained in:
parent
dd8b25b294
commit
10f101e143
@ -72,6 +72,9 @@ public class DozeService extends Service {
|
||||
private void onDisplayOn() {
|
||||
if (DEBUG)
|
||||
Log.d(TAG, "Display on");
|
||||
if (DozeUtils.isAlwaysOnEnabled(this)) {
|
||||
DozeUtils.setDozeStatus(DozeUtils.DOZE_STATUS_DISABLED);
|
||||
}
|
||||
if (DozeUtils.isPickUpEnabled(this)) {
|
||||
mPickupSensor.disable();
|
||||
}
|
||||
@ -86,6 +89,9 @@ public class DozeService extends Service {
|
||||
private void onDisplayOff() {
|
||||
if (DEBUG)
|
||||
Log.d(TAG, "Display off");
|
||||
if (DozeUtils.isAlwaysOnEnabled(this)) {
|
||||
DozeUtils.setDozeStatus(DozeUtils.DOZE_STATUS_ENABLED);
|
||||
}
|
||||
if (DozeUtils.isPickUpEnabled(this)) {
|
||||
mPickupSensor.enable();
|
||||
}
|
||||
|
@ -58,6 +58,11 @@ public final class DozeUtils {
|
||||
protected static final String DOZE_MODE_HBM = "1";
|
||||
protected static final String DOZE_MODE_LBM = "0";
|
||||
|
||||
private static final String DOZE_STATUS_PATH =
|
||||
"/sys/devices/platform/soc/soc:qcom,dsi-display/doze_status";
|
||||
protected static final String DOZE_STATUS_ENABLED = "1";
|
||||
protected static final String DOZE_STATUS_DISABLED = "0";
|
||||
|
||||
protected static final String DOZE_BRIGHTNESS_LBM = "0";
|
||||
protected static final String DOZE_BRIGHTNESS_HBM = "1";
|
||||
protected static final String DOZE_BRIGHTNESS_DARK = "2";
|
||||
@ -80,9 +85,7 @@ public final class DozeUtils {
|
||||
}
|
||||
|
||||
public static void checkDozeService(Context context) {
|
||||
if (isDozeEnabled(context)
|
||||
&& (!isAlwaysOnEnabled(context) || isDozeAutoBrightnessEnabled(context))
|
||||
&& sensorsEnabled(context)) {
|
||||
if (isDozeEnabled(context) && (isAlwaysOnEnabled(context) || sensorsEnabled(context))) {
|
||||
startService(context);
|
||||
} else {
|
||||
stopService(context);
|
||||
@ -149,6 +152,10 @@ public final class DozeUtils {
|
||||
return FileUtils.writeLine(DOZE_MODE_PATH, value);
|
||||
}
|
||||
|
||||
protected static boolean setDozeStatus(String value) {
|
||||
return FileUtils.writeLine(DOZE_STATUS_PATH, value);
|
||||
}
|
||||
|
||||
protected static boolean isDozeAutoBrightnessEnabled(Context context) {
|
||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getString(DOZE_BRIGHTNESS_KEY, DOZE_BRIGHTNESS_LBM)
|
||||
|
@ -82,7 +82,9 @@ on boot
|
||||
|
||||
# Set doze mode permissions
|
||||
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display/doze_mode
|
||||
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display/doze_status
|
||||
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display/doze_mode
|
||||
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display/doze_status
|
||||
|
||||
on property:sys.boot_completed=1
|
||||
# Set allocstall_threshold to 0
|
||||
|
1
sepolicy/vendor/file_contexts
vendored
1
sepolicy/vendor/file_contexts
vendored
@ -9,6 +9,7 @@
|
||||
/sys/devices/platform/soc/soc:qcom,dsi-display/dc_enable u:object_r:sysfs_anti_flicker:s0
|
||||
/sys/devices/platform/soc/soc:qcom,dsi-display/hbm u:object_r:sysfs_hbm:s0
|
||||
/sys/devices/platform/soc/soc:qcom,dsi-display/doze_mode u:object_r:sysfs_doze:s0
|
||||
/sys/devices/platform/soc/soc:qcom,dsi-display/doze_status u:object_r:sysfs_doze:s0
|
||||
|
||||
# Fingerprint
|
||||
/dev/goodix_fp u:object_r:fingerprint_device:s0
|
||||
|
Loading…
Reference in New Issue
Block a user