From 6878b6780a2030f16c9c72d92d7396bfd305ed22 Mon Sep 17 00:00:00 2001 From: Moyster Date: Mon, 24 Oct 2016 13:38:00 +0200 Subject: add Display Color Calibration cmhw --- .../hardware/DisplayColorCalibration.java | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java diff --git a/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java b/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java new file mode 100644 index 0000000..11d3ce1 --- /dev/null +++ b/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2016 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.cyanogenmod.hardware; + +import java.io.File; +import java.util.Scanner; +import org.cyanogenmod.hardware.util.FileUtils; + +public class DisplayColorCalibration { + private static final String COLOR_FILE = "/sys/devices/platform/mtk_disp_mgr.0/rgb"; + + public static boolean isSupported() { + File f = new File(COLOR_FILE); + return f.exists(); + } + + public static int getMaxValue() { + return 2000; + } + + public static int getMinValue() { + return 0; + } + + public static int getDefValue() { + return getMaxValue(); + } + + public static String getCurColors() { + return FileUtils.readOneLine(COLOR_FILE); + } + + public static boolean setColors(String colors) { + return FileUtils.writeLine(COLOR_FILE, colors); + } +} -- cgit v1.2.3