From 17636d5e1534f025e9d81b6d9afb6d337c115a96 Mon Sep 17 00:00:00 2001 From: Jan Altensen Date: Tue, 29 Jan 2019 12:07:11 +0100 Subject: [PATCH] universal7580: remove unused lineagehw impls Change-Id: Id6a187043bc09bb3abd352d5994c59afff440952 universal7580: remove no longer needed JAVA_SOURCE_OVERLAYS flag Change-Id: Idd5d18379c8b20ddd3a6d3ff50130b47917c152a --- BoardConfigCommon.mk | 5 - .../hardware/DisplayColorCalibration.java | 150 ------------------ .../org/lineageos/hardware/KeyDisabler.java | 46 ------ .../hardware/SunlightEnhancement.java | 88 ---------- 4 files changed, 289 deletions(-) delete mode 100644 lineagehw/src/org/lineageos/hardware/DisplayColorCalibration.java delete mode 100644 lineagehw/src/org/lineageos/hardware/KeyDisabler.java delete mode 100644 lineagehw/src/org/lineageos/hardware/SunlightEnhancement.java diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index f44e377..d4c9d54 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -166,11 +166,6 @@ BOARD_HAVE_BLUETOOTH := true BOARD_HAVE_BLUETOOTH_BCM := true BOARD_HAVE_SAMSUNG_BLUETOOTH := true -# Lineage Hardware -JAVA_SOURCE_OVERLAYS := \ - org.lineageos.hardware|hardware/samsung/lineagehw|**/*.java \ - org.lineageos.hardware|$(LOCAL_PATH)/lineagehw|**/*.java - # Backlight BACKLIGHT_PATH := "/sys/class/backlight/panel/brightness" diff --git a/lineagehw/src/org/lineageos/hardware/DisplayColorCalibration.java b/lineagehw/src/org/lineageos/hardware/DisplayColorCalibration.java deleted file mode 100644 index b950960..0000000 --- a/lineagehw/src/org/lineageos/hardware/DisplayColorCalibration.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2017 The LineageOS 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 android.os.IBinder; -import android.os.Parcel; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.os.SystemProperties; -import android.util.Slog; - -import org.lineageos.internal.util.FileUtils; - -public class DisplayColorCalibration { - - private static final String TAG = "DisplayColorCalibration"; - - private static final String RGB_FILE = "/sys/class/mdnie/mdnie/sensorRGB"; - - private static final boolean sUseGPUMode; - - private static final int MIN = 1; - private static final int MAX = 255; - - private static final int[] sCurColors = new int[] { MAX, MAX, MAX }; - - static { - // We can also support GPU transform using RenderEngine. This is not - // preferred though, as it has a high power cost. - sUseGPUMode = SystemProperties.getBoolean("debug.livedisplay.force_gpu", false); - } - - public static boolean isSupported() { - if (!FileUtils.isFileWritable(RGB_FILE) && !sUseGPUMode) { - return false; - } - - return true; - } - - public static int getMaxValue() { - return MAX; - } - - public static int getMinValue() { - return MIN; - } - - public static int getDefValue() { - return getMaxValue(); - } - - public static String getCurColors() { - if (!sUseGPUMode) { - return FileUtils.readOneLine(RGB_FILE); - } - - return String.format("%d %d %d", sCurColors[0], - sCurColors[1], sCurColors[2]); - } - - public static boolean setColors(String colors) { - if (!sUseGPUMode) { - return FileUtils.writeLine(RGB_FILE, colors); - } - - float[] mat = toColorMatrix(colors); - - // set to null if identity - if (mat == null || - (mat[0] == 1.0f && mat[5] == 1.0f && - mat[10] == 1.0f && mat[15] == 1.0f)) { - return setColorTransform(null); - } - return setColorTransform(mat); - } - - private static float[] toColorMatrix(String rgbString) { - String[] adj = rgbString == null ? null : rgbString.split(" "); - - if (adj == null || adj.length != 3) { - return null; - } - - float[] mat = new float[16]; - - // sanity check - for (int i = 0; i < 3; i++) { - int v = Integer.parseInt(adj[i]); - - if (v >= MAX) { - v = MAX; - } else if (v < MIN) { - v = MIN; - } - - mat[i * 5] = (float)v / (float)MAX; - sCurColors[i] = v; - } - - mat[15] = 1.0f; - return mat; - } - - /** - * Sets the surface flinger's color transformation as a 4x4 matrix. If the - * matrix is null, color transformations are disabled. - * - * @param m the float array that holds the transformation matrix, or null to - * disable transformation - */ - private static boolean setColorTransform(float[] m) { - try { - final IBinder flinger = ServiceManager.getService("SurfaceFlinger"); - if (flinger != null) { - final Parcel data = Parcel.obtain(); - data.writeInterfaceToken("android.ui.ISurfaceComposer"); - if (m != null) { - data.writeInt(1); - for (int i = 0; i < 16; i++) { - data.writeFloat(m[i]); - } - } else { - data.writeInt(0); - } - flinger.transact(1030, data, null, 0); - data.recycle(); - } - } catch (RemoteException ex) { - Slog.e(TAG, "Failed to set color transform", ex); - return false; - } - return true; - } - -} diff --git a/lineagehw/src/org/lineageos/hardware/KeyDisabler.java b/lineagehw/src/org/lineageos/hardware/KeyDisabler.java deleted file mode 100644 index 13d5ad6..0000000 --- a/lineagehw/src/org/lineageos/hardware/KeyDisabler.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.lineageos.hardware; - -import org.lineageos.internal.util.FileUtils; - -/* - * Disable capacitive keys - * - * This is intended for use on devices in which the capacitive keys - * can be fully disabled for replacement with a soft navbar. You - * really should not be using this on a device with mechanical or - * otherwise visible-when-inactive keys - */ - -public class KeyDisabler { - - private static String CONTROL_PATH = "/sys/class/sec/sec_touchkey/input/enabled"; - - public static boolean isSupported() { - return FileUtils.isFileWritable(CONTROL_PATH); - } - - public static boolean isActive() { - return (FileUtils.readOneLine(CONTROL_PATH).equals("0")); - } - - public static boolean setActive(boolean state) { - return FileUtils.writeLine(CONTROL_PATH, (state ? "0" : "1")); - } - -} diff --git a/lineagehw/src/org/lineageos/hardware/SunlightEnhancement.java b/lineagehw/src/org/lineageos/hardware/SunlightEnhancement.java deleted file mode 100644 index e249830..0000000 --- a/lineagehw/src/org/lineageos/hardware/SunlightEnhancement.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2014 The CyanogenMod Project - * Copyright (C) 2018 The LineageOS 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; - -/** - * Sunlight Readability Enhancement support, aka Facemelt Mode. - * - * Brightens up the screen via image processing or other tricks when - * under aggressive lighting conditions. Usually depends on CABC - * support. - */ -public class SunlightEnhancement { - - private static final String HBM_PATH = "/sys/class/mdnie/mdnie/lux"; - /* see drivers/video/exynos/decon_7580/panels/mdnie_lite_table*, get_hbm_index */ - private static final String HBM_MIN_VALUE = "40000"; - - /** - * Whether device supports SRE - * - * @return boolean Supported devices must return always true - */ - public static boolean isSupported() { - return FileUtils.isFileWritable(HBM_PATH) && - FileUtils.isFileReadable(HBM_PATH); - } - - /** - * This method return the current activation status of SRE - * - * @return boolean Must be false when SRE is not supported or not activated, or - * the operation failed while reading the status; true in any other case. - */ - public static boolean isEnabled() { - return Integer.parseInt(FileUtils.readOneLine(HBM_PATH)) > 0; - } - - /** - * This method allows to setup SRE. - * - * @param status The new SRE status - * @return boolean Must be false if SRE is not supported or the operation - * failed; true in any other case. - */ - public static boolean setEnabled(boolean status) { - String value = status ? HBM_MIN_VALUE : "0"; - return FileUtils.writeLine(HBM_PATH, value); - } - - /** - * Whether adaptive backlight (CABL / CABC) is required to be enabled - * - * @return boolean False if adaptive backlight is not a dependency - */ - public static boolean isAdaptiveBacklightRequired() { - return false; - } - - /** - * Set this to true if the implementation is self-managed and does - * it's own ambient sensing. In this case, setEnabled is assumed - * to toggle the feature on or off, but not activate it. If set - * to false, LiveDisplay will call setEnabled when the ambient lux - * threshold is crossed. - * - * @return true if this enhancement is self-managed - */ - public static boolean isSelfManaged() { - return false; - } -} -- 2.20.1