summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputThread.cpp
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2024-09-19 17:42:42 -0700
committer Siarhei Vishniakou <svv@google.com> 2024-09-19 18:20:35 -0700
commitf53fa6b562d6608197329b94e796012e18d11dc7 (patch)
treeab99b0ab224f796864bb5a0bf3fbbfd9c9eba1ff /services/inputflinger/InputThread.cpp
parentec741152d29c44b91bd56abb3e848c97887509d7 (diff)
Only prioritize critical input threads
Input has several threads: InputReader InputClassifier (InputProcessor) InputDispatcher InputFilter TraceProcessor However, only two of them are in the critical path of the event dispatch, and therefore, should be prioritized. The others do not need to run with high priority. In this CL, require that all InputThread's declare themselves as critical or not, which would allow us to set their priority appropriately. Bug: 330719044 Test: perfetto trace Flag: EXEMPT bugfix Change-Id: Iaa7d7ed32557e1617884590562c3474b17d3a7f9
Diffstat (limited to 'services/inputflinger/InputThread.cpp')
-rw-r--r--services/inputflinger/InputThread.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/inputflinger/InputThread.cpp b/services/inputflinger/InputThread.cpp
index 449eb45b4b..bd4b192e22 100644
--- a/services/inputflinger/InputThread.cpp
+++ b/services/inputflinger/InputThread.cpp
@@ -45,11 +45,12 @@ private:
} // namespace
-InputThread::InputThread(std::string name, std::function<void()> loop, std::function<void()> wake)
+InputThread::InputThread(std::string name, std::function<void()> loop, std::function<void()> wake,
+ bool isInCriticalPath)
: 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 (input_flags::enable_input_policy_profile() && isInCriticalPath) {
if (!applyInputEventProfile()) {
LOG(ERROR) << "Couldn't apply input policy profile for " << name;
}
@@ -84,4 +85,4 @@ bool InputThread::applyInputEventProfile() {
#endif
}
-} // namespace android \ No newline at end of file
+} // namespace android