From 66b282da2ec6dcc3a8759087218195bf5ea15f84 Mon Sep 17 00:00:00 2001 From: "Kevin F. Haggerty" Date: Tue, 19 Feb 2019 07:40:21 -0700 Subject: [PATCH] msm8974-common: Build Samsung LiveDisplay service Change-Id: I74d38aa0df3179bb00b942135e8ff055aa8a5658 --- BoardConfigCommon.mk | 5 +- .../hardware/SunlightEnhancement.java | 89 ------------------- manifest.xml | 25 ++++++ msm8974.mk | 6 +- sepolicy/common/file_contexts | 1 + .../common/hal_lineage_livedisplay_default.te | 9 ++ sepolicy/common/system_server.te | 2 - 7 files changed, 41 insertions(+), 96 deletions(-) delete mode 100644 lineagehw/org/lineageos/hardware/SunlightEnhancement.java create mode 100644 sepolicy/common/hal_lineage_livedisplay_default.te diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index bd1194f..c5661e7 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -1,5 +1,5 @@ # Copyright (C) 2012 The CyanogenMod Project -# Copyright (C) 2017-2018 The LineageOS Project +# Copyright (C) 2017-2019 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. @@ -47,9 +47,6 @@ BOARD_CHARGING_CMDLINE_NAME := "androidboot.bootchg" BOARD_CHARGING_CMDLINE_VALUE := "true" WITH_LINEAGE_CHARGER := false -# CMHW -BOARD_HARDWARE_CLASS += device/samsung/msm8974-common/lineagehw - # Dexpreopt ifeq ($(HOST_OS),linux) ifneq ($(TARGET_BUILD_VARIANT),eng) diff --git a/lineagehw/org/lineageos/hardware/SunlightEnhancement.java b/lineagehw/org/lineageos/hardware/SunlightEnhancement.java deleted file mode 100644 index 69e97e0..0000000 --- a/lineagehw/org/lineageos/hardware/SunlightEnhancement.java +++ /dev/null @@ -1,89 +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; - -/** - * 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 FILE_SRE = "/sys/class/mdnie/mdnie/outdoor"; - private static final String FILE_HBM = "/sys/class/lcd/panel/panel/auto_brightness"; - - /** - * Whether device supports SRE - * - * @return boolean Supported devices must return always true - */ - public static boolean isSupported() { - return FileUtils.isFileWritable(FILE_SRE) && - FileUtils.isFileReadable(FILE_SRE) && - FileUtils.isFileWritable(FILE_HBM) && - FileUtils.isFileReadable(FILE_HBM); - } - - /** - * 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 "1".equals(FileUtils.readOneLine(FILE_SRE)) && - "6".equals(FileUtils.readOneLine(FILE_HBM)); - } - - /** - * 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 ? "1" : "0") && - FileUtils.writeLine(FILE_HBM, status ? "6" : "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; - } - - /** - * 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; - } -} diff --git a/manifest.xml b/manifest.xml index 5c37285..8103baf 100644 --- a/manifest.xml +++ b/manifest.xml @@ -216,6 +216,31 @@ default + + vendor.lineage.livedisplay + hwbinder + 2.0 + + IAdaptiveBacklight + default + + + IDisplayColorCalibration + default + + + IDisplayModes + default + + + IReadingEnhancement + default + + + ISunlightEnhancement + default + + vendor.lineage.trust hwbinder diff --git a/msm8974.mk b/msm8974.mk index 381ad2c..3bda121 100644 --- a/msm8974.mk +++ b/msm8974.mk @@ -1,5 +1,5 @@ # Copyright (C) 2012 The CyanogenMod Project -# Copyright (C) 2017-2018 The LineageOS Project +# Copyright (C) 2017-2019 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. @@ -141,6 +141,10 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ android.hardware.keymaster@3.0-impl +# LiveDisplay +PRODUCT_PACKAGES += \ + vendor.lineage.livedisplay@2.0-service.samsung-qcom + # Media PRODUCT_COPY_FILES += \ frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \ diff --git a/sepolicy/common/file_contexts b/sepolicy/common/file_contexts index 37f8db0..43e91b8 100644 --- a/sepolicy/common/file_contexts +++ b/sepolicy/common/file_contexts @@ -21,6 +21,7 @@ # executeables /system/vendor/bin/macloader u:object_r:macloader_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.sensors@1\.0-service.samsung8974 u:object_r:hal_sensors_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.lineage\.livedisplay@2\.0-service\.samsung-qcom u:object_r:hal_lineage_livedisplay_default_exec:s0 /(vendor|system/vendor)/bin/hw/vendor\.lineage\.touch@1\.0-service\.samsung u:object_r:hal_lineage_touch_default_exec:s0 # firmware diff --git a/sepolicy/common/hal_lineage_livedisplay_default.te b/sepolicy/common/hal_lineage_livedisplay_default.te new file mode 100644 index 0000000..33843e4 --- /dev/null +++ b/sepolicy/common/hal_lineage_livedisplay_default.te @@ -0,0 +1,9 @@ +allow hal_lineage_livedisplay_default { + sysfs_graphics + sysfs_mdnie +}:dir search; + +allow hal_lineage_livedisplay_default { + sysfs_graphics + sysfs_mdnie +}:file rw_file_perms; diff --git a/sepolicy/common/system_server.te b/sepolicy/common/system_server.te index a97d612..73ebc56 100644 --- a/sepolicy/common/system_server.te +++ b/sepolicy/common/system_server.te @@ -1,5 +1,3 @@ -allow system_server sysfs_mdnie:file rw_file_perms; - allow system_server { efs_file mpctl_data_file