universal7885: parts-aidl: Unlock mutex if try_lock() returned true

try_lock() returns instantly, but it does acquires mutex lock if it is avaliable. If we just return try_lock() result, mutex is still locked by the thread. So it results in forever false with try_lock(). If the try_lock() returns true, unlock and return true for fix
This commit is contained in:
roynatech2544 2022-10-11 21:21:57 +09:00
commit 72f2eb6800

View file

@ -92,7 +92,12 @@ static void swapoff_func(void) {
}
::ndk::ScopedAStatus SwapOnData::isMutexLocked(bool *_aidl_return) {
*_aidl_return = !thread_lock.try_lock();
if (thread_lock.try_lock()) {
thread_lock.unlock();
*_aidl_return = false;
} else {
*_aidl_return = true;
}
return ::ndk::ScopedAStatus::ok();
}