sm8350-common: remove power hal
This commit is contained in:
parent
975bb6dec2
commit
620edf3647
@ -351,10 +351,6 @@ PRODUCT_ENFORCE_RRO_TARGETS := *
|
||||
# Partitions
|
||||
PRODUCT_USE_DYNAMIC_PARTITIONS := true
|
||||
|
||||
# Power
|
||||
# PRODUCT_PACKAGES += \
|
||||
# android.hardware.power@1.3-service.xiaomi_sm8350
|
||||
|
||||
# RCS
|
||||
PRODUCT_PACKAGES += \
|
||||
com.android.ims.rcsmanager \
|
||||
|
@ -1,52 +0,0 @@
|
||||
<!--
|
||||
Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>vendor.qti.hardware.display.mapper</name>
|
||||
<transport arch="32+64">passthrough</transport>
|
||||
<version>3.0</version>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IQtiMapper</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.graphics.mapper</name>
|
||||
<transport arch="32+64">passthrough</transport>
|
||||
<version>3.0</version>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IMapper</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
<!--
|
||||
Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.graphics.allocator</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>3.0</version>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IAllocator</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.qti.hardware.display.allocator</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>3.0</version>
|
||||
<version>4.0</version>
|
||||
<interface>
|
||||
<name>IQtiAllocator</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
@ -1,75 +0,0 @@
|
||||
<!--
|
||||
Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>vendor.qti.hardware.display.composer</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>3.0</version>
|
||||
<interface>
|
||||
<name>IQtiComposer</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.graphics.composer</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.4</version>
|
||||
<interface>
|
||||
<name>IComposer</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.display.config</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.0</version>
|
||||
<interface>
|
||||
<name>IDisplayConfig</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.display.color</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.5</version>
|
||||
<interface>
|
||||
<name>IDisplayColor</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.display.postproc</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IDisplayPostproc</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
@ -1,37 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2018 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.
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.power@1.3-service.xiaomi_sm8350",
|
||||
init_rc: ["android.hardware.power@1.3-service.xiaomi_sm8350.rc"],
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
srcs: [
|
||||
"Power.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
header_libs: [
|
||||
"generated_kernel_headers",
|
||||
],
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libhidlbase",
|
||||
"libutils",
|
||||
"android.hardware.power@1.3",
|
||||
"android.hardware.power@1.2",
|
||||
"android.hardware.power@1.1",
|
||||
"android.hardware.power@1.0",
|
||||
],
|
||||
}
|
137
power/Power.cpp
137
power/Power.cpp
@ -1,137 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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 "android.hardware.power@1.3-service.xiaomi_sm8350"
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "Power.h"
|
||||
|
||||
constexpr static char const* inputDevicesDirectory = "/dev/input/";
|
||||
constexpr static int wakeupModeOn = 5;
|
||||
constexpr static int wakeupModeOff = 4;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace power {
|
||||
namespace V1_3 {
|
||||
namespace implementation {
|
||||
|
||||
// Methods from V1_0::IPower follow.
|
||||
Return<void> Power::setInteractive(bool) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Power::powerHint(PowerHint_1_0, int32_t) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
bool isSupportedInputName(char* name) {
|
||||
return strcmp(name, "fts_ts") == 0
|
||||
|| strcmp(name, "NVTCapacitiveTouchScreen") == 0;
|
||||
}
|
||||
|
||||
int openInputFd() {
|
||||
DIR *dir = opendir(inputDevicesDirectory);
|
||||
if (dir == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct dirent *ent;
|
||||
int fd;
|
||||
int rc;
|
||||
|
||||
while ((ent = readdir(dir)) != NULL) {
|
||||
if (ent->d_type != DT_CHR)
|
||||
continue;
|
||||
|
||||
char absolute_path[PATH_MAX] = {0};
|
||||
char name[80] = {0};
|
||||
|
||||
strcpy(absolute_path, inputDevicesDirectory);
|
||||
strcat(absolute_path, ent->d_name);
|
||||
|
||||
fd = open(absolute_path, O_RDWR);
|
||||
if (fd < 0)
|
||||
continue;
|
||||
|
||||
rc = ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name);
|
||||
if (rc > 0 && isSupportedInputName(name))
|
||||
break;
|
||||
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
Return<void> Power::setFeature(Feature feature, bool activate) {
|
||||
switch (feature) {
|
||||
case Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE: {
|
||||
int fd = openInputFd();
|
||||
if (fd < 0) {
|
||||
ALOGW("No touchscreen input devices that support DT2W were found");
|
||||
return Void();
|
||||
}
|
||||
|
||||
struct input_event ev;
|
||||
ev.type = EV_SYN;
|
||||
ev.code = SYN_CONFIG;
|
||||
ev.value = activate ? wakeupModeOn : wakeupModeOff;
|
||||
write(fd, &ev, sizeof(ev));
|
||||
close(fd);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
|
||||
ALOGI("getPlatformLowPowerStats not supported, do nothing");
|
||||
_hidl_cb({}, Status::SUCCESS);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Methods from V1_1::IPower follow.
|
||||
Return<void> Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) {
|
||||
ALOGI("getSubsystemLowPowerStats not supported, do nothing");
|
||||
_hidl_cb({}, Status::SUCCESS);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Power::powerHintAsync(PowerHint_1_0, int32_t) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Methods from V1_2::IPower follow.
|
||||
Return<void> Power::powerHintAsync_1_2(PowerHint_1_2, int32_t) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Methods from V1_3::IPower follow.
|
||||
Return<void> Power::powerHintAsync_1_3(PowerHint_1_3, int32_t) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_3
|
||||
} // namespace power
|
||||
} // namespace hardware
|
||||
} // namespace android
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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 <android/hardware/power/1.3/IPower.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace power {
|
||||
namespace V1_3 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
|
||||
using ::android::hardware::power::V1_0::Feature;
|
||||
using ::android::hardware::power::V1_0::Status;
|
||||
using PowerHint_1_0 = ::android::hardware::power::V1_0::PowerHint;
|
||||
using PowerHint_1_2 = ::android::hardware::power::V1_2::PowerHint;
|
||||
using PowerHint_1_3 = ::android::hardware::power::V1_3::PowerHint;
|
||||
|
||||
struct Power : public IPower {
|
||||
// Methods from V1_0::IPower follow.
|
||||
Return<void> setInteractive(bool interactive) override;
|
||||
Return<void> powerHint(PowerHint_1_0 hint, int32_t data) override;
|
||||
Return<void> setFeature(V1_0::Feature feature, bool activate) override;
|
||||
Return<void> getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override;
|
||||
|
||||
// Methods from V1_1::IPower follow.
|
||||
Return<void> getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override;
|
||||
Return<void> powerHintAsync(PowerHint_1_0 hint, int32_t data) override;
|
||||
|
||||
// Methods from V1_2::IPower follow.
|
||||
Return<void> powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) override;
|
||||
|
||||
// Methods from V1_3::IPower follow.
|
||||
Return<void> powerHintAsync_1_3(PowerHint_1_3 hint, int32_t data) override;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_3
|
||||
} // namespace power
|
||||
} // namespace hardware
|
||||
} // namespace android
|
@ -1,4 +0,0 @@
|
||||
service vendor.power-hal-1-0 /vendor/bin/hw/android.hardware.power@1.3-service.xiaomi_sm8350
|
||||
class hal
|
||||
user system
|
||||
group system input
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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 "android.hardware.power@1.3-service.xiaomi_sm8350"
|
||||
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
|
||||
#include "Power.h"
|
||||
|
||||
using android::sp;
|
||||
using android::status_t;
|
||||
using android::OK;
|
||||
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
|
||||
using ::android::hardware::power::V1_3::IPower;
|
||||
using ::android::hardware::power::V1_3::implementation::Power;
|
||||
|
||||
int main() {
|
||||
ALOGI("Power HAL 1.3 service is starting");
|
||||
|
||||
sp<IPower> service = new Power();
|
||||
if (service == nullptr) {
|
||||
ALOGE("Failed to create an instance of Power HAL, exiting");
|
||||
return 1;
|
||||
}
|
||||
configureRpcThreadpool(1, true /* callerWillJoin */);
|
||||
|
||||
status_t status = service->registerAsService();
|
||||
if (status != OK) {
|
||||
ALOGE("Failed to register service for Power HAL, exiting");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ALOGI("Power HAL service is ready");
|
||||
joinRpcThreadpool();
|
||||
|
||||
// In normal operation, we don't expect the thread pool to exit
|
||||
ALOGE("Power HAL service is shutting down");
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user