Loading libs/input/input_flags.aconfig +9 −0 Original line number Diff line number Diff line Loading @@ -192,3 +192,12 @@ flag { description: "Prevents touchpad gesture changing window focus." bug: "364460018" } flag { name: "enable_input_policy_profile" namespace: "input" description: "Apply input policy profile for input threads." bug: "347122505" is_fixed_read_only: true } services/inputflinger/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,7 @@ cc_defaults { "libcutils", "libinput", "liblog", "libprocessgroup", "libstatslog", "libutils", ], Loading services/inputflinger/InputThread.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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() { Loading @@ -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 services/inputflinger/include/InputThread.h +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ private: std::string mName; std::function<void()> mThreadWake; sp<Thread> mThread; bool applyInputEventProfile(); }; } // namespace android Loading
libs/input/input_flags.aconfig +9 −0 Original line number Diff line number Diff line Loading @@ -192,3 +192,12 @@ flag { description: "Prevents touchpad gesture changing window focus." bug: "364460018" } flag { name: "enable_input_policy_profile" namespace: "input" description: "Apply input policy profile for input threads." bug: "347122505" is_fixed_read_only: true }
services/inputflinger/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,7 @@ cc_defaults { "libcutils", "libinput", "liblog", "libprocessgroup", "libstatslog", "libutils", ], Loading
services/inputflinger/InputThread.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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() { Loading @@ -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
services/inputflinger/include/InputThread.h +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ private: std::string mName; std::function<void()> mThreadWake; sp<Thread> mThread; bool applyInputEventProfile(); }; } // namespace android