diff options
author | Yohei Yukawa <yukawa@google.com> | 2020-04-02 12:54:55 -0700 |
---|---|---|
committer | Yohei Yukawa <yukawa@google.com> | 2020-04-02 12:54:55 -0700 |
commit | f87f75088899d0f7513132e0f397b0edbf373d71 (patch) | |
tree | 36a13d28afbcbed42bba33c5fd79deda721d90bb /tests/DynamicCodeLoggerIntegrationTests/src/cpp/test_executable.cpp | |
parent | 754636846c0dd0ba6f8fd025dc3c270efd8bc500 (diff) |
Let blocked InputConnection APIs fail upon IInputMethod.unbindInput()
This is a follow up CL to our previous CL [1], which implemented
fail-fast mode for blocking InputConnection APIs based on
IInputMethod.unbindInput() async signal from IMMS to IMS.
What was not implemented in the previous CL was a mechanism to
immediately unblock a sync InputConnection API call that is already
requested to the IME client process and waiting for its response.
With this CL, any blocking InputConnection API fails immediately when
IInputMethod#onUnbindInput() is delivered to the IME process, without
waiting for the full time-out period (MAX_WAIT_TIME_MILLIS == 2 sec)
to pass.
Implementation Note:
The key idea is to use CountDownLatch to compose multiple wait
conditions.composed wait condition. The CountDownLatch is initialized
with 1 then will be decremented when:
A. received a result from the IME client
B. received IInputMethod.unbindInput()
Hence InputConnectionWrapper can simply wait for the CountDownLatch to
become 0 with an existing timeout (MAX_WAIT_TIME_MILLIS) then returns
failure unless the CountDownLatch became 0 because of A.
[1]: I0f816c6ca4c5c0664962432b913f074605fedd27
1d113d041f113feabe0ff4cc57205fe8876b9e0b
Fix: 36897707
Test: atest InputConnectionBlockingMethodTest
Test: InputConnectionBlockingMethodTest#*FailFastAfterUnbindInput()
take shorter time to complete.
Test: Monitor logcat with `adb logcat -s InputConnectionWrapper:*`
while running `atest InputConnectionBlockingMethodTest`
Change-Id: Ic65a95eb5d0fd56f505a02fd9083bcf6694b6734
Diffstat (limited to 'tests/DynamicCodeLoggerIntegrationTests/src/cpp/test_executable.cpp')
0 files changed, 0 insertions, 0 deletions