Compare commits

7 Commits
vic ... bka

Author SHA1 Message Date
Bruno Martins
d85db10f01 msm8996-common: Switch to common Touch AIDL from hardware/xiaomi
Change-Id: I89fa58ae2eb5d7741bf5628d4f56ad0eb55e59ff
2025-07-09 14:24:25 +02:00
Michael Bestas
e9284849f8 msm8996-common: Remove deprecated config_mobile_tcp_buffers/networkAttributes
Change-Id: Ieda947e283cde11cf74a01dc1b438e1deeb902c9
2025-07-09 14:24:25 +02:00
Michael Bestas
e95122cfca msm8996-common: camera: Remove CleanSpec.mk
Change-Id: I599ae8bedcd23d052d0e3e658d12b28f641868e6
2025-07-09 14:24:25 +02:00
Bruno Martins
cfb9794c24 msm8996-common: readfem/readmac: Convert to bp
Change-Id: Ie607de76a658a475e8f1d6cf748e6e8fc8acfa5c
2025-07-09 14:24:25 +02:00
yingjiew
b8015d9936 msm8996-common: gps: Avoid access of deprecated LocUnorderedSetMap entry
When there is no client listens to some DataItemId, we will remove
the map entry. Can't access the deleted entry's iterator anymore.

Change-Id: Id64aadebf7362667fbcf0fd5191f888ed9241727
CRs-Fixed: 3886536
(cherry picked from commit 0049d459cc1772f328e29a4c6b6d129af132e7b8)
2025-07-09 14:24:25 +02:00
Michael Bestas
2223dc61bf msm8996-common: Migrate mount point creation out of Android.mk
Change-Id: Id5986b8a740e45f864eecdd2bd82d9455f128d6b
2025-07-09 14:24:25 +02:00
Alexander Koskovich
3bab5cd89f msm8996-common: Remove vendor RenderScript implementation.
* RenderScript is deprecated on newer platforms and
   is being officially replaced.

 * On April 19, 2021, Google announced that RenderScript
   will be deprecated in Android 12, and recommended
   porting existing code to Vulkan.

   https://android-developers.googleblog.com/2021/04/android-gpu-compute-going-forward.html

Change-Id: I19460ef266a646b046f1e7d2f0b4eab7c48ae536
2025-07-09 14:24:25 +02:00
22 changed files with 47 additions and 544 deletions

View File

@@ -30,26 +30,4 @@ ifneq ($(filter capricorn gemini lithium natrium scorpio,$(TARGET_DEVICE)),)
include $(call all-makefiles-under,$(LOCAL_PATH))
include $(CLEAR_VARS)
# A/B builds require us to create the mount points at compile time.
# Just creating it for all cases since it does not hurt.
FIRMWARE_MOUNT_POINT := $(TARGET_OUT_VENDOR)/firmware_mnt
BT_FIRMWARE_MOUNT_POINT := $(TARGET_OUT_VENDOR)/bt_firmware
DSP_MOUNT_POINT := $(TARGET_OUT_VENDOR)/dsp
$(FIRMWARE_MOUNT_POINT):
@echo "Creating $(FIRMWARE_MOUNT_POINT)"
@mkdir -p $(TARGET_OUT_VENDOR)/firmware_mnt
$(BT_FIRMWARE_MOUNT_POINT):
@echo "Creating $(BT_FIRMWARE_MOUNT_POINT)"
@mkdir -p $(TARGET_OUT_VENDOR)/bt_firmware
$(DSP_MOUNT_POINT):
@echo "Creating $(DSP_MOUNT_POINT)"
@mkdir -p $(TARGET_OUT_VENDOR)/dsp
ALL_DEFAULT_INSTALLED_MODULES += $(FIRMWARE_MOUNT_POINT) $(BT_FIRMWARE_MOUNT_POINT) $(DSP_MOUNT_POINT)
endif

View File

@@ -102,8 +102,6 @@ USE_OPENGL_RENDERER := true
MAX_EGL_CACHE_KEY_SIZE := 12*1024
MAX_EGL_CACHE_SIZE := 2048*1024
OVERRIDE_RS_DRIVER := libRSDriver_adreno.so
# Filesystem
TARGET_FS_CONFIG_GEN := $(VENDOR_PATH)/config.fs

View File

@@ -1,47 +0,0 @@
# Copyright (C) 2007 The Android Open Source 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.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
$(call add-clean-step, find $(OUT_DIR) -name "camera.msm8960*" -print0 | xargs -0 rm -rf)

View File

@@ -132,8 +132,11 @@ public:
unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) {
for (auto key : keys) {
auto iter = mMap.find(key);
if (iter != mMap.end() && trimOrRemove(iter, rVals, goneVals) && nullptr != goneKeys) {
goneKeys->insert(iter->first);
if (iter != mMap.end()) {
KEY goneKey = iter->first;
if (trimOrRemove(iter, rVals, goneVals) && nullptr != goneKeys) {
goneKeys->insert(goneKey);
}
}
}
}

View File

@@ -146,15 +146,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.renderscript</name>
<transport arch="32+64">passthrough</transport>
<version>1.0</version>
<interface>
<name>IDevice</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.sensors</name>
<transport>hwbinder</transport>

View File

@@ -318,6 +318,12 @@ PRODUCT_PACKAGES += \
# Partitions
PRODUCT_USE_DYNAMIC_PARTITIONS := true
# Partitions
PRODUCT_PACKAGES += \
vendor_bt_firmware_mountpoint \
vendor_dsp_mountpoint \
vendor_firmware_mnt_mountpoint
# Power
PRODUCT_PACKAGES += \
android.hardware.power-service-qti \
@@ -352,10 +358,6 @@ PRODUCT_COPY_FILES += \
PRODUCT_PACKAGES += \
librecovery_updater_xiaomi
# RenderScript
PRODUCT_PACKAGES += \
android.hardware.renderscript@1.0-impl
# RIL
PRODUCT_PACKAGES += \
android.hardware.radio@1.4.vendor \

View File

@@ -30,20 +30,5 @@
<item>[ApnSettingV3]MetroPCS Tethering,pcweb.metropcs.com,,,,,,,,,310,260,,DUN,,,true,0,,,,,,,gid,6D</item>
</string-array>
<!-- Configure mobile tcp buffer sizes in the form:
rat-name:rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max
If no value is found for the rat-name in use, the system default will be applied.
-->
<string-array name="config_mobile_tcp_buffers">
<item>umts:21135,131070,1056768,6144,24576,165312</item>
<item>hspa:18300,131070,1056768,6144,24576,393216</item>
<item>hsdpa:18300,131070,1056768,6144,24576,393216</item>
<item>hsupa:6141,131070,1056768,6144,24576,393216</item>
<item>hspap:31455,131070,1830912,6144,24576,1830912</item>
<item>edge:8192,26280,704512,4096,16384,110208</item>
<item>gprs:8192,8760,704512,4096,8760,110208</item>
<item>lte:786432,1572864,3840000,786432,1572864,3840000</item>
</string-array>
</resources>

View File

@@ -20,21 +20,6 @@
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources>
<!-- Configure mobile tcp buffer sizes in the form:
rat-name:rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max
If no value is found for the rat-name in use, the system default will be applied.
-->
<string-array name="config_mobile_tcp_buffers">
<item>umts:131072,262144,1452032,4096,16384,399360</item>
<item>hspa:131072,262144,1452032,4096,16384,399360</item>
<item>hsdpa:131072,262144,1452032,4096,16384,399360</item>
<item>hsupa:131072,262144,1452032,4096,16384,399360</item>
<item>hspap:131072,262144,1452032,4096,16384,399360</item>
<item>edge:4093,26280,35040,4096,16384,35040</item>
<item>gprs:4092,8760,11680,4096,8760,11680</item>
<item>evdo:4094,87380,262144,4096,16384,262144</item>
<item>lte:524288,1048576,8388608,262144,524288,4194304</item>
</string-array>
<!-- If Voice Radio Technology is RIL_RADIO_TECHNOLOGY_LTE:14 this is the Values
that should be used instead. A value of RIL_RADIO_TECHNOLOGY_UNKNOWN:0 means

View File

@@ -34,29 +34,6 @@
<string name="config_mms_user_agent_profile_url" translatable="false"
>http://www.google.com/oha/rdf/ua-profile-kila.xml</string>
<!-- This string array should be overridden by the device to present a list of network
attributes. This is used by the connectivity manager to decide which networks can coexist
based on the hardware -->
<!-- An Array of "[Connection name],[ConnectivityManager.TYPE_xxxx],
[associated radio-type],[priority],[restoral-timer(ms)],[dependencyMet] -->
<!-- the 5th element "resore-time" indicates the number of milliseconds to delay
before automatically restore the default connection. Set -1 if the connection
does not require auto-restore. -->
<!-- the 6th element indicates boot-time dependency-met value. -->
<string-array translatable="false" name="networkAttributes">
<item>wifi,1,1,1,-1,true</item>
<item>mobile,0,0,0,-1,true</item>
<item>mobile_mms,2,0,4,300000,true</item>
<item>mobile_supl,3,0,2,300000,true</item>
<item>mobile_dun,4,0,2,300000,true</item>
<item>mobile_hipri,5,0,3,300000,true</item>
<item>mobile_fota,10,0,2,300000,true</item>
<item>mobile_ims,11,0,2,300000,true</item>
<item>mobile_cbs,12,0,2,300000,true</item>
<item>bluetooth,7,7,2,-1,true</item>
<item>ethernet,9,9,4,-1,true</item>
</string-array>
<!-- This string array should be overridden by the device to present a list of radio
attributes. This is used by the connectivity manager to decide which networks can coexist
based on the hardware -->
@@ -161,23 +138,6 @@
<!-- Whether device supports double tap to wake -->
<bool name="config_supportDoubleTapWake">true</bool>
<!-- Configure mobile tcp buffer sizes in the form:
rat-name:rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max
If no value is found for the rat-name in use, the system default will be applied.
-->
<string-array name="config_mobile_tcp_buffers">
<item>lte:2097152,4194304,8388608,262144,524288,1048576</item>
<item>lte_ca:2097152,4194304,8388608,4096,1048576,2097152</item>
<item>umts:4094,87380,1220608,4096,16384,1220608</item>
<item>hspa:4094,87380,1220608,4096,16384,1220608</item>
<item>hsupa:4094,87380,1220608,4096,16384,1220608</item>
<item>hsdpa:4094,87380,1220608,4096,16384,1220608</item>
<item>hspap:4094,87380,1220608,4096,16384,1220608</item>
<item>edge:4093,26280,35040,4096,16384,35040</item>
<item>gprs:4092,8760,11680,4096,8760,11680</item>
<item>evdo:4094,87380,524288,4096,16384,262144</item>
</string-array>
<!-- Flag specifying whether VoLTE is available on device -->
<bool name="config_device_volte_available">true</bool>

View File

@@ -347,7 +347,6 @@ vendor/etc/xtra_root_cert.pem|f55a31ec4d9cf8ce2724acadecf00c779f8767db
-vendor/lib/libC2D2.so;DISABLE_DEPS|c04a5ac1e576f63ebe91aba14bf917ee9e382be0
-vendor/lib/libCB.so;DISABLE_DEPS|15986a50f98c979833e5d651eedcffaf19e54e3b
-vendor/lib/libOpenCL.so;DISABLE_DEPS|9ee3900265f9b855f526c0ce4fcfdaed51d62003
-vendor/lib/libRSDriver_adreno.so;DISABLE_DEPS|51e8ebcd4584726cbee21a4486b6f37ce5e716f1
-vendor/lib/libadreno_utils.so;DISABLE_DEPS|3a09e6720121f5b459a1fc7f9639b632da5832ec
-vendor/lib/libbccQTI.so;DISABLE_DEPS|124156259b7900ac44c48dd9cf83b210d02d8c9d
-vendor/lib/libc2d30_bltlib.so;DISABLE_DEPS|4a486823ef2a9ea14f4f02c9eb9053ac5fb028af
@@ -355,8 +354,6 @@ vendor/etc/xtra_root_cert.pem|f55a31ec4d9cf8ce2724acadecf00c779f8767db
-vendor/lib/libgsl.so;DISABLE_DEPS|2ddafd66848dfd146bbaf184b69f92df9f79c99f
-vendor/lib/libllvm-glnext.so;DISABLE_DEPS|a28adae3ae758cdffc889d681b3cdefe24351c32
-vendor/lib/libllvm-qcom.so;DISABLE_DEPS|3079ae9049c8758664e6ade78837e0fc6c2272d5
-vendor/lib/librs_adreno.so;DISABLE_DEPS|9f0022a5c38a676a580511749bab3c538ed8b803
-vendor/lib/librs_adreno_sha1.so;DISABLE_DEPS|28201ce01c442df4389273245be313ff4a741d6e
-vendor/lib64/egl/eglSubDriverAndroid.so;DISABLE_DEPS|8edb19893decd259ba43d752b48e0a69c5788db4
-vendor/lib64/egl/libEGL_adreno.so;DISABLE_DEPS|c97c8e14d26f53398c50122daf80a599f077398a
-vendor/lib64/egl/libGLESv1_CM_adreno.so;DISABLE_DEPS|0adf2e094afdc3476198ef8ad52101cf9004eb5d
@@ -367,7 +364,6 @@ vendor/etc/xtra_root_cert.pem|f55a31ec4d9cf8ce2724acadecf00c779f8767db
-vendor/lib64/libC2D2.so;DISABLE_DEPS|ff2d4947c7924376ff66517461246d238e221e05
-vendor/lib64/libCB.so;DISABLE_DEPS|df167809abe16674a61742ba6efb208edd069a3b
-vendor/lib64/libOpenCL.so;DISABLE_DEPS|84c7d8be13885c9346f73c09aaaedc3bce7667d9
-vendor/lib64/libRSDriver_adreno.so;DISABLE_DEPS|e7628b78d034500c64d09fcaf5305971242e1acd
-vendor/lib64/libadreno_utils.so;DISABLE_DEPS|04b3878ea84a99f133934580adfd6905f6cc102b
-vendor/lib64/libbccQTI.so;DISABLE_DEPS|e79ba0450ce215bfb81e518cce310f378314b4e5
-vendor/lib64/libc2d30_bltlib.so;DISABLE_DEPS|644a88f490cc883492d94b9f581127fb33f51415
@@ -375,8 +371,6 @@ vendor/etc/xtra_root_cert.pem|f55a31ec4d9cf8ce2724acadecf00c779f8767db
-vendor/lib64/libgsl.so;DISABLE_DEPS|5453da1723c3b014850165b42236ba26af11a7ad
-vendor/lib64/libllvm-glnext.so;DISABLE_DEPS|dad8139672a9dcff4270a58599aa1b72d13e62fc
-vendor/lib64/libllvm-qcom.so;DISABLE_DEPS|88f4199538ce887c91936bf70eef31615c938aa2
-vendor/lib64/librs_adreno.so;DISABLE_DEPS|e41149794e719c7f743c4d800def68a5c8e5f9ca
-vendor/lib64/librs_adreno_sha1.so;DISABLE_DEPS|f9d28682f9c219dfe086da9f3a15aaddbcd38a05
# Graphics (HDR) - from daisy - QKQ1.191002.002
-vendor/lib/libhdr_tm.so;DISABLE_DEPS|4c371d0931245a65d0b4df768de8837bbdf4832e

19
readfem/Android.bp Normal file
View File

@@ -0,0 +1,19 @@
//
// Copyright (C) 2017-2025 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
cc_binary {
name: "readfem",
vendor: true,
srcs: ["xiaomi_readfem.c"],
shared_libs: [
"libcutils",
"liblog",
],
cflags: [
"-Wall",
"-Werror",
],
}

View File

@@ -1,12 +0,0 @@
LOCAL_PATH:= $(call my-dir)
ifeq ($(strip $(BOARD_HAS_QCOM_WLAN)),true)
include $(CLEAR_VARS)
LOCAL_MODULE := readfem
LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := xiaomi_readfem.c
LOCAL_CFLAGS += -Wall -Werror
LOCAL_SHARED_LIBRARIES := libcutils liblog
include $(BUILD_EXECUTABLE)
endif

16
readmac/Android.bp Normal file
View File

@@ -0,0 +1,16 @@
//
// Copyright (C) 2017-2025 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
cc_binary {
name: "readmac",
vendor: true,
srcs: ["xiaomi_readmac.c"],
shared_libs: ["liblog"],
cflags: [
"-Wall",
"-Werror",
],
}

View File

@@ -1,12 +0,0 @@
LOCAL_PATH:= $(call my-dir)
ifeq ($(strip $(BOARD_HAS_QCOM_WLAN)),true)
include $(CLEAR_VARS)
LOCAL_MODULE := readmac
LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true
LOCAL_SRC_FILES := xiaomi_readmac.c
LOCAL_CFLAGS += -Wall -Werror
LOCAL_SHARED_LIBRARIES := liblog
include $(BUILD_EXECUTABLE)
endif

View File

@@ -50,4 +50,4 @@
/(vendor|system/vendor)/bin/tfa-calib u:object_r:tfa-calib_exec:s0
# HALs
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.touch@1\.0-service\.xiaomi_8996 u:object_r:hal_lineage_touch_default_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.touch-service\.xiaomi u:object_r:hal_lineage_touch_default_exec:s0

View File

@@ -1,32 +0,0 @@
// Copyright (C) 2019-2021 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.
cc_binary {
name: "vendor.lineage.touch@1.0-service.xiaomi_8996",
init_rc: ["vendor.lineage.touch@1.0-service.xiaomi_8996.rc"],
defaults: ["hidl_defaults"],
relative_install_path: "hw",
vendor: true,
srcs: [
"KeyDisabler.cpp",
"KeySwapper.cpp",
"service.cpp"
],
shared_libs: [
"libbase",
"libhidlbase",
"libutils",
"vendor.lineage.touch@1.0",
],
}

View File

@@ -1,68 +0,0 @@
/*
* Copyright (C) 2019,2021 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.
*/
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include "KeyDisabler.h"
using ::android::base::ReadFileToString;
using ::android::base::Trim;
using ::android::base::WriteStringToFile;
namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace implementation {
constexpr const char kControlPath[] = "/proc/touchpanel/capacitive_keys_enable";
KeyDisabler::KeyDisabler() {
has_key_disabler_ = !access(kControlPath, F_OK);
}
// Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow.
Return<bool> KeyDisabler::isEnabled() {
std::string buf;
if (!has_key_disabler_) return false;
if (!ReadFileToString(kControlPath, &buf, true)) {
LOG(ERROR) << "Failed to read from " << kControlPath;
return false;
}
return Trim(buf) == "0";
}
Return<bool> KeyDisabler::setEnabled(bool enabled) {
if (!has_key_disabler_) return false;
if (!WriteStringToFile(enabled ? "0" : "1", kControlPath, true)) {
LOG(ERROR) << "Failed to write to " << kControlPath;
return false;
}
return true;
}
} // namespace implementation
} // namespace V1_0
} // namespace touch
} // namespace lineage
} // namespace vendor

View File

@@ -1,45 +0,0 @@
/*
* Copyright (C) 2019,2021 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.
*/
#pragma once
#include <vendor/lineage/touch/1.0/IKeyDisabler.h>
namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace implementation {
using ::android::hardware::Return;
class KeyDisabler : public IKeyDisabler {
public:
KeyDisabler();
// Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow.
Return<bool> isEnabled() override;
Return<bool> setEnabled(bool enabled) override;
private:
bool has_key_disabler_;
};
} // namespace implementation
} // namespace V1_0
} // namespace touch
} // namespace lineage
} // namespace vendor

View File

@@ -1,81 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include "KeySwapper.h"
using ::android::base::ReadFileToString;
using ::android::base::Trim;
using ::android::base::WriteStringToFile;
namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace implementation {
constexpr const char* kProcButtonsControlPath = "/proc/buttons/reversed_keys_enable";
constexpr const char* kProcTouchpanelControlPath = "/proc/touchpanel/reversed_keys_enable";
KeySwapper::KeySwapper() {
if (!access(kProcButtonsControlPath, F_OK)) {
control_path_ = kProcButtonsControlPath;
} else if (!access(kProcTouchpanelControlPath, F_OK)) {
control_path_ = kProcTouchpanelControlPath;
} else {
control_path_ = nullptr;
}
has_key_swapper_ = control_path_ != nullptr;
}
bool KeySwapper::isSupported() {
return has_key_swapper_;
}
// Methods from ::vendor::lineage::touch::V1_0::IKeySwapper follow.
Return<bool> KeySwapper::isEnabled() {
std::string buf;
if (!has_key_swapper_) return false;
if (!ReadFileToString(control_path_, &buf)) {
LOG(ERROR) << "Failed to read from " << control_path_;
return false;
}
return Trim(buf) == "1";
}
Return<bool> KeySwapper::setEnabled(bool enabled) {
if (!has_key_swapper_) return false;
if (!WriteStringToFile(enabled ? "1" : "0", control_path_, true)) {
LOG(ERROR) << "Failed to write to " << control_path_;
return false;
}
return true;
}
} // namespace implementation
} // namespace V1_0
} // namespace touch
} // namespace lineage
} // namespace vendor

View File

@@ -1,47 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <vendor/lineage/touch/1.0/IKeySwapper.h>
namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace implementation {
using ::android::hardware::Return;
class KeySwapper : public IKeySwapper {
public:
KeySwapper();
bool isSupported();
// Methods from ::vendor::lineage::touch::V1_0::KeySwapper follow.
Return<bool> isEnabled() override;
Return<bool> setEnabled(bool enabled) override;
private:
bool has_key_swapper_;
const char* control_path_;
};
} // namespace implementation
} // namespace V1_0
} // namespace touch
} // namespace lineage
} // namespace vendor

View File

@@ -1,79 +0,0 @@
/*
* Copyright (C) 2019,2021 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.
*/
#define LOG_TAG "vendor.lineage.touch@1.0-service.xiaomi_8996"
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include "KeyDisabler.h"
#include "KeySwapper.h"
using android::OK;
using android::sp;
using android::status_t;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using ::vendor::lineage::touch::V1_0::IKeyDisabler;
using ::vendor::lineage::touch::V1_0::IKeySwapper;
using ::vendor::lineage::touch::V1_0::implementation::KeyDisabler;
using ::vendor::lineage::touch::V1_0::implementation::KeySwapper;
int main() {
sp<KeyDisabler> keyDisabler;
sp<KeySwapper> keySwapper;
status_t status;
LOG(INFO) << "Touch HAL service is starting.";
keyDisabler = new KeyDisabler();
if (keyDisabler == nullptr) {
LOG(ERROR) << "Can not create an instance of Touch HAL KeyDisabler Iface, exiting.";
goto shutdown;
}
keySwapper = new KeySwapper();
if (keySwapper == nullptr) {
LOG(ERROR) << "Can not create an instance of Touch HAL KeySwapper Iface, exiting.";
goto shutdown;
}
configureRpcThreadpool(1, true /*callerWillJoin*/);
status = keyDisabler->registerAsService();
if (status != OK) {
LOG(ERROR) << "Could not register service for Touch HAL KeyDisabler Iface ("
<< status << ")";
goto shutdown;
}
if (keySwapper->isSupported()) {
status = keySwapper->registerAsService();
if (status != OK) {
LOG(ERROR) << "Could not register service for Touch HAL KeySwapper Iface ("
<< status << ")";
goto shutdown;
}
}
LOG(INFO) << "Touch HAL service is ready.";
joinRpcThreadpool();
// Should not pass this line
shutdown:
// In normal operation, we don't expect the thread pool to shutdown
LOG(ERROR) << "Touch HAL service is shutting down.";
return 1;
}

View File

@@ -1,5 +0,0 @@
service vendor.touch-hal-1-0-xiaomi_8996 /vendor/bin/hw/vendor.lineage.touch@1.0-service.xiaomi_8996
interface vendor.lineage.touch@1.0::IKeyDisabler default
class hal
user system
group system