diff options
| author | 2025-02-27 15:26:26 -0800 | |
|---|---|---|
| committer | 2025-02-27 15:26:26 -0800 | |
| commit | 818783174fe4053e5932a8dfb723333d74e88f6a (patch) | |
| tree | b6206c584174c2aef940a01d3d20fb6472afa0b6 /services/inputflinger/InputThread.cpp | |
| parent | 72782217cefc24c7f4374b45bcab7e6bd50d964d (diff) | |
| parent | 98bdc04b7658fde0a99403fc052d1d18e7d48ea6 (diff) | |
Merge "Merge 25Q1 (ab/12770256) to aosp-main-future" into aosp-main-future
Diffstat (limited to 'services/inputflinger/InputThread.cpp')
| -rw-r--r-- | services/inputflinger/InputThread.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/services/inputflinger/InputThread.cpp b/services/inputflinger/InputThread.cpp index 449eb45b4b..7cf4e397f9 100644 --- a/services/inputflinger/InputThread.cpp +++ b/services/inputflinger/InputThread.cpp @@ -26,6 +26,16 @@ namespace input_flags = com::android::input::flags; namespace { +bool applyInputEventProfile(const Thread& thread) { +#if defined(__ANDROID__) + return SetTaskProfiles(thread.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 +} + // Implementation of Thread from libutils. class InputThreadImpl : public Thread { public: @@ -45,12 +55,13 @@ private: } // namespace -InputThread::InputThread(std::string name, std::function<void()> loop, std::function<void()> wake) - : mName(name), mThreadWake(wake) { +InputThread::InputThread(std::string name, std::function<void()> loop, std::function<void()> wake, + bool isInCriticalPath) + : 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()) { + mThread->run(name.c_str(), ANDROID_PRIORITY_URGENT_DISPLAY); + if (input_flags::enable_input_policy_profile() && isInCriticalPath) { + if (!applyInputEventProfile(*mThread)) { LOG(ERROR) << "Couldn't apply input policy profile for " << name; } } @@ -74,14 +85,4 @@ 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 +} // namespace android |