sdm660-common: Parts: Calculate expotenial LED Brightness slider values

* Fix Max Brightness

Change-Id: I682704271204046e3a175673b4e283896fe7e7aa
This commit is contained in:
Max Weffers 2020-06-18 10:40:53 +02:00 committed by OdSazib
parent 56e1c00575
commit 05390da390
No known key found for this signature in database
GPG key ID: A2D2E5C18BB04462
2 changed files with 8 additions and 4 deletions

View file

@ -23,6 +23,8 @@ import android.provider.Settings;
import org.lineageos.settings.device.kcal.Utils;
import java.lang.Math.*;
public class BootReceiver extends BroadcastReceiver implements Utils {
public void onReceive(Context context, Intent intent) {
@ -53,8 +55,8 @@ public class BootReceiver extends BroadcastReceiver implements Utils {
PREF_HUE, HUE_DEFAULT));
}
FileUtils.setValue(DeviceSettings.NOTIF_LED_PATH, Settings.Secure.getInt(
context.getContentResolver(), DeviceSettings.PREF_NOTIF_LED, 100) / 100.0 * (DeviceSettings.MAX_LED - DeviceSettings.MIN_LED) + DeviceSettings.MIN_LED);
FileUtils.setValue(DeviceSettings.NOTIF_LED_PATH,(1 + Math.pow(1.05694, Settings.Secure.getInt(
context.getContentResolver(), DeviceSettings.PREF_NOTIF_LED, 100))));
FileUtils.setValue(DeviceSettings.VIBRATION_STRENGTH_PATH, Settings.Secure.getInt(
context.getContentResolver(), DeviceSettings.PREF_VIBRATION_STRENGTH, 80) / 100.0 * (DeviceSettings.MAX_VIBRATION - DeviceSettings.MIN_VIBRATION) + DeviceSettings.MIN_VIBRATION);
FileUtils.setValue(DeviceSettings.THERMAL_PATH, Settings.Secure.getString(

View file

@ -29,6 +29,8 @@ import org.lineageos.settings.device.preferences.SecureSettingSwitchPreference;
import org.lineageos.settings.device.preferences.VibrationSeekBarPreference;
import org.lineageos.settings.device.preferences.NotificationLedSeekBarPreference;
import java.lang.Math.*;
public class DeviceSettings extends PreferenceFragment implements
Preference.OnPreferenceChangeListener {
@ -45,7 +47,7 @@ public class DeviceSettings extends PreferenceFragment implements
public static final int MAX_VIBRATION = 3596;
public static final int MIN_LED = 1;
public static final int MAX_LED = 64;
public static final int MAX_LED = 255;
private static final String CATEGORY_DISPLAY = "display";
private static final String PREF_DEVICE_DOZE = "device_doze";
@ -145,7 +147,7 @@ public class DeviceSettings extends PreferenceFragment implements
final String key = preference.getKey();
switch (key) {
case PREF_NOTIF_LED:
FileUtils.setValue(NOTIF_LED_PATH, (int) value / 100.0 * (MAX_LED - MIN_LED) + MIN_LED);
FileUtils.setValue(NOTIF_LED_PATH, (1 + Math.pow(1.05694, (int) value )));
break;
case PREF_VIBRATION_STRENGTH: