Revert "klte-common: Stop inheriting BOARD_HARDWARE_CLASS"

This reverts commit b10cc6e072.

Change-Id: I7d559cf475aedeb2bfe8a5ff48732899e544c584
This commit is contained in:
Kevin F. Haggerty 2016-06-24 05:30:04 -06:00
parent 5e25ec0203
commit 80563751e3
7 changed files with 4 additions and 445 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2016 The CyanogenMod Project
# 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.
@ -46,7 +46,8 @@ BOARD_HAVE_BLUETOOTH_BCM := true
USE_DEVICE_SPECIFIC_CAMERA := true
# CMHW
BOARD_HARDWARE_CLASS := device/samsung/klte-common/cmhw
BOARD_HARDWARE_CLASS += device/samsung/klte-common/cmhw
BOARD_HARDWARE_CLASS += hardware/samsung/cmhw
# Lights
TARGET_PROVIDES_LIBLIGHT := true

View File

@ -1,72 +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.cyanogenmod.hardware;
import org.cyanogenmod.hardware.util.FileUtils;
import android.os.SystemProperties;
import android.text.TextUtils;
import java.io.File;
/**
* Adaptive backlight support (this refers to technologies like NVIDIA SmartDimmer,
* QCOM CABL or Samsung CABC).
*/
public class AdaptiveBacklight {
private static String FILE_CABC = SystemProperties.get("ro.cm.hardware.cabc", "/sys/class/lcd/panel/power_reduce");
/**
* Whether device supports an adaptive backlight technology.
*
* @return boolean Supported devices must return always true
*/
public static boolean isSupported() {
File f = new File(FILE_CABC);
return f.exists();
}
/**
* 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() {
if (TextUtils.equals(FileUtils.readOneLine(FILE_CABC), "1")) {
return true;
} else {
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) {
if (status == true) {
return FileUtils.writeLine(FILE_CABC, "1");
} else {
return FileUtils.writeLine(FILE_CABC, "0");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 The CyanogenMod Project
* 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.

View File

@ -1,93 +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.cyanogenmod.hardware;
import org.cyanogenmod.hardware.util.FileUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import android.util.Log;
/**
* Glove mode / high touch sensitivity
*/
public class HighTouchSensitivity {
private static String TAG = "HighTouchSensitivity";
private static String COMMAND_PATH = "/sys/class/sec/tsp/cmd";
private static String COMMAND_LIST_PATH = "/sys/class/sec/tsp/cmd_list";
private static String COMMAND_RESULT_PATH = "/sys/class/sec/tsp/cmd_result";
private static String GLOVE_MODE = "glove_mode";
private static String GLOVE_MODE_ENABLE = "glove_mode,1";
private static String GLOVE_MODE_DISABLE = "glove_mode,0";
private static String STATUS_OK = ":OK";
/**
* Whether device supports high touch sensitivity.
*
* @return boolean Supported devices must return always true
*/
public static boolean isSupported() {
File f = new File(COMMAND_PATH);
if (f.exists()) {
BufferedReader reader = null;
try {
String currentLine;
reader = new BufferedReader(new FileReader(COMMAND_LIST_PATH));
while ((currentLine = reader.readLine()) != null) {
if (GLOVE_MODE.equals(currentLine))
return true;
}
} catch (IOException e) {
// Ignore exception, will be false anyway
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
// Ignore exception, no recovery possible
}
}
}
}
return false;
}
/** This method returns the current activation status of high touch sensitivity
*
* @return boolean Must be false if high touch sensitivity is not supported or not activated,
* or the operation failed while reading the status; true in any other case.
*/
public static boolean isEnabled() {
return FileUtils.readOneLine(COMMAND_RESULT_PATH).equals(GLOVE_MODE_ENABLE + STATUS_OK);
}
/**
* This method allows to setup high touch sensitivity status.
*
* @param status The new high touch sensitivity status
* @return boolean Must be false if high touch sensitivity is not supported or the operation
* failed; true in any other case.
*/
public static boolean setEnabled(boolean status) {
return FileUtils.writeLine(COMMAND_PATH, status ? GLOVE_MODE_ENABLE : GLOVE_MODE_DISABLE);
}
}

View File

@ -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.cyanogenmod.hardware;
import org.cyanogenmod.hardware.util.FileUtils;
import android.os.SystemProperties;
import java.io.File;
/**
* 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 sOutdoorModePath = "/sys/class/mdnie/mdnie/outdoor";
/**
* Whether device supports SRE
*
* @return boolean Supported devices must return always true
*/
public static boolean isSupported() {
return new File(sOutdoorModePath).exists();
}
/**
* 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() {
String line = FileUtils.readOneLine(sOutdoorModePath);
if (line == null)
return false;
return line.equals("1");
}
/**
* 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(sOutdoorModePath, 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;
}
/**
* 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;
}
}

View File

@ -1,93 +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.cyanogenmod.hardware;
import org.cyanogenmod.hardware.util.FileUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import android.util.Log;
/**
* Touchscreen Hovering
*/
public class TouchscreenHovering {
private static String TAG = "TouchscreenHovering";
private static String COMMAND_PATH = "/sys/class/sec/tsp/cmd";
private static String COMMAND_LIST_PATH = "/sys/class/sec/tsp/cmd_list";
private static String COMMAND_RESULT_PATH = "/sys/class/sec/tsp/cmd_result";
private static String HOVER_MODE = "hover_enable";
private static String HOVER_MODE_ENABLE = "hover_enable,1";
private static String HOVER_MODE_DISABLE = "hover_enable,0";
private static String STATUS_OK = ":OK";
/**
* Whether device supports touchscreen hovering.
*
* @return boolean Supported devices must return always true
*/
public static boolean isSupported() {
File f = new File(COMMAND_PATH);
if (f.exists()) {
BufferedReader reader = null;
try {
String currentLine;
reader = new BufferedReader(new FileReader(COMMAND_LIST_PATH));
while ((currentLine = reader.readLine()) != null) {
if (HOVER_MODE.equals(currentLine))
return true;
}
} catch (IOException e) {
// Ignore exception, will be false anyway
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
// Ignore exception, no recovery possible
}
}
}
}
return false;
}
/** This method returns the current activation status of touchscreen hovering
*
* @return boolean Must be false if touchscreen hovering is not supported or not activated,
* or the operation failed while reading the status; true in any other case.
*/
public static boolean isEnabled() {
return FileUtils.readOneLine(COMMAND_RESULT_PATH).equals(HOVER_MODE_ENABLE + STATUS_OK);
}
/**
* This method allows to setup touchscreen hovering status.
*
* @param status The new touchscreen hovering status
* @return boolean Must be false if touchscreen hovering is not supported or the operation
* failed; true in any other case.
*/
public static boolean setEnabled(boolean status) {
return FileUtils.writeLine(COMMAND_PATH, status ? HOVER_MODE_ENABLE : HOVER_MODE_DISABLE);
}
}

View File

@ -1,95 +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.cyanogenmod.hardware;
import org.cyanogenmod.hardware.util.FileUtils;
import java.io.File;
public class VibratorHW {
private static String LEVEL_PATH = "/sys/class/timed_output/vibrator/pwm_value";
private static String LEVEL_MAX_PATH = "/sys/class/timed_output/vibrator/pwm_max";
private static String LEVEL_MIN_PATH = "/sys/class/timed_output/vibrator/pwm_min";
private static String LEVEL_DEFAULT_PATH = "/sys/class/timed_output/vibrator/pwm_default";
private static String LEVEL_THRESHOLD_PATH = "/sys/class/timed_output/vibrator/pwm_threshold";
public static boolean isSupported() {
File f = new File(LEVEL_PATH);
return f.exists();
}
public static int getMaxIntensity() {
File f = new File(LEVEL_MAX_PATH);
if(f.exists()) {
return Integer.parseInt(FileUtils.readOneLine(LEVEL_MAX_PATH));
} else {
return 100;
}
}
public static int getMinIntensity() {
File f = new File(LEVEL_MIN_PATH);
if(f.exists()) {
return Integer.parseInt(FileUtils.readOneLine(LEVEL_MIN_PATH));
} else {
return 0;
}
}
public static int getWarningThreshold() {
File f = new File(LEVEL_THRESHOLD_PATH);
if(f.exists()) {
return Integer.parseInt(FileUtils.readOneLine(LEVEL_THRESHOLD_PATH));
} else {
return 75;
}
}
public static int getCurIntensity() {
File f = new File(LEVEL_PATH);
if(f.exists()) {
return Integer.parseInt(FileUtils.readOneLine(LEVEL_PATH));
} else {
return 0;
}
}
public static int getDefaultIntensity() {
File f = new File(LEVEL_DEFAULT_PATH);
if(f.exists()) {
return Integer.parseInt(FileUtils.readOneLine(LEVEL_DEFAULT_PATH));
} else {
return 50;
}
}
public static boolean setIntensity(int intensity) {
File f = new File(LEVEL_PATH);
if(f.exists()) {
return FileUtils.writeLine(LEVEL_PATH, String.valueOf(intensity));
} else {
return false;
}
}
}