From ffaa2b163055c644dec7c2c681ed8b608e48f6b9 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Tue, 26 May 2020 21:43:02 -0700 Subject: Add basic ANR test To reduce the delta of the upcoming ANR refactor, add a basic ANR test here. This will also help highlight the difference in behaviour from the current code to the new code. To cause an ANR today, the socket needs to be blocked, which means that we need to send ~ 50 events to the unresponsive window. These workarounds will be removed when the ANRs are refactored. Bug: 143459140 Test: adb shell -t /data/nativetest64/inputflinger_tests/inputflinger_tests --gtest_filter="*InputDispatcherSingleWindowAnr*" --gtest_repeat=1000 --gtest_break_on_failure Change-Id: I0a1b28c2785d03d8870691641e0f7c6b1ca3b85e Merged-In: I0a1b28c2785d03d8870691641e0f7c6b1ca3b85e --- include/input/InputApplication.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/input/InputApplication.h') diff --git a/include/input/InputApplication.h b/include/input/InputApplication.h index 7f04611309..86de394a31 100644 --- a/include/input/InputApplication.h +++ b/include/input/InputApplication.h @@ -61,6 +61,11 @@ public: return mInfo.token ? mInfo.dispatchingTimeout : defaultValue; } + inline std::chrono::nanoseconds getDispatchingTimeout( + std::chrono::nanoseconds defaultValue) const { + return mInfo.token ? std::chrono::nanoseconds(mInfo.dispatchingTimeout) : defaultValue; + } + inline sp getApplicationToken() const { return mInfo.token; } -- cgit v1.2.3-59-g8ed1b