From 86861b696b0de26fa2188f6844cef32aa0d00d06 Mon Sep 17 00:00:00 2001 From: Simone Esposito <31246543+DarkJoker360@users.noreply.github.com> Date: Fri, 25 May 2018 22:01:52 +0200 Subject: [PATCH] cmhw: using common display calibration This commit Fix Live Display and Color Calibration under display settings --- .../hardware/DisplayColorCalibration.java | 94 ------------------- 1 file changed, 94 deletions(-) delete mode 100644 cmhw/org/lineageos/hardware/DisplayColorCalibration.java diff --git a/cmhw/org/lineageos/hardware/DisplayColorCalibration.java b/cmhw/org/lineageos/hardware/DisplayColorCalibration.java deleted file mode 100644 index 352c76c..0000000 --- a/cmhw/org/lineageos/hardware/DisplayColorCalibration.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2014 The CyanogenMod Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.hardware; - -import org.lineageos.internal.util.FileUtils; - -/* - * Display RGB intensity calibration (kcal) - * - * Exports methods to get the valid value boundaries, the - * current color values, and a method to set new ones. - * - * Values exported by min/max can be the direct values required - * by the hardware, or a local (to DisplayColorCalibration) abstraction - * that's internally converted to something else prior to actual use. The - * Settings user interface will normalize these into a 0-100 (percentage) - * scale before showing them to the user, but all values passed to/from - * the client (Settings) are in this class' scale. - */ - -public class DisplayColorCalibration { - private static final String COLOR_FILE = "/sys/class/graphics/fb0/kcal"; - - /* - * All HAF classes should export this boolean. - * Real implementations must, of course, return true - */ - - public static boolean isSupported() { - return FileUtils.isFileWritable(COLOR_FILE); - } - - /* - * What's the maximum integer value we take for a color - */ - - public static int getMaxValue() { - return 255; - } - - /* - * What's the minimum integer value we take for a color - */ - - public static int getMinValue() { - return 0; - } - - /* - * What's the default integer value we take for a color - */ - - public static int getDefValue() { - return getMaxValue(); - } - - /* - * What's the current RGB triplet? - * This should return a space-separated set of integers in - * a string, same format as the input to setColors() - */ - - public static String getCurColors() { - return FileUtils.readOneLine(COLOR_FILE); - } - - /* - * Set the RGB values to the given input triplet. Input is - * expected to consist of 3 values, space-separated, each to - * be a value between the boundaries set by get(Max|Min)Value - * (see below), and it's meant to be locally interpreted/used. - */ - - public static boolean setColors(String colors) { - if (!FileUtils.writeLine(COLOR_FILE, colors)) { - return false; - } - return true; - } -}