diff options
author | 2024-11-12 22:22:43 -0800 | |
---|---|---|
committer | 2024-11-12 22:22:43 -0800 | |
commit | 6dc15689f6bb4b04c102ac3107f31377ee91f05e (patch) | |
tree | 3ca9d372bc99ac1182fdb4bc895c556d0f108bd3 /services/inputflinger/InputThread.cpp | |
parent | d4d02798539f29d00059d458fd01e5b2869acbb6 (diff) | |
parent | f151262626f1c08a104cc35d9864493ea8a72dec (diff) |
Merge 24Q4 (ab/12406339) into aosp-main-future
Bug: 370570306
Merged-In: I9be1254c3e2685b0aa950b314c581824f40ce26c
Change-Id: I35bc501a2b1d9eb100aaab25cd660cf2e0542f99
Diffstat (limited to 'services/inputflinger/InputThread.cpp')
-rw-r--r-- | services/inputflinger/InputThread.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/services/inputflinger/InputThread.cpp b/services/inputflinger/InputThread.cpp index e74f258168..449eb45b4b 100644 --- a/services/inputflinger/InputThread.cpp +++ b/services/inputflinger/InputThread.cpp @@ -16,8 +16,14 @@ #include "InputThread.h" +#include <android-base/logging.h> +#include <com_android_input_flags.h> +#include <processgroup/processgroup.h> + namespace android { +namespace input_flags = com::android::input::flags; + namespace { // Implementation of Thread from libutils. @@ -43,6 +49,11 @@ InputThread::InputThread(std::string name, std::function<void()> loop, std::func : mName(name), mThreadWake(wake) { mThread = sp<InputThreadImpl>::make(loop); mThread->run(mName.c_str(), ANDROID_PRIORITY_URGENT_DISPLAY); + if (input_flags::enable_input_policy_profile()) { + if (!applyInputEventProfile()) { + LOG(ERROR) << "Couldn't apply input policy profile for " << name; + } + } } InputThread::~InputThread() { @@ -63,4 +74,14 @@ bool InputThread::isCallingThread() { #endif } +bool InputThread::applyInputEventProfile() { +#if defined(__ANDROID__) + return SetTaskProfiles(mThread->getTid(), {"InputPolicy"}); +#else + // Since thread information is not available and there's no benefit of + // applying the task profile on host, return directly. + return true; +#endif +} + } // namespace android
\ No newline at end of file |