aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-08-12 14:15:43 -0700
committerSteve Kondik <shade@chemlab.org>2015-08-15 21:37:12 -0700
commita527e1457203cdd59ef7f51a7e3df7a3143a3c0a (patch)
tree6d87c8e188d3eac6f2444caa7e24f731999fd6ad
parent009cd97eaa0814e047a650b0a9da4fe88ffacd12 (diff)
msm8916: Add LiveDisplay CMHW interface
Change-Id: I58d36f286012c6a1d5782baed217ab94d758a981
-rw-r--r--cmhw/org/cyanogenmod/hardware/AutoContrast.java83
-rw-r--r--cmhw/org/cyanogenmod/hardware/ColorEnhancement.java68
-rw-r--r--cmhw/org/cyanogenmod/hardware/SunlightEnhancement.java83
-rw-r--r--cmhw/src/org/cyanogenmod/hardware/AdaptiveBacklight.java75
-rw-r--r--cmhw/src/org/cyanogenmod/hardware/AutoContrast.java83
-rw-r--r--cmhw/src/org/cyanogenmod/hardware/ColorEnhancement.java68
-rw-r--r--cmhw/src/org/cyanogenmod/hardware/SunlightEnhancement.java83
-rw-r--r--sepolicy/file_contexts8
8 files changed, 549 insertions, 2 deletions
diff --git a/cmhw/org/cyanogenmod/hardware/AutoContrast.java b/cmhw/org/cyanogenmod/hardware/AutoContrast.java
new file mode 100644
index 0000000..3e3e8dd
--- /dev/null
+++ b/cmhw/org/cyanogenmod/hardware/AutoContrast.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2015 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 org.cyanogenmod.hardware.util.FileUtils;
+
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Auto Contrast Optimization
+ */
+public class AutoContrast {
+
+ private static final String TAG = "AutoContrast";
+
+ private static final String FILE_ACO = "/sys/class/graphics/fb0/aco";
+
+ /**
+ * Whether device supports ACO
+ *
+ * @return boolean Supported devices must return always true
+ */
+ public static boolean isSupported() {
+ File f = new File(FILE_ACO);
+
+ if(f.exists()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * This method return the current activation status of ACO
+ *
+ * @return boolean Must be false when ACO is not supported or not activated, or
+ * the operation failed while reading the status; true in any other case.
+ */
+ public static boolean isEnabled() {
+ try {
+ return Integer.parseInt(FileUtils.readOneLine(FILE_ACO)) > 0;
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ return false;
+ }
+
+ /**
+ * This method allows to setup ACO
+ *
+ * @param status The new ACO status
+ * @return boolean Must be false if ACO is not supported or the operation
+ * failed; true in any other case.
+ */
+ public static boolean setEnabled(boolean status) {
+ return FileUtils.writeLine(FILE_ACO, status ? "1" : "0");
+ }
+
+ /**
+ * 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;
+ }
+}
diff --git a/cmhw/org/cyanogenmod/hardware/ColorEnhancement.java b/cmhw/org/cyanogenmod/hardware/ColorEnhancement.java
new file mode 100644
index 0000000..30c8970
--- /dev/null
+++ b/cmhw/org/cyanogenmod/hardware/ColorEnhancement.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 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 org.cyanogenmod.hardware.util.FileUtils;
+
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Color enhancement panel control
+ */
+public class ColorEnhancement {
+
+ private static final String TAG = "ColorEnhancement";
+
+ private static final String FILE_CE = "/sys/class/graphics/fb0/color_enhance";
+
+ /**
+ * Whether device supports CE
+ *
+ * @return boolean Supported devices must return always true
+ */
+ public static boolean isSupported() {
+ return new File(FILE_CE).exists();
+ }
+
+ /**
+ * This method return the current activation status of CE
+ *
+ * @return boolean Must be false when CE is not supported or not activated, or
+ * the operation failed while reading the status; true in any other case.
+ */
+ public static boolean isEnabled() {
+ try {
+ return Integer.parseInt(FileUtils.readOneLine(FILE_CE)) > 0;
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ return false;
+ }
+
+ /**
+ * This method allows to setup CE
+ *
+ * @param status The new CE status
+ * @return boolean Must be false if CE is not supported or the operation
+ * failed; true in any other case.
+ */
+ public static boolean setEnabled(boolean status) {
+ return FileUtils.writeLine(FILE_CE, status ? "1" : "0");
+ }
+}
diff --git a/cmhw/org/cyanogenmod/hardware/SunlightEnhancement.java b/cmhw/org/cyanogenmod/hardware/SunlightEnhancement.java
new file mode 100644
index 0000000..4a1f5fa
--- /dev/null
+++ b/cmhw/org/cyanogenmod/hardware/SunlightEnhancement.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2015 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 org.cyanogenmod.hardware.util.FileUtils;
+
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Facemelt mode!
+ */
+public class SunlightEnhancement {
+
+ private static final String TAG = "SunlightEnhancement";
+
+ private static final String FILE_SRE = "/sys/class/graphics/fb0/sre";
+
+ /**
+ * Whether device supports SRE
+ *
+ * @return boolean Supported devices must return always true
+ */
+ public static boolean isSupported() {
+ File f = new File(FILE_SRE);
+
+ if(f.exists()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 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() {
+ try {
+ return Integer.parseInt(FileUtils.readOneLine(FILE_SRE)) > 0;
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ return false;
+ }
+
+ /**
+ * 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) {
+ return FileUtils.writeLine(FILE_SRE, status ? "2" : "0");
+ }
+
+ /**
+ * 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;
+ }
+}
diff --git a/cmhw/src/org/cyanogenmod/hardware/AdaptiveBacklight.java b/cmhw/src/org/cyanogenmod/hardware/AdaptiveBacklight.java
new file mode 100644
index 0000000..02faebf
--- /dev/null
+++ b/cmhw/src/org/cyanogenmod/hardware/AdaptiveBacklight.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2013 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 org.cyanogenmod.hardware.util.FileUtils;
+
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Adaptive backlight support (this refers to technologies like NVIDIA SmartDimmer,
+ * QCOM CABL or Samsung CABC).
+ */
+public class AdaptiveBacklight {
+
+ private static final String TAG = "AdaptiveBacklight";
+
+ private static final String FILE_CABC = "/sys/class/graphics/fb0/cabc";
+
+ /**
+ * Whether device supports an adaptive backlight technology.
+ *
+ * @return boolean Supported devices must return always true
+ */
+ public static boolean isSupported() {
+ final File f = new File(FILE_CABC);
+
+ if(f.exists()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * This method return the current activation status of the adaptive backlight technology.
+ *
+ * @return boolean Must be false when adaptive backlight is not supported or not activated, or
+ * the operation failed while reading the status; true in any other case.
+ */
+ public static boolean isEnabled() {
+ try {
+ return Integer.parseInt(FileUtils.readOneLine(FILE_CABC)) > 0;
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ return false;
+ }
+
+ /**
+ * This method allows to setup adaptive backlight technology status.
+ *
+ * @param status The new adaptive backlight status
+ * @return boolean Must be false if adaptive backlight is not supported or the operation
+ * failed; true in any other case.
+ */
+ public static boolean setEnabled(boolean status) {
+ return FileUtils.writeLine(FILE_CABC, status ? "1" : "0");
+ }
+}
diff --git a/cmhw/src/org/cyanogenmod/hardware/AutoContrast.java b/cmhw/src/org/cyanogenmod/hardware/AutoContrast.java
new file mode 100644
index 0000000..3e3e8dd
--- /dev/null
+++ b/cmhw/src/org/cyanogenmod/hardware/AutoContrast.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2015 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 org.cyanogenmod.hardware.util.FileUtils;
+
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Auto Contrast Optimization
+ */
+public class AutoContrast {
+
+ private static final String TAG = "AutoContrast";
+
+ private static final String FILE_ACO = "/sys/class/graphics/fb0/aco";
+
+ /**
+ * Whether device supports ACO
+ *
+ * @return boolean Supported devices must return always true
+ */
+ public static boolean isSupported() {
+ File f = new File(FILE_ACO);
+
+ if(f.exists()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * This method return the current activation status of ACO
+ *
+ * @return boolean Must be false when ACO is not supported or not activated, or
+ * the operation failed while reading the status; true in any other case.
+ */
+ public static boolean isEnabled() {
+ try {
+ return Integer.parseInt(FileUtils.readOneLine(FILE_ACO)) > 0;
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ return false;
+ }
+
+ /**
+ * This method allows to setup ACO
+ *
+ * @param status The new ACO status
+ * @return boolean Must be false if ACO is not supported or the operation
+ * failed; true in any other case.
+ */
+ public static boolean setEnabled(boolean status) {
+ return FileUtils.writeLine(FILE_ACO, status ? "1" : "0");
+ }
+
+ /**
+ * 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;
+ }
+}
diff --git a/cmhw/src/org/cyanogenmod/hardware/ColorEnhancement.java b/cmhw/src/org/cyanogenmod/hardware/ColorEnhancement.java
new file mode 100644
index 0000000..30c8970
--- /dev/null
+++ b/cmhw/src/org/cyanogenmod/hardware/ColorEnhancement.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 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 org.cyanogenmod.hardware.util.FileUtils;
+
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Color enhancement panel control
+ */
+public class ColorEnhancement {
+
+ private static final String TAG = "ColorEnhancement";
+
+ private static final String FILE_CE = "/sys/class/graphics/fb0/color_enhance";
+
+ /**
+ * Whether device supports CE
+ *
+ * @return boolean Supported devices must return always true
+ */
+ public static boolean isSupported() {
+ return new File(FILE_CE).exists();
+ }
+
+ /**
+ * This method return the current activation status of CE
+ *
+ * @return boolean Must be false when CE is not supported or not activated, or
+ * the operation failed while reading the status; true in any other case.
+ */
+ public static boolean isEnabled() {
+ try {
+ return Integer.parseInt(FileUtils.readOneLine(FILE_CE)) > 0;
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ return false;
+ }
+
+ /**
+ * This method allows to setup CE
+ *
+ * @param status The new CE status
+ * @return boolean Must be false if CE is not supported or the operation
+ * failed; true in any other case.
+ */
+ public static boolean setEnabled(boolean status) {
+ return FileUtils.writeLine(FILE_CE, status ? "1" : "0");
+ }
+}
diff --git a/cmhw/src/org/cyanogenmod/hardware/SunlightEnhancement.java b/cmhw/src/org/cyanogenmod/hardware/SunlightEnhancement.java
new file mode 100644
index 0000000..4a1f5fa
--- /dev/null
+++ b/cmhw/src/org/cyanogenmod/hardware/SunlightEnhancement.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2015 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 org.cyanogenmod.hardware.util.FileUtils;
+
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Facemelt mode!
+ */
+public class SunlightEnhancement {
+
+ private static final String TAG = "SunlightEnhancement";
+
+ private static final String FILE_SRE = "/sys/class/graphics/fb0/sre";
+
+ /**
+ * Whether device supports SRE
+ *
+ * @return boolean Supported devices must return always true
+ */
+ public static boolean isSupported() {
+ File f = new File(FILE_SRE);
+
+ if(f.exists()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 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() {
+ try {
+ return Integer.parseInt(FileUtils.readOneLine(FILE_SRE)) > 0;
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ return false;
+ }
+
+ /**
+ * 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) {
+ return FileUtils.writeLine(FILE_SRE, status ? "2" : "0");
+ }
+
+ /**
+ * 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;
+ }
+}
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 95b7660..c5be57d 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -1,3 +1,9 @@
+/sys/devices/virtual/graphics/fb0/aco u:object_r:display_sysfs:s0
+/sys/devices/virtual/graphics/fb0/cabc u:object_r:display_sysfs:s0
+/sys/devices/virtual/graphics/fb0/color_enhance u:object_r:display_sysfs:s0
+/sys/devices/virtual/graphics/fb0/rgb u:object_r:display_sysfs:s0
+/sys/devices/virtual/graphics/fb0/sre u:object_r:display_sysfs:s0
+
/persist/.genmac u:object_r:wifi_data_file:s0
/persist/.bt_nv.bin u:object_r:bluetooth_data_file:s0
@@ -5,5 +11,3 @@
/system/etc/init\.qcom\.bt\.sh u:object_r:bluetooth_loader_exec:s0
/dev/smd3 u:object_r:hci_attach_dev:s0
-
-/sys/devices/virtual/graphics/fb0/rgb u:object_r:display_sysfs:s0