summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputThread.cpp
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2022-09-30 08:51:23 -0700
committer Siarhei Vishniakou <svv@google.com> 2022-10-14 16:47:36 -0700
commit31977184520e99110e1deadceb6197636f76450a (patch)
tree647bdda2d1f182ae7ee7e7fb8390e168d77a8ece /services/inputflinger/InputThread.cpp
parentc08105877d67f18d6592ffacaf2402f0d07953b4 (diff)
Run some inputflinger_tests on host
Sometimes, it's convenient to execute the input tests without having a connected device. This is especially useful when doing cherry-picks of patch on a cloud device. Allow input code to build for host, and enable the tests for running on host. Bug: 249591924 Test: atest --host --no-bazel-mode -c -m inputflinger_tests Change-Id: Ib9be6a5fb6c35ffc450e41cb2a5688bfb2c8d01a
Diffstat (limited to 'services/inputflinger/InputThread.cpp')
-rw-r--r--services/inputflinger/InputThread.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/inputflinger/InputThread.cpp b/services/inputflinger/InputThread.cpp
index e2e64f992f..e74f258168 100644
--- a/services/inputflinger/InputThread.cpp
+++ b/services/inputflinger/InputThread.cpp
@@ -54,7 +54,13 @@ InputThread::~InputThread() {
}
bool InputThread::isCallingThread() {
+#if defined(__ANDROID__)
return gettid() == mThread->getTid();
+#else
+ // Assume that the caller is doing everything correctly,
+ // since thread information is not available on host
+ return false;
+#endif
}
} // namespace android \ No newline at end of file