diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index ea8a626..8e3618d 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -175,6 +175,7 @@ TARGET_RECOVERY_WIPE := $(COMMON_PATH)/recovery/recovery.wipe ENABLE_VENDOR_RIL_SERVICE := true # SELinux +include device/lineage/sepolicy/libperfmgr/sepolicy.mk include device/qcom/sepolicy_vndr/SEPolicy.mk BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE := true BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor diff --git a/common.mk b/common.mk index 45c6d73..09be183 100644 --- a/common.mk +++ b/common.mk @@ -333,10 +333,6 @@ PRODUCT_PACKAGES += \ libstagefright_softomx.vendor \ libstagefright_softomx_plugin.vendor -# Perf -PRODUCT_PACKAGES += \ - libqti-perfd-client - # Permissions PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \ @@ -391,7 +387,8 @@ PRODUCT_COPY_FILES += \ # Power PRODUCT_PACKAGES += \ - android.hardware.power-service.moto_sm6375-libperfmgr + android.hardware.power-service.lineage-libperfmgr \ + libqti-perfd-client PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json @@ -436,7 +433,9 @@ PRODUCT_PACKAGES += \ PRODUCT_SOONG_NAMESPACES += \ $(LOCAL_PATH) \ hardware/google/interfaces \ - hardware/google/pixel + hardware/google/pixel \ + hardware/lineage/interfaces/power-libperfmgr \ + hardware/qcom-caf/common/libqti-perfd-client # Telephony PRODUCT_PACKAGES += \ diff --git a/libqti-perfd-client/Android.bp b/libqti-perfd-client/Android.bp deleted file mode 100644 index 010d072..0000000 --- a/libqti-perfd-client/Android.bp +++ /dev/null @@ -1,17 +0,0 @@ -cc_library_shared { - name: "libqti-perfd-client", - proprietary: true, - defaults: ["hidl_defaults"], - srcs: [ - "client.c", - ], - cflags: [ - "-Werror", - "-Wextra", - "-Wall", - ], - shared_libs: [ - "liblog", - "libutils", - ], -} diff --git a/libqti-perfd-client/client.c b/libqti-perfd-client/client.c deleted file mode 100644 index 42b3cdc..0000000 --- a/libqti-perfd-client/client.c +++ /dev/null @@ -1,24 +0,0 @@ -#define LOG_TAG "libqti-perfd-client" - -#include -#include - -void perf_get_feedback() {} -void perf_hint() {} -int perf_lock_acq(int handle, int duration, int arg3[], int arg4) { - ALOGI("perf_lock_acq: handle: %d, duration: %d, arg3[0]: %d, arg4: %d", - handle, duration, arg3[0], arg4); - if (handle > 0) - return handle; - - return 233; -} -void perf_lock_cmd() {} -int perf_lock_rel(int handle) { - ALOGI("perf_lock_rel: handle: %d", handle); - if (handle > 0) - return handle; - - return 233; -} -void perf_lock_use_profile() {} diff --git a/power-libperfmgr/Android.bp b/power-libperfmgr/Android.bp deleted file mode 100644 index 1a628bd..0000000 --- a/power-libperfmgr/Android.bp +++ /dev/null @@ -1,42 +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-service.moto_sm6375-libperfmgr", - relative_install_path: "hw", - init_rc: ["android.hardware.power-service.moto_sm6375-libperfmgr.rc"], - vintf_fragments: ["android.hardware.power-service.moto_sm6375.xml"], - vendor: true, - shared_libs: [ - "android.hardware.power-V2-ndk", - "libbase", - "libcutils", - "liblog", - "libutils", - "libbinder_ndk", - "libdisppower-pixel", - "libperfmgr", - "libprocessgroup", - "pixel-power-ext-V1-ndk", - ], - srcs: [ - "service.cpp", - "Power.cpp", - "InteractionHandler.cpp", - "PowerExt.cpp", - "PowerHintSession.cpp", - "PowerSessionManager.cpp", - ], -} diff --git a/power-libperfmgr/InteractionHandler.cpp b/power-libperfmgr/InteractionHandler.cpp deleted file mode 100644 index a9f908b..0000000 --- a/power-libperfmgr/InteractionHandler.cpp +++ /dev/null @@ -1,283 +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. - */ - -#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL) -#define LOG_TAG "powerhal-libperfmgr" - -#include "InteractionHandler.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define MAX_LENGTH 64 - -#define MSINSEC 1000L -#define NSINMS 1000000L - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -namespace { - -static const bool kDisplayIdleSupport = - ::android::base::GetBoolProperty("vendor.powerhal.disp.idle_support", true); -static const std::array kDispIdlePath = {"/sys/class/drm/card0/device/idle_state", - "/sys/class/graphics/fb0/idle_state"}; -static const uint32_t kWaitMs = - ::android::base::GetUintProperty("vendor.powerhal.disp.idle_wait", /*default*/ 100U); -static const uint32_t kMinDurationMs = - ::android::base::GetUintProperty("vendor.powerhal.interaction.min", /*default*/ 1400U); -static const uint32_t kMaxDurationMs = - ::android::base::GetUintProperty("vendor.powerhal.interaction.max", /*default*/ 5650U); -static const uint32_t kDurationOffsetMs = - ::android::base::GetUintProperty("vendor.powerhal.interaction.offset", /*default*/ 650U); - -static size_t CalcTimespecDiffMs(struct timespec start, struct timespec end) { - size_t diff_in_ms = 0; - diff_in_ms += (end.tv_sec - start.tv_sec) * MSINSEC; - diff_in_ms += (end.tv_nsec - start.tv_nsec) / NSINMS; - return diff_in_ms; -} - -static int FbIdleOpen(void) { - int fd; - for (const auto &path : kDispIdlePath) { - fd = open(path, O_RDONLY); - if (fd >= 0) - return fd; - } - ALOGE("Unable to open fb idle state path (%d)", errno); - return -1; -} - -} // namespace - -using ::android::perfmgr::HintManager; - -InteractionHandler::InteractionHandler() - : mState(INTERACTION_STATE_UNINITIALIZED), mDurationMs(0) {} - -InteractionHandler::~InteractionHandler() { - Exit(); -} - -bool InteractionHandler::Init() { - std::lock_guard lk(mLock); - - if (mState != INTERACTION_STATE_UNINITIALIZED) - return true; - - int fd = FbIdleOpen(); - if (fd < 0) - return false; - mIdleFd = fd; - - mEventFd = eventfd(0, EFD_NONBLOCK); - if (mEventFd < 0) { - ALOGE("Unable to create event fd (%d)", errno); - close(mIdleFd); - return false; - } - - mState = INTERACTION_STATE_IDLE; - mThread = std::unique_ptr(new std::thread(&InteractionHandler::Routine, this)); - - return true; -} - -void InteractionHandler::Exit() { - std::unique_lock lk(mLock); - if (mState == INTERACTION_STATE_UNINITIALIZED) - return; - - AbortWaitLocked(); - mState = INTERACTION_STATE_UNINITIALIZED; - lk.unlock(); - - mCond.notify_all(); - mThread->join(); - - close(mEventFd); - close(mIdleFd); -} - -void InteractionHandler::PerfLock() { - ALOGV("%s: acquiring perf lock", __func__); - if (!HintManager::GetInstance()->DoHint("INTERACTION")) { - ALOGE("%s: do hint INTERACTION failed", __func__); - } -} - -void InteractionHandler::PerfRel() { - ALOGV("%s: releasing perf lock", __func__); - if (!HintManager::GetInstance()->EndHint("INTERACTION")) { - ALOGE("%s: end hint INTERACTION failed", __func__); - } -} - -void InteractionHandler::Acquire(int32_t duration) { - ATRACE_CALL(); - - std::lock_guard lk(mLock); - - int inputDuration = duration + kDurationOffsetMs; - int finalDuration; - if (inputDuration > kMaxDurationMs) - finalDuration = kMaxDurationMs; - else if (inputDuration > kMinDurationMs) - finalDuration = inputDuration; - else - finalDuration = kMinDurationMs; - - // Fallback to do boost directly - // 1) override property is set OR - // 2) InteractionHandler not initialized - if (!kDisplayIdleSupport || mState == INTERACTION_STATE_UNINITIALIZED) { - HintManager::GetInstance()->DoHint("INTERACTION", std::chrono::milliseconds(finalDuration)); - return; - } - - struct timespec cur_timespec; - clock_gettime(CLOCK_MONOTONIC, &cur_timespec); - if (mState != INTERACTION_STATE_IDLE && finalDuration <= mDurationMs) { - size_t elapsed_time = CalcTimespecDiffMs(mLastTimespec, cur_timespec); - // don't hint if previous hint's duration covers this hint's duration - if (elapsed_time <= (mDurationMs - finalDuration)) { - ALOGV("%s: Previous duration (%d) cover this (%d) elapsed: %lld", __func__, - static_cast(mDurationMs), static_cast(finalDuration), - static_cast(elapsed_time)); - return; - } - } - mLastTimespec = cur_timespec; - mDurationMs = finalDuration; - - ALOGV("%s: input: %d final duration: %d", __func__, duration, finalDuration); - - if (mState == INTERACTION_STATE_WAITING) - AbortWaitLocked(); - else if (mState == INTERACTION_STATE_IDLE) - PerfLock(); - - mState = INTERACTION_STATE_INTERACTION; - mCond.notify_one(); -} - -void InteractionHandler::Release() { - std::lock_guard lk(mLock); - if (mState == INTERACTION_STATE_WAITING) { - ATRACE_CALL(); - PerfRel(); - mState = INTERACTION_STATE_IDLE; - } else { - // clear any wait aborts pending in event fd - uint64_t val; - ssize_t ret = read(mEventFd, &val, sizeof(val)); - - ALOGW_IF(ret < 0, "%s: failed to clear eventfd (%zd, %d)", __func__, ret, errno); - } -} - -// should be called while locked -void InteractionHandler::AbortWaitLocked() { - uint64_t val = 1; - ssize_t ret = write(mEventFd, &val, sizeof(val)); - if (ret != sizeof(val)) - ALOGW("Unable to write to event fd (%zd)", ret); -} - -void InteractionHandler::WaitForIdle(int32_t wait_ms, int32_t timeout_ms) { - char data[MAX_LENGTH]; - ssize_t ret; - struct pollfd pfd[2]; - - ATRACE_CALL(); - - ALOGV("%s: wait:%d timeout:%d", __func__, wait_ms, timeout_ms); - - pfd[0].fd = mEventFd; - pfd[0].events = POLLIN; - pfd[1].fd = mIdleFd; - pfd[1].events = POLLPRI | POLLERR; - - ret = poll(pfd, 1, wait_ms); - if (ret > 0) { - ALOGV("%s: wait aborted", __func__); - return; - } else if (ret < 0) { - ALOGE("%s: error in poll while waiting", __func__); - return; - } - - ret = pread(mIdleFd, data, sizeof(data), 0); - if (!ret) { - ALOGE("%s: Unexpected EOF!", __func__); - return; - } - - if (!strncmp(data, "idle", 4)) { - ALOGV("%s: already idle", __func__); - return; - } - - ret = poll(pfd, 2, timeout_ms); - if (ret < 0) - ALOGE("%s: Error on waiting for idle (%zd)", __func__, ret); - else if (ret == 0) - ALOGV("%s: timed out waiting for idle", __func__); - else if (pfd[0].revents) - ALOGV("%s: wait for idle aborted", __func__); - else if (pfd[1].revents) - ALOGV("%s: idle detected", __func__); -} - -void InteractionHandler::Routine() { - pthread_setname_np(pthread_self(), "DispIdle"); - std::unique_lock lk(mLock, std::defer_lock); - - while (true) { - lk.lock(); - mCond.wait(lk, [&] { return mState != INTERACTION_STATE_IDLE; }); - if (mState == INTERACTION_STATE_UNINITIALIZED) - return; - mState = INTERACTION_STATE_WAITING; - lk.unlock(); - - WaitForIdle(kWaitMs, mDurationMs); - Release(); - } -} - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/InteractionHandler.h b/power-libperfmgr/InteractionHandler.h deleted file mode 100644 index c88f7d4..0000000 --- a/power-libperfmgr/InteractionHandler.h +++ /dev/null @@ -1,71 +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. - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -enum InteractionState { - INTERACTION_STATE_UNINITIALIZED, - INTERACTION_STATE_IDLE, - INTERACTION_STATE_INTERACTION, - INTERACTION_STATE_WAITING, -}; - -class InteractionHandler { - public: - InteractionHandler(); - ~InteractionHandler(); - bool Init(); - void Exit(); - void Acquire(int32_t duration); - - private: - void Release(); - void WaitForIdle(int32_t wait_ms, int32_t timeout_ms); - void AbortWaitLocked(); - void Routine(); - - void PerfLock(); - void PerfRel(); - - enum InteractionState mState; - int mIdleFd; - int mEventFd; - int32_t mDurationMs; - struct timespec mLastTimespec; - std::unique_ptr mThread; - std::mutex mLock; - std::condition_variable mCond; -}; - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp deleted file mode 100644 index ee2ee4a..0000000 --- a/power-libperfmgr/Power.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (C) 2020 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. - */ - -#define LOG_TAG "powerhal-libperfmgr" - -#include "Power.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "PowerHintSession.h" -#include "PowerSessionManager.h" - -#define TAP_TO_WAKE_NODE "/sys/class/sensors/dt-gesture/enable" - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -using ::aidl::google::hardware::power::impl::pixel::PowerHintSession; -using ::android::perfmgr::HintManager; - -constexpr char kPowerHalStateProp[] = "vendor.powerhal.state"; -constexpr char kPowerHalAudioProp[] = "vendor.powerhal.audio"; -constexpr char kPowerHalRenderingProp[] = "vendor.powerhal.rendering"; - -static const std::vector kAlwaysAllowedModes = { - Mode::DOUBLE_TAP_TO_WAKE, - Mode::INTERACTIVE, - Mode::DEVICE_IDLE, - Mode::DISPLAY_INACTIVE, -}; - -Power::Power() - : mInteractionHandler(nullptr), - mSustainedPerfModeOn(false), - mBatterySaverOn(false) { - mInteractionHandler = std::make_unique(); - mInteractionHandler->Init(); - - std::string state = ::android::base::GetProperty(kPowerHalStateProp, ""); - if (state == "SUSTAINED_PERFORMANCE") { - LOG(INFO) << "Initialize with SUSTAINED_PERFORMANCE on"; - HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE"); - mSustainedPerfModeOn = true; - } else { - LOG(INFO) << "Initialize PowerHAL"; - } - - state = ::android::base::GetProperty(kPowerHalAudioProp, ""); - if (state == "AUDIO_STREAMING_LOW_LATENCY") { - LOG(INFO) << "Initialize with AUDIO_LOW_LATENCY on"; - HintManager::GetInstance()->DoHint(state); - } - - state = ::android::base::GetProperty(kPowerHalRenderingProp, ""); - if (state == "EXPENSIVE_RENDERING") { - LOG(INFO) << "Initialize with EXPENSIVE_RENDERING on"; - HintManager::GetInstance()->DoHint("EXPENSIVE_RENDERING"); - } -} - -static void endAllHints() { - std::shared_ptr hm = HintManager::GetInstance(); - for (auto hint : hm->GetHints()) { - if (std::any_of(kAlwaysAllowedModes.begin(), kAlwaysAllowedModes.end(), - [hint](auto mode) { return hint == toString(mode); })) { - continue; - } - hm->EndHint(hint); - } -} - -ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { - LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled; - if (HintManager::GetInstance()->GetAdpfProfile() && - HintManager::GetInstance()->GetAdpfProfile()->mReportingRateLimitNs > 0) { - PowerSessionManager::getInstance()->updateHintMode(toString(type), enabled); - } - switch (type) { -#ifdef TAP_TO_WAKE_NODE - case Mode::DOUBLE_TAP_TO_WAKE: - ::android::base::WriteStringToFile(enabled ? "1" : "0", TAP_TO_WAKE_NODE, true); - break; -#endif - case Mode::SUSTAINED_PERFORMANCE: - if (enabled) { - endAllHints(); - HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE"); - } else { - HintManager::GetInstance()->EndHint("SUSTAINED_PERFORMANCE"); - } - mSustainedPerfModeOn = enabled; - break; - case Mode::LOW_POWER: - if (enabled) { - endAllHints(); - HintManager::GetInstance()->DoHint("LOW_POWER"); - } else { - HintManager::GetInstance()->EndHint("LOW_POWER"); - } - mBatterySaverOn = enabled; - break; - case Mode::LAUNCH: - [[fallthrough]]; -#ifndef TAP_TO_WAKE_NODE - case Mode::DOUBLE_TAP_TO_WAKE: - [[fallthrough]]; -#endif - case Mode::FIXED_PERFORMANCE: - [[fallthrough]]; - case Mode::EXPENSIVE_RENDERING: - [[fallthrough]]; - case Mode::INTERACTIVE: - [[fallthrough]]; - case Mode::DEVICE_IDLE: - [[fallthrough]]; - case Mode::DISPLAY_INACTIVE: - [[fallthrough]]; - case Mode::AUDIO_STREAMING_LOW_LATENCY: - [[fallthrough]]; - default: - if ((mBatterySaverOn || mSustainedPerfModeOn) && std::find(kAlwaysAllowedModes.begin(), - kAlwaysAllowedModes.end(), type) == kAlwaysAllowedModes.end()) { - break; - } - if (enabled) { - HintManager::GetInstance()->DoHint(toString(type)); - } else { - HintManager::GetInstance()->EndHint(toString(type)); - } - break; - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Power::isModeSupported(Mode type, bool *_aidl_return) { - bool supported = type == Mode::LOW_POWER - || HintManager::GetInstance()->IsHintSupported(toString(type)); -#ifdef TAP_TO_WAKE_NODE - if (type == Mode::DOUBLE_TAP_TO_WAKE) { - supported = true; - } -#endif - LOG(INFO) << "Power mode " << toString(type) << " isModeSupported: " << supported; - *_aidl_return = supported; - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Power::setBoost(Boost type, int32_t durationMs) { - LOG(DEBUG) << "Power setBoost: " << toString(type) << " duration: " << durationMs; - if (HintManager::GetInstance()->GetAdpfProfile() && - HintManager::GetInstance()->GetAdpfProfile()->mReportingRateLimitNs > 0) { - PowerSessionManager::getInstance()->updateHintBoost(toString(type), durationMs); - } - switch (type) { - case Boost::INTERACTION: - if (mSustainedPerfModeOn || mBatterySaverOn) { - break; - } - mInteractionHandler->Acquire(durationMs); - break; - case Boost::DISPLAY_UPDATE_IMMINENT: - [[fallthrough]]; - case Boost::ML_ACC: - [[fallthrough]]; - case Boost::AUDIO_LAUNCH: - [[fallthrough]]; - default: - if (mSustainedPerfModeOn || mBatterySaverOn) { - break; - } - if (durationMs > 0) { - HintManager::GetInstance()->DoHint(toString(type), - std::chrono::milliseconds(durationMs)); - } else if (durationMs == 0) { - HintManager::GetInstance()->DoHint(toString(type)); - } else { - HintManager::GetInstance()->EndHint(toString(type)); - } - break; - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Power::isBoostSupported(Boost type, bool *_aidl_return) { - bool supported = HintManager::GetInstance()->IsHintSupported(toString(type)); - LOG(INFO) << "Power boost " << toString(type) << " isBoostSupported: " << supported; - *_aidl_return = supported; - return ndk::ScopedAStatus::ok(); -} - -constexpr const char *boolToString(bool b) { - return b ? "true" : "false"; -} - -binder_status_t Power::dump(int fd, const char **, uint32_t) { - std::string buf(::android::base::StringPrintf( - "HintManager Running: %s\n" - "SustainedPerformanceMode: %s\n" - "BatterySaverMode: %s\n", - boolToString(HintManager::GetInstance()->IsRunning()), - boolToString(mSustainedPerfModeOn), - boolToString(mBatterySaverOn))); - // Dump nodes through libperfmgr - HintManager::GetInstance()->DumpToFd(fd); - PowerSessionManager::getInstance()->dumpToFd(fd); - if (!::android::base::WriteStringToFd(buf, fd)) { - PLOG(ERROR) << "Failed to dump state to fd"; - } - fsync(fd); - return STATUS_OK; -} - -ndk::ScopedAStatus Power::createHintSession(int32_t tgid, int32_t uid, - const std::vector &threadIds, - int64_t durationNanos, - std::shared_ptr *_aidl_return) { - if (!HintManager::GetInstance()->GetAdpfProfile() || - HintManager::GetInstance()->GetAdpfProfile()->mReportingRateLimitNs <= 0) { - *_aidl_return = nullptr; - return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); - } - if (threadIds.size() == 0) { - LOG(ERROR) << "Error: threadIds.size() shouldn't be " << threadIds.size(); - *_aidl_return = nullptr; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); - } - std::shared_ptr session = ndk::SharedRefBase::make( - tgid, uid, threadIds, durationNanos); - *_aidl_return = session; - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Power::getHintSessionPreferredRate(int64_t *outNanoseconds) { - *outNanoseconds = HintManager::GetInstance()->GetAdpfProfile() - ? HintManager::GetInstance()->GetAdpfProfile()->mReportingRateLimitNs - : 0; - if (*outNanoseconds <= 0) { - return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); - } - - return ndk::ScopedAStatus::ok(); -} - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/Power.h b/power-libperfmgr/Power.h deleted file mode 100644 index 4e43da2..0000000 --- a/power-libperfmgr/Power.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2020 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. - */ - -#pragma once - -#include - -#include -#include -#include - -#include "InteractionHandler.h" - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -using ::aidl::android::hardware::power::Boost; -using ::aidl::android::hardware::power::IPowerHintSession; -using ::aidl::android::hardware::power::Mode; - -class Power : public ::aidl::android::hardware::power::BnPower { - public: - Power(); - ndk::ScopedAStatus setMode(Mode type, bool enabled) override; - ndk::ScopedAStatus isModeSupported(Mode type, bool *_aidl_return) override; - ndk::ScopedAStatus setBoost(Boost type, int32_t durationMs) override; - ndk::ScopedAStatus isBoostSupported(Boost type, bool *_aidl_return) override; - ndk::ScopedAStatus createHintSession(int32_t tgid, int32_t uid, - const std::vector &threadIds, - int64_t durationNanos, - std::shared_ptr *_aidl_return) override; - ndk::ScopedAStatus getHintSessionPreferredRate(int64_t *outNanoseconds) override; - binder_status_t dump(int fd, const char **args, uint32_t numArgs) override; - - private: - std::unique_ptr mInteractionHandler; - std::atomic mSustainedPerfModeOn; - std::atomic mBatterySaverOn; -}; - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/PowerExt.cpp b/power-libperfmgr/PowerExt.cpp deleted file mode 100644 index 6bd61fb..0000000 --- a/power-libperfmgr/PowerExt.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2020 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. - */ - -#define LOG_TAG "android.hardware.power-service.realme_sm6375.ext-libperfmgr" - -#include "PowerExt.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "PowerSessionManager.h" - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -using ::android::perfmgr::HintManager; - -ndk::ScopedAStatus PowerExt::setMode(const std::string &mode, bool enabled) { - LOG(DEBUG) << "PowerExt setMode: " << mode << " to: " << enabled; - - if (enabled) { - HintManager::GetInstance()->DoHint(mode); - } else { - HintManager::GetInstance()->EndHint(mode); - } - if (HintManager::GetInstance()->GetAdpfProfile() && - HintManager::GetInstance()->GetAdpfProfile()->mReportingRateLimitNs > 0) { - PowerSessionManager::getInstance()->updateHintMode(mode, enabled); - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus PowerExt::isModeSupported(const std::string &mode, bool *_aidl_return) { - bool supported = HintManager::GetInstance()->IsHintSupported(mode); - LOG(INFO) << "PowerExt mode " << mode << " isModeSupported: " << supported; - *_aidl_return = supported; - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus PowerExt::setBoost(const std::string &boost, int32_t durationMs) { - LOG(DEBUG) << "PowerExt setBoost: " << boost << " duration: " << durationMs; - if (HintManager::GetInstance()->GetAdpfProfile() && - HintManager::GetInstance()->GetAdpfProfile()->mReportingRateLimitNs > 0) { - PowerSessionManager::getInstance()->updateHintBoost(boost, durationMs); - } - - if (durationMs > 0) { - HintManager::GetInstance()->DoHint(boost, std::chrono::milliseconds(durationMs)); - } else if (durationMs == 0) { - HintManager::GetInstance()->DoHint(boost); - } else { - HintManager::GetInstance()->EndHint(boost); - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus PowerExt::isBoostSupported(const std::string &boost, bool *_aidl_return) { - bool supported = HintManager::GetInstance()->IsHintSupported(boost); - LOG(INFO) << "PowerExt boost " << boost << " isBoostSupported: " << supported; - *_aidl_return = supported; - return ndk::ScopedAStatus::ok(); -} - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/PowerExt.h b/power-libperfmgr/PowerExt.h deleted file mode 100644 index bed12b5..0000000 --- a/power-libperfmgr/PowerExt.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2020 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. - */ - -#pragma once - -#include -#include -#include - -#include -#include - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -class PowerExt : public ::aidl::google::hardware::power::extension::pixel::BnPowerExt { - public: - PowerExt() {} - ndk::ScopedAStatus setMode(const std::string &mode, bool enabled) override; - ndk::ScopedAStatus isModeSupported(const std::string &mode, bool *_aidl_return) override; - ndk::ScopedAStatus setBoost(const std::string &boost, int32_t durationMs) override; - ndk::ScopedAStatus isBoostSupported(const std::string &boost, bool *_aidl_return) override; - - private: -}; - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/PowerHintSession.cpp b/power-libperfmgr/PowerHintSession.cpp deleted file mode 100644 index c481977..0000000 --- a/power-libperfmgr/PowerHintSession.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright 2021 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. - */ - -#define LOG_TAG "powerhal-libperfmgr" -#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL) - -#include "PowerHintSession.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "PowerSessionManager.h" - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -using ::android::base::StringPrintf; -using ::android::perfmgr::AdpfConfig; -using ::android::perfmgr::HintManager; -using std::chrono::duration_cast; -using std::chrono::nanoseconds; - -namespace { - -static inline int64_t ns_to_100us(int64_t ns) { - return ns / 100000; -} - -} // namespace - -int64_t PowerHintSession::convertWorkDurationToBoostByPid( - const std::vector &actualDurations) { - std::shared_ptr adpfConfig = HintManager::GetInstance()->GetAdpfProfile(); - const nanoseconds &targetDuration = mDescriptor->duration; - int64_t &integral_error = mDescriptor->integral_error; - int64_t &previous_error = mDescriptor->previous_error; - uint64_t samplingWindowP = adpfConfig->mSamplingWindowP; - uint64_t samplingWindowI = adpfConfig->mSamplingWindowI; - uint64_t samplingWindowD = adpfConfig->mSamplingWindowD; - int64_t targetDurationNanos = (int64_t)targetDuration.count(); - int64_t length = actualDurations.size(); - int64_t p_start = - samplingWindowP == 0 || samplingWindowP > length ? 0 : length - samplingWindowP; - int64_t i_start = - samplingWindowI == 0 || samplingWindowI > length ? 0 : length - samplingWindowI; - int64_t d_start = - samplingWindowD == 0 || samplingWindowD > length ? 0 : length - samplingWindowD; - int64_t dt = ns_to_100us(targetDurationNanos); - int64_t err_sum = 0; - int64_t derivative_sum = 0; - for (int64_t i = std::min({p_start, i_start, d_start}); i < length; i++) { - int64_t actualDurationNanos = actualDurations[i].durationNanos; - if (std::abs(actualDurationNanos) > targetDurationNanos * 20) { - ALOGW("The actual duration is way far from the target (%" PRId64 " >> %" PRId64 ")", - actualDurationNanos, targetDurationNanos); - } - // PID control algorithm - int64_t error = ns_to_100us(actualDurationNanos - targetDurationNanos); - if (i >= d_start) { - derivative_sum += error - previous_error; - } - if (i >= p_start) { - err_sum += error; - } - if (i >= i_start) { - integral_error += error * dt; - integral_error = std::min(adpfConfig->getPidIHighDivI(), integral_error); - integral_error = std::max(adpfConfig->getPidILowDivI(), integral_error); - } - previous_error = error; - } - int64_t pOut = static_cast((err_sum > 0 ? adpfConfig->mPidPo : adpfConfig->mPidPu) * - err_sum / (length - p_start)); - int64_t iOut = static_cast(adpfConfig->mPidI * integral_error); - int64_t dOut = - static_cast((derivative_sum > 0 ? adpfConfig->mPidDo : adpfConfig->mPidDu) * - derivative_sum / dt / (length - d_start)); - - int64_t output = pOut + iOut + dOut; - if (ATRACE_ENABLED()) { - traceSessionVal("pid.err", err_sum / (length - p_start)); - traceSessionVal("pid.integral", integral_error); - traceSessionVal("pid.derivative", derivative_sum / dt / (length - d_start)); - traceSessionVal("pid.pOut", pOut); - traceSessionVal("pid.iOut", iOut); - traceSessionVal("pid.dOut", dOut); - traceSessionVal("pid.output", output); - } - return output; -} - -PowerHintSession::PowerHintSession(int32_t tgid, int32_t uid, const std::vector &threadIds, - int64_t durationNanos) { - mDescriptor = new AppHintDesc(tgid, uid, threadIds); - mDescriptor->duration = std::chrono::nanoseconds(durationNanos); - mIdString = StringPrintf("%" PRId32 "-%" PRId32 "-%" PRIxPTR, mDescriptor->tgid, - mDescriptor->uid, reinterpret_cast(this) & 0xffff); - mStaleTimerHandler = sp(new StaleTimerHandler(this)); - mPowerManagerHandler = PowerSessionManager::getInstance(); - mLastUpdatedTime.store(std::chrono::steady_clock::now()); - if (ATRACE_ENABLED()) { - traceSessionVal("target", mDescriptor->duration.count()); - traceSessionVal("active", mDescriptor->is_active.load()); - } - PowerSessionManager::getInstance()->addPowerSession(this); - // init boost - setSessionUclampMin(HintManager::GetInstance()->GetAdpfProfile()->mUclampMinInit); - ALOGV("PowerHintSession created: %s", mDescriptor->toString().c_str()); -} - -PowerHintSession::~PowerHintSession() { - close(); - ALOGV("PowerHintSession deleted: %s", mDescriptor->toString().c_str()); - if (ATRACE_ENABLED()) { - traceSessionVal("target", 0); - traceSessionVal("actl_last", 0); - traceSessionVal("active", 0); - } - delete mDescriptor; -} - -void PowerHintSession::traceSessionVal(char const *identifier, int64_t val) const { - ATRACE_INT(StringPrintf("adpf.%s-%s", mIdString.c_str(), identifier).c_str(), val); -} - -bool PowerHintSession::isAppSession() { - // Check if uid is in range reserved for applications - return mDescriptor->uid >= AID_APP_START; -} - -void PowerHintSession::updateUniveralBoostMode() { - if (!isAppSession()) { - return; - } - if (ATRACE_ENABLED()) { - const std::string tag = StringPrintf("%s:updateUniveralBoostMode()", mIdString.c_str()); - ATRACE_BEGIN(tag.c_str()); - } - PowerHintMonitor::getInstance()->getLooper()->sendMessage(mPowerManagerHandler, NULL); - if (ATRACE_ENABLED()) { - ATRACE_END(); - } -} - -void PowerHintSession::tryToSendPowerHint(std::string hint) { - if (!mSupportedHints[hint].has_value()) { - mSupportedHints[hint] = HintManager::GetInstance()->IsHintSupported(hint); - } - if (mSupportedHints[hint].value()) { - HintManager::GetInstance()->DoHint(hint); - } -} - -int PowerHintSession::setSessionUclampMin(int32_t min) { - { - std::lock_guard guard(mSessionLock); - mDescriptor->current_min = min; - } - if (min) { - mStaleTimerHandler->updateTimer(); - } - PowerSessionManager::getInstance()->setUclampMin(this, min); - - if (ATRACE_ENABLED()) { - traceSessionVal("min", min); - } - return 0; -} - -int PowerHintSession::getUclampMin() { - return mDescriptor->current_min; -} - -void PowerHintSession::dumpToStream(std::ostream &stream) { - stream << "ID.Min.Act.Timeout(" << mIdString; - stream << ", " << mDescriptor->current_min; - stream << ", " << mDescriptor->is_active; - stream << ", " << isTimeout() << ")"; -} - -ndk::ScopedAStatus PowerHintSession::pause() { - if (mSessionClosed) { - ALOGE("Error: session is dead"); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - if (!mDescriptor->is_active.load()) - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - // Reset to default uclamp value. - mDescriptor->is_active.store(false); - setStale(); - if (ATRACE_ENABLED()) { - traceSessionVal("active", mDescriptor->is_active.load()); - } - updateUniveralBoostMode(); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus PowerHintSession::resume() { - if (mSessionClosed) { - ALOGE("Error: session is dead"); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - if (mDescriptor->is_active.load()) - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - mDescriptor->is_active.store(true); - // resume boost - setSessionUclampMin(mDescriptor->current_min); - if (ATRACE_ENABLED()) { - traceSessionVal("active", mDescriptor->is_active.load()); - } - updateUniveralBoostMode(); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus PowerHintSession::close() { - bool sessionClosedExpectedToBe = false; - if (!mSessionClosed.compare_exchange_strong(sessionClosedExpectedToBe, true)) { - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - // Remove the session from PowerSessionManager first to avoid racing. - PowerSessionManager::getInstance()->removePowerSession(this); - mStaleTimerHandler->setSessionDead(); - setSessionUclampMin(0); - mDescriptor->is_active.store(false); - updateUniveralBoostMode(); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus PowerHintSession::updateTargetWorkDuration(int64_t targetDurationNanos) { - if (mSessionClosed) { - ALOGE("Error: session is dead"); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - if (targetDurationNanos <= 0) { - ALOGE("Error: targetDurationNanos(%" PRId64 ") should bigger than 0", targetDurationNanos); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); - } - targetDurationNanos = - targetDurationNanos * HintManager::GetInstance()->GetAdpfProfile()->mTargetTimeFactor; - ALOGV("update target duration: %" PRId64 " ns", targetDurationNanos); - - mDescriptor->duration = std::chrono::nanoseconds(targetDurationNanos); - if (ATRACE_ENABLED()) { - traceSessionVal("target", mDescriptor->duration.count()); - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus PowerHintSession::reportActualWorkDuration( - const std::vector &actualDurations) { - if (mSessionClosed) { - ALOGE("Error: session is dead"); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - if (mDescriptor->duration.count() == 0LL) { - ALOGE("Expect to call updateTargetWorkDuration() first."); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - if (actualDurations.size() == 0) { - ALOGE("Error: duration.size() shouldn't be %zu.", actualDurations.size()); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); - } - if (!mDescriptor->is_active.load()) { - ALOGE("Error: shouldn't report duration during pause state."); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - std::shared_ptr adpfConfig = HintManager::GetInstance()->GetAdpfProfile(); - mDescriptor->update_count++; - bool isFirstFrame = isTimeout(); - if (ATRACE_ENABLED()) { - traceSessionVal("batch_size", actualDurations.size()); - traceSessionVal("actl_last", actualDurations.back().durationNanos); - traceSessionVal("target", mDescriptor->duration.count()); - traceSessionVal("hint.count", mDescriptor->update_count); - traceSessionVal("hint.overtime", - actualDurations.back().durationNanos - mDescriptor->duration.count() > 0); - traceSessionVal("session_hint", -1); - } - - mLastUpdatedTime.store(std::chrono::steady_clock::now()); - if (isFirstFrame) { - if (isAppSession()) { - tryToSendPowerHint("ADPF_FIRST_FRAME"); - } - updateUniveralBoostMode(); - } - - if (!adpfConfig->mPidOn) { - setSessionUclampMin(adpfConfig->mUclampMinHigh); - return ndk::ScopedAStatus::ok(); - } - int64_t output = convertWorkDurationToBoostByPid(actualDurations); - - /* apply to all the threads in the group */ - int next_min = std::min(static_cast(adpfConfig->mUclampMinHigh), - mDescriptor->current_min + static_cast(output)); - next_min = std::max(static_cast(adpfConfig->mUclampMinLow), next_min); - setSessionUclampMin(next_min); - - return ndk::ScopedAStatus::ok(); -} - -std::string AppHintDesc::toString() const { - std::string out = - StringPrintf("session %" PRIxPTR "\n", reinterpret_cast(this) & 0xffff); - const int64_t durationNanos = duration.count(); - out.append(StringPrintf(" duration: %" PRId64 " ns\n", durationNanos)); - out.append(StringPrintf(" uclamp.min: %d \n", current_min)); - out.append(StringPrintf(" uid: %d, tgid: %d\n", uid, tgid)); - - out.append(" threadIds: ["); - bool first = true; - for (int tid : threadIds) { - if (!first) { - out.append(", "); - } - out.append(std::to_string(tid)); - first = false; - } - out.append("]\n"); - return out; -} - -bool PowerHintSession::isActive() { - return mDescriptor->is_active.load(); -} - -bool PowerHintSession::isTimeout() { - auto now = std::chrono::steady_clock::now(); - time_point staleTime = - mLastUpdatedTime.load() + - nanoseconds(static_cast( - mDescriptor->duration.count() * - HintManager::GetInstance()->GetAdpfProfile()->mStaleTimeFactor)); - return now >= staleTime; -} - -const std::vector &PowerHintSession::getTidList() const { - return mDescriptor->threadIds; -} - -void PowerHintSession::setStale() { - // Reset to default uclamp value. - PowerSessionManager::getInstance()->setUclampMin(this, 0); - // Deliver a task to check if all sessions are inactive. - updateUniveralBoostMode(); - if (ATRACE_ENABLED()) { - traceSessionVal("min", 0); - } -} - -void PowerHintSession::StaleTimerHandler::updateTimer() { - auto now = std::chrono::steady_clock::now(); - nanoseconds staleDuration = std::chrono::nanoseconds( - static_cast(mSession->mDescriptor->duration.count() * - HintManager::GetInstance()->GetAdpfProfile()->mStaleTimeFactor)); - mStaleTime.store(now + staleDuration); - int64_t next = static_cast(staleDuration.count()); - { - std::lock_guard guard(mMessageLock); - PowerHintMonitor::getInstance()->getLooper()->removeMessages(mSession->mStaleTimerHandler); - PowerHintMonitor::getInstance()->getLooper()->sendMessageDelayed( - next, mSession->mStaleTimerHandler, NULL); - } - if (ATRACE_ENABLED()) { - mSession->traceSessionVal("timer.stale", 0); - } -} - -void PowerHintSession::StaleTimerHandler::handleMessage(const Message &) { - std::lock_guard guard(mClosedLock); - if (mIsSessionDead) { - return; - } - auto now = std::chrono::steady_clock::now(); - int64_t next = - static_cast(duration_cast(mStaleTime.load() - now).count()); - if (next > 0) { - // Schedule for the stale timeout check. - std::lock_guard guard(mMessageLock); - PowerHintMonitor::getInstance()->getLooper()->removeMessages(mSession->mStaleTimerHandler); - PowerHintMonitor::getInstance()->getLooper()->sendMessageDelayed( - next, mSession->mStaleTimerHandler, NULL); - } else { - mSession->setStale(); - if (ATRACE_ENABLED()) { - mSession->traceSessionVal("session_hint", -1); - } - } - if (ATRACE_ENABLED()) { - mSession->traceSessionVal("timer.stale", next > 0 ? 0 : 1); - } -} - -void PowerHintSession::StaleTimerHandler::setSessionDead() { - std::lock_guard guard(mClosedLock); - mIsSessionDead = true; - PowerHintMonitor::getInstance()->getLooper()->removeMessages(mSession->mStaleTimerHandler); -} - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/PowerHintSession.h b/power-libperfmgr/PowerHintSession.h deleted file mode 100644 index 2a187ef..0000000 --- a/power-libperfmgr/PowerHintSession.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2021 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. - */ - -#pragma once - -#include -#include -#include -#include - -#include -#include - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -using aidl::android::hardware::power::BnPowerHintSession; -using aidl::android::hardware::power::WorkDuration; -using ::android::Message; -using ::android::MessageHandler; -using ::android::sp; -using std::chrono::milliseconds; -using std::chrono::nanoseconds; -using std::chrono::steady_clock; -using std::chrono::time_point; - -struct AppHintDesc { - AppHintDesc(int32_t tgid, int32_t uid, std::vector threadIds) - : tgid(tgid), - uid(uid), - threadIds(std::move(threadIds)), - duration(0LL), - current_min(0), - is_active(true), - update_count(0), - integral_error(0), - previous_error(0) {} - std::string toString() const; - const int32_t tgid; - const int32_t uid; - const std::vector threadIds; - nanoseconds duration; - int current_min; - // status - std::atomic is_active; - // pid - uint64_t update_count; - int64_t integral_error; - int64_t previous_error; -}; - -class PowerHintSession : public BnPowerHintSession { - public: - explicit PowerHintSession(int32_t tgid, int32_t uid, const std::vector &threadIds, - int64_t durationNanos); - ~PowerHintSession(); - ndk::ScopedAStatus close() override; - ndk::ScopedAStatus pause() override; - ndk::ScopedAStatus resume() override; - ndk::ScopedAStatus updateTargetWorkDuration(int64_t targetDurationNanos) override; - ndk::ScopedAStatus reportActualWorkDuration( - const std::vector &actualDurations) override; - bool isActive(); - bool isTimeout(); - void setStale(); - // Is this hint session for a user application - bool isAppSession(); - const std::vector &getTidList() const; - int getUclampMin(); - void dumpToStream(std::ostream &stream); - - time_point getStaleTime(); - - private: - class StaleTimerHandler : public MessageHandler { - public: - StaleTimerHandler(PowerHintSession *session) : mSession(session), mIsSessionDead(false) {} - void updateTimer(); - void handleMessage(const Message &message) override; - void setSessionDead(); - - private: - PowerHintSession *mSession; - std::mutex mClosedLock; - std::mutex mMessageLock; - std::atomic> mStaleTime; - bool mIsSessionDead; - }; - - private: - void updateUniveralBoostMode(); - int setSessionUclampMin(int32_t min); - void tryToSendPowerHint(std::string hint); - int64_t convertWorkDurationToBoostByPid(const std::vector &actualDurations); - void traceSessionVal(char const *identifier, int64_t val) const; - AppHintDesc *mDescriptor = nullptr; - sp mStaleTimerHandler; - std::atomic> mLastUpdatedTime; - sp mPowerManagerHandler; - std::mutex mSessionLock; - std::atomic mSessionClosed = false; - std::string mIdString; - // To cache the status of whether ADPF hints are supported. - std::unordered_map> mSupportedHints; -}; - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/PowerSessionManager.cpp b/power-libperfmgr/PowerSessionManager.cpp deleted file mode 100644 index 35bf300..0000000 --- a/power-libperfmgr/PowerSessionManager.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2021 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. - */ - -#define LOG_TAG "powerhal-libperfmgr" -#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL) - -#include "PowerSessionManager.h" - -#include -#include -#include -#include -#include -#include - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -using ::android::perfmgr::AdpfConfig; -using ::android::perfmgr::HintManager; - -namespace { -/* there is no glibc or bionic wrapper */ -struct sched_attr { - __u32 size; - __u32 sched_policy; - __u64 sched_flags; - __s32 sched_nice; - __u32 sched_priority; - __u64 sched_runtime; - __u64 sched_deadline; - __u64 sched_period; - __u32 sched_util_min; - __u32 sched_util_max; -}; - -static int sched_setattr(int pid, struct sched_attr *attr, unsigned int flags) { - if (!HintManager::GetInstance()->GetAdpfProfile()->mUclampMinOn) { - ALOGV("PowerSessionManager:%s: skip", __func__); - return 0; - } - return syscall(__NR_sched_setattr, pid, attr, flags); -} - -static void set_uclamp_min(int tid, int min) { - static constexpr int32_t kMaxUclampValue = 1024; - min = std::max(0, min); - min = std::min(min, kMaxUclampValue); - - sched_attr attr = {}; - attr.size = sizeof(attr); - - attr.sched_flags = (SCHED_FLAG_KEEP_ALL | SCHED_FLAG_UTIL_CLAMP_MIN); - attr.sched_util_min = min; - - int ret = sched_setattr(tid, &attr, 0); - if (ret) { - ALOGW("sched_setattr failed for thread %d, err=%d", tid, errno); - } -} -} // namespace - -void PowerSessionManager::updateHintMode(const std::string &mode, bool enabled) { - ALOGV("PowerSessionManager::updateHintMode: mode: %s, enabled: %d", mode.c_str(), enabled); - if (enabled && mode.compare(0, 8, "REFRESH_") == 0) { - if (mode.compare("REFRESH_120FPS") == 0) { - mDisplayRefreshRate = 120; - } else if (mode.compare("REFRESH_90FPS") == 0) { - mDisplayRefreshRate = 90; - } else if (mode.compare("REFRESH_60FPS") == 0) { - mDisplayRefreshRate = 60; - } - } - if (HintManager::GetInstance()->GetAdpfProfile()) { - HintManager::GetInstance()->SetAdpfProfile(mode); - } -} - -void PowerSessionManager::updateHintBoost(const std::string &boost, int32_t durationMs) { - ATRACE_CALL(); - ALOGV("PowerSessionManager::updateHintBoost: boost: %s, durationMs: %d", boost.c_str(), - durationMs); -} - -int PowerSessionManager::getDisplayRefreshRate() { - return mDisplayRefreshRate; -} - -void PowerSessionManager::addPowerSession(PowerHintSession *session) { - std::lock_guard guard(mLock); - for (auto t : session->getTidList()) { - mTidSessionListMap[t].insert(session); - if (mTidRefCountMap.find(t) == mTidRefCountMap.end()) { - if (!SetTaskProfiles(t, {"ResetUclampGrp"})) { - ALOGW("Failed to set ResetUclampGrp task profile for tid:%d", t); - } else { - mTidRefCountMap[t] = 1; - } - continue; - } - if (mTidRefCountMap[t] <= 0) { - ALOGE("Error! Unexpected zero/negative RefCount:%d for tid:%d", mTidRefCountMap[t], t); - continue; - } - mTidRefCountMap[t]++; - } - mSessions.insert(session); -} - -void PowerSessionManager::removePowerSession(PowerHintSession *session) { - std::lock_guard guard(mLock); - for (auto t : session->getTidList()) { - if (mTidRefCountMap.find(t) == mTidRefCountMap.end()) { - ALOGE("Unexpected Error! Failed to look up tid:%d in TidRefCountMap", t); - continue; - } - mTidSessionListMap[t].erase(session); - mTidRefCountMap[t]--; - if (mTidRefCountMap[t] <= 0) { - if (!SetTaskProfiles(t, {"NoResetUclampGrp"})) { - ALOGW("Failed to set NoResetUclampGrp task profile for tid:%d", t); - } - mTidRefCountMap.erase(t); - } - } - mSessions.erase(session); -} - -void PowerSessionManager::setUclampMin(PowerHintSession *session, int val) { - std::lock_guard guard(mLock); - setUclampMinLocked(session, val); -} - -void PowerSessionManager::setUclampMinLocked(PowerHintSession *session, int val) { - for (auto t : session->getTidList()) { - // Get thex max uclamp.min across sessions which include the tid. - int tidMax = 0; - for (PowerHintSession *s : mTidSessionListMap[t]) { - if (!s->isActive() || s->isTimeout()) - continue; - tidMax = std::max(tidMax, s->getUclampMin()); - } - set_uclamp_min(t, std::max(val, tidMax)); - } -} - -std::optional PowerSessionManager::isAnyAppSessionActive() { - std::lock_guard guard(mLock); - bool active = false; - for (PowerHintSession *s : mSessions) { - // session active and not stale is actually active. - if (s->isActive() && !s->isTimeout() && s->isAppSession()) { - active = true; - break; - } - } - if (active == mActive) { - return std::nullopt; - } else { - mActive = active; - } - - return active; -} - -void PowerSessionManager::handleMessage(const Message &) { - auto active = isAnyAppSessionActive(); - if (!active.has_value()) { - return; - } - if (active.value()) { - disableSystemTopAppBoost(); - } else { - enableSystemTopAppBoost(); - } -} - -void PowerSessionManager::dumpToFd(int fd) { - std::ostringstream dump_buf; - std::lock_guard guard(mLock); - dump_buf << "========== Begin PowerSessionManager ADPF list ==========\n"; - for (PowerHintSession *s : mSessions) { - s->dumpToStream(dump_buf); - dump_buf << " Tid:Ref["; - for (size_t i = 0, len = s->getTidList().size(); i < len; i++) { - int t = s->getTidList()[i]; - dump_buf << t << ":" << mTidSessionListMap[t].size(); - if (i < len - 1) { - dump_buf << ", "; - } - } - dump_buf << "]\n"; - } - dump_buf << "========== End PowerSessionManager ADPF list ==========\n"; - if (!::android::base::WriteStringToFd(dump_buf.str(), fd)) { - ALOGE("Failed to dump one of session list to fd:%d", fd); - } -} - -void PowerSessionManager::enableSystemTopAppBoost() { - if (HintManager::GetInstance()->IsHintSupported(kDisableBoostHintName)) { - ALOGV("PowerSessionManager::enableSystemTopAppBoost!!"); - HintManager::GetInstance()->EndHint(kDisableBoostHintName); - } -} - -void PowerSessionManager::disableSystemTopAppBoost() { - if (HintManager::GetInstance()->IsHintSupported(kDisableBoostHintName)) { - ALOGV("PowerSessionManager::disableSystemTopAppBoost!!"); - HintManager::GetInstance()->DoHint(kDisableBoostHintName); - } -} - -// =========== PowerHintMonitor implementation start from here =========== -void PowerHintMonitor::start() { - if (!isRunning()) { - run("PowerHintMonitor", ::android::PRIORITY_HIGHEST); - } -} - -bool PowerHintMonitor::threadLoop() { - while (true) { - mLooper->pollOnce(-1); - } - return true; -} - -sp PowerHintMonitor::getLooper() { - return mLooper; -} - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/PowerSessionManager.h b/power-libperfmgr/PowerSessionManager.h deleted file mode 100644 index e65e58e..0000000 --- a/power-libperfmgr/PowerSessionManager.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2021 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. - */ - -#pragma once - -#include -#include -#include - -#include -#include -#include - -#include "PowerHintSession.h" - -namespace aidl { -namespace google { -namespace hardware { -namespace power { -namespace impl { -namespace pixel { - -using ::android::Looper; -using ::android::Message; -using ::android::MessageHandler; -using ::android::Thread; -using ::android::perfmgr::HintManager; - -constexpr char kPowerHalAdpfDisableTopAppBoost[] = "vendor.powerhal.adpf.disable.hint"; - -class PowerSessionManager : public MessageHandler { - public: - // current hint info - void updateHintMode(const std::string &mode, bool enabled); - void updateHintBoost(const std::string &boost, int32_t durationMs); - int getDisplayRefreshRate(); - // monitoring session status - void addPowerSession(PowerHintSession *session); - void removePowerSession(PowerHintSession *session); - void setUclampMin(PowerHintSession *session, int min); - void setUclampMinLocked(PowerHintSession *session, int min); - void handleMessage(const Message &message) override; - void dumpToFd(int fd); - - // Singleton - static sp getInstance() { - static sp instance = new PowerSessionManager(); - return instance; - } - - private: - std::optional isAnyAppSessionActive(); - void disableSystemTopAppBoost(); - void enableSystemTopAppBoost(); - const std::string kDisableBoostHintName; - - std::unordered_set mSessions; // protected by mLock - std::unordered_map mTidRefCountMap; // protected by mLock - std::unordered_map> mTidSessionListMap; - bool mActive; // protected by mLock - /** - * mLock to pretect the above data objects opertions. - **/ - std::mutex mLock; - int mDisplayRefreshRate; - // Singleton - PowerSessionManager() - : kDisableBoostHintName(::android::base::GetProperty(kPowerHalAdpfDisableTopAppBoost, - "ADPF_DISABLE_TA_BOOST")), - mActive(false), - mDisplayRefreshRate(60) {} - PowerSessionManager(PowerSessionManager const &) = delete; - void operator=(PowerSessionManager const &) = delete; -}; - -class PowerHintMonitor : public Thread { - public: - void start(); - bool threadLoop() override; - sp getLooper(); - // Singleton - static sp getInstance() { - static sp instance = new PowerHintMonitor(); - return instance; - } - PowerHintMonitor(PowerHintMonitor const &) = delete; - void operator=(PowerHintMonitor const &) = delete; - - private: - sp mLooper; - // Singleton - PowerHintMonitor() : Thread(false), mLooper(new Looper(true)) {} -}; - -} // namespace pixel -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace google -} // namespace aidl diff --git a/power-libperfmgr/android.hardware.power-service.moto_sm6375-libperfmgr.rc b/power-libperfmgr/android.hardware.power-service.moto_sm6375-libperfmgr.rc deleted file mode 100644 index 079ec28..0000000 --- a/power-libperfmgr/android.hardware.power-service.moto_sm6375-libperfmgr.rc +++ /dev/null @@ -1,36 +0,0 @@ -service vendor.power-hal-aidl /vendor/bin/hw/android.hardware.power-service.moto_sm6375-libperfmgr - class hal - user root - group system - priority -20 - -on late-fs - start vendor.power-hal-aidl - -on property:sys.boot_completed=1 - # Enable PowerHAL hint processing - setprop vendor.powerhal.init 1 - -# Restart powerHAL when framework died -on property:init.svc.zygote=restarting && property:vendor.powerhal.state=* - setprop vendor.powerhal.state "" - setprop vendor.powerhal.audio "" - setprop vendor.powerhal.rendering "" - restart vendor.power-hal-aidl - -# Clean up after b/163539793 resolved -on property:vendor.powerhal.dalvik.vm.dex2oat-threads=* - setprop dalvik.vm.dex2oat-threads ${vendor.powerhal.dalvik.vm.dex2oat-threads} - setprop dalvik.vm.restore-dex2oat-threads ${vendor.powerhal.dalvik.vm.dex2oat-threads} - -on property:vendor.powerhal.dalvik.vm.dex2oat-cpu-set=* - setprop dalvik.vm.dex2oat-cpu-set ${vendor.powerhal.dalvik.vm.dex2oat-cpu-set} - setprop dalvik.vm.restore-dex2oat-cpu-set ${vendor.powerhal.dalvik.vm.dex2oat-cpu-set} - -# Restart powerHAL when debug property set -on property:ro.debuggable=1 && property:vendor.powerhal.config.debug=* - restart vendor.power-hal-aidl - -on property:persist.vendor.powerhal.config.debug=* - setprop vendor.powerhal.config.debug ${persist.vendor.powerhal.config.debug} - diff --git a/power-libperfmgr/android.hardware.power-service.moto_sm6375.xml b/power-libperfmgr/android.hardware.power-service.moto_sm6375.xml deleted file mode 100644 index 9f56deb..0000000 --- a/power-libperfmgr/android.hardware.power-service.moto_sm6375.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - android.hardware.power - 2 - IPower/default - - diff --git a/power-libperfmgr/service.cpp b/power-libperfmgr/service.cpp deleted file mode 100644 index 16269b0..0000000 --- a/power-libperfmgr/service.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2020 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. - */ - -#define LOG_TAG "powerhal-libperfmgr" - -#include -#include -#include -#include -#include -#include - -#include - -#include "Power.h" -#include "PowerExt.h" -#include "PowerSessionManager.h" - -using aidl::google::hardware::power::impl::pixel::Power; -using aidl::google::hardware::power::impl::pixel::PowerExt; -using aidl::google::hardware::power::impl::pixel::PowerHintMonitor; -using aidl::google::hardware::power::impl::pixel::PowerSessionManager; -using ::android::perfmgr::HintManager; - -constexpr std::string_view kPowerHalInitProp("vendor.powerhal.init"); - -int main() { - // Parse config but do not start the looper - std::shared_ptr hm = HintManager::GetInstance(); - if (!hm) { - LOG(FATAL) << "HintManager Init failed"; - } - - // single thread - ABinderProcess_setThreadPoolMaxThreadCount(0); - - // core service - std::shared_ptr pw = ndk::SharedRefBase::make(); - ndk::SpAIBinder pwBinder = pw->asBinder(); - AIBinder_setMinSchedulerPolicy(pwBinder.get(), SCHED_NORMAL, -20); - - // extension service - std::shared_ptr pwExt = ndk::SharedRefBase::make(); - auto pwExtBinder = pwExt->asBinder(); - AIBinder_setMinSchedulerPolicy(pwExtBinder.get(), SCHED_NORMAL, -20); - - // attach the extension to the same binder we will be registering - CHECK(STATUS_OK == AIBinder_setExtension(pwBinder.get(), pwExt->asBinder().get())); - - const std::string instance = std::string() + Power::descriptor + "/default"; - binder_status_t status = AServiceManager_addService(pw->asBinder().get(), instance.c_str()); - CHECK(status == STATUS_OK); - LOG(INFO) << "Power HAL AIDL Service for moto_sm6375 is started."; - - if (HintManager::GetInstance()->GetAdpfProfile()) { - PowerHintMonitor::getInstance()->start(); - } - - std::thread initThread([&]() { - ::android::base::WaitForProperty(kPowerHalInitProp.data(), "1"); - HintManager::GetInstance()->Start(); - }); - initThread.detach(); - - ABinderProcess_joinThreadPool(); - LOG(ERROR) << "Power HAL AIDL Service for moto_sm6375 with Extension just died."; - return EXIT_FAILURE; // should not reach -} diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index b590cb4..fd3a51b 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -13,9 +13,6 @@ type cutback_socket, file_type; type vendor_persist_egis_file, file_type, vendor_persist_type; type vendor_persist_fps_file, file_type, vendor_persist_type; -# GPU -type sysfs_kgsl, sysfs_type, fs_type; - # Input Devices type vendor_sysfs_input, sysfs_type, fs_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 2e2f6f2..11f3e80 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -74,9 +74,6 @@ /dev/sec-nfc u:object_r:nfc_device:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.nfc@1\.2-service\.samsung u:object_r:hal_nfc_default_exec:s0 -# Power -/(vendor|system/vendor)/bin/hw/android\.hardware\.power-service\.moto_sm6375-libperfmgr u:object_r:hal_power_default_exec:s0 - # Radio /data/vendor/misc/cutback(/.*)? u:object_r:cutback_data_file:s0 /dev/socket/cutback u:object_r:cutback_socket:s0 diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te index 89f35f0..870f160 100644 --- a/sepolicy/vendor/hal_power_default.te +++ b/sepolicy/vendor/hal_power_default.te @@ -1,5 +1,4 @@ allow hal_power_default { - cgroup vendor_sysfs_devfreq vendor_sysfs_dt2w vendor_sysfs_input @@ -9,7 +8,6 @@ allow hal_power_default { }:dir search; allow hal_power_default { - cgroup proc proc_sched vendor_sysfs_devfreq @@ -31,6 +29,3 @@ allow hal_power_default vendor_latency_device:chr_file rw_file_perms; # Rule for hal_power_default to access graphics composer process unix_socket_connect(hal_power_default, vendor_pps, hal_graphics_composer_default); - -# To get/set powerhal state property -set_prop(hal_power_default, vendor_power_prop) diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index fad158a..bb50574 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -6,8 +6,5 @@ vendor_internal_prop(vendor_mot_hw_prop); vendor_internal_prop(vendor_mot_touch_prop); vendor_internal_prop(vendor_mot_nfc_prop); -# Power -vendor_internal_prop(vendor_power_prop) - # Thermal engine vendor_internal_prop(vendor_thermal_prop) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 90f1a9e..252414c 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -22,8 +22,5 @@ persist.vendor.hardware.fingerprint u:object_r:vendor_mot_fingerprint vendor.hw.fps.ident u:object_r:vendor_mot_fingerprint_prop:s0 vendor.hw.fingerprint.status u:object_r:vendor_mot_fingerprint_prop:s0 -# Power -vendor.powerhal. u:object_r:vendor_power_prop:s0 - # Thermal engine vendor.thermal.config u:object_r:vendor_thermal_prop:s0 diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index 5143eff..730bda9 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -1,7 +1,6 @@ set_prop(vendor_init, vendor_camera_prop) set_prop(vendor_init, vendor_ims_prop) set_prop(vendor_init, vendor_mot_hw_prop) -set_prop(vendor_init, vendor_power_prop) allow vendor_init proc_sysctl_schedboost:file w_file_perms; allow vendor_init proc_sched_lib_mask_cpuinfo:file w_file_perms;