aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Veit <claymore1298@gmail.com>2021-06-06 12:34:25 +0200
committerAli B <abittin@gmail.com>2021-06-10 14:01:19 +0200
commit5c4ef55a0696b2e333ba6344b507a1aafda36342 (patch)
tree1d5db8acab9de582c5d77e49585c99ccbc502d7a
parentf86e2f88be9ecfc0db0d3fce44f7149f302fc87b (diff)
PartsBin: redesign HBM behaviour
HBM is designed to switch off if screen goes off. If is activated by a sysfs node, but if it is deactivated, f.ex. by screen off - the value in sysfs node persists. It can be only re-enabled, if the sysfs node is re-written - even, if this is the same value, that currently. Also we have the issue, that format in sysfs-node can differ. To get arround this all, we just read the SETTINGS-value - not the content of sysfs node. Also on screen off KeyHandler switches the value in SETTINGS to 0. Change-Id: I4ec3b313901b6d38b8cd8a56d34c2c52f89a910a
-rw-r--r--src/com/aicp/device/HBMModeSwitch.java2
-rw-r--r--src_5kh/com/aicp/device/KeyHandler.java2
-rw-r--r--src_6kh/com/aicp/device/KeyHandler.java3
-rw-r--r--src_7kh/com/aicp/device/KeyHandler.java3
-rw-r--r--src_8kh/com/aicp/device/KeyHandler.java3
5 files changed, 9 insertions, 4 deletions
diff --git a/src/com/aicp/device/HBMModeSwitch.java b/src/com/aicp/device/HBMModeSwitch.java
index 3339635..eedc988 100644
--- a/src/com/aicp/device/HBMModeSwitch.java
+++ b/src/com/aicp/device/HBMModeSwitch.java
@@ -50,7 +50,7 @@ public class HBMModeSwitch implements OnPreferenceChangeListener {
}
public static boolean isCurrentlyEnabled(Context context) {
- return Utils.getFileValueAsBoolean(getFile(context), false);
+ return Settings.System.getInt(context.getContentResolver(), HBMModeSwitch.SETTINGS_KEY, 0)!= 0;
}
@Override
diff --git a/src_5kh/com/aicp/device/KeyHandler.java b/src_5kh/com/aicp/device/KeyHandler.java
index 6804cd7..fe7aa95 100644
--- a/src_5kh/com/aicp/device/KeyHandler.java
+++ b/src_5kh/com/aicp/device/KeyHandler.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The OmniROM Project
+* Copyright (C) 2021 Android Ice Cold Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -420,6 +421,7 @@ public class KeyHandler implements CustomKeyHandler {
private void onDisplayOff() {
if (DEBUG) Log.i(TAG, "Display off");
+ Settings.System.putInt(mContext.getContentResolver(), HBMModeSwitch.SETTINGS_KEY, 0);
if (enableProxiSensor()) {
mProxyWasNear = false;
mSensorManager.registerListener(mProximitySensor, mPocketSensor,
diff --git a/src_6kh/com/aicp/device/KeyHandler.java b/src_6kh/com/aicp/device/KeyHandler.java
index 02363f5..3673d8f 100644
--- a/src_6kh/com/aicp/device/KeyHandler.java
+++ b/src_6kh/com/aicp/device/KeyHandler.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 The OmniROM Project
-* Copyright (C) 2020 The Android Ice Cold Project
+* Copyright (C) 2021 The Android Ice Cold Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -352,6 +352,7 @@ public class KeyHandler implements CustomKeyHandler {
private void onDisplayOff() {
if (DEBUG) Log.i(TAG, "Display off");
+ Settings.System.putInt(mContext.getContentResolver(), HBMModeSwitch.SETTINGS_KEY, 0);
}
private int getSliderAction(int position) {
diff --git a/src_7kh/com/aicp/device/KeyHandler.java b/src_7kh/com/aicp/device/KeyHandler.java
index ade179b..dfbaa49 100644
--- a/src_7kh/com/aicp/device/KeyHandler.java
+++ b/src_7kh/com/aicp/device/KeyHandler.java
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2015-2016 The CyanogenMod Project
* Copyright (C) 2017 The LineageOS Project
- * Copyright (C) 2020 Android Ice Cold Project
+ * Copyright (C) 2021 Android Ice Cold Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -382,6 +382,7 @@ public class KeyHandler implements CustomKeyHandler {
private void onDisplayOff() {
if (DEBUG) Log.i(TAG, "Display off");
+ Settings.System.putInt(mContext.getContentResolver(), HBMModeSwitch.SETTINGS_KEY, 0);
}
private void launchDozePulse() {
diff --git a/src_8kh/com/aicp/device/KeyHandler.java b/src_8kh/com/aicp/device/KeyHandler.java
index ade179b..dfbaa49 100644
--- a/src_8kh/com/aicp/device/KeyHandler.java
+++ b/src_8kh/com/aicp/device/KeyHandler.java
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2015-2016 The CyanogenMod Project
* Copyright (C) 2017 The LineageOS Project
- * Copyright (C) 2020 Android Ice Cold Project
+ * Copyright (C) 2021 Android Ice Cold Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -382,6 +382,7 @@ public class KeyHandler implements CustomKeyHandler {
private void onDisplayOff() {
if (DEBUG) Log.i(TAG, "Display off");
+ Settings.System.putInt(mContext.getContentResolver(), HBMModeSwitch.SETTINGS_KEY, 0);
}
private void launchDozePulse() {