From 73172f8d0c648338e899cfe58edbfb79f110b19c Mon Sep 17 00:00:00 2001 From: Hugo Saint-Vignes Date: Fri, 5 Feb 2021 17:47:29 +0100 Subject: [PATCH] [ion/simulator/android] Add assert, remove TODO Change-Id: Id818d0cd9a83727171ebe675ee50e35ef64e31d0 --- ion/src/simulator/android/src/cpp/haptics_enabled.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ion/src/simulator/android/src/cpp/haptics_enabled.cpp b/ion/src/simulator/android/src/cpp/haptics_enabled.cpp index ea73fad07..5c1fa0b74 100644 --- a/ion/src/simulator/android/src/cpp/haptics_enabled.cpp +++ b/ion/src/simulator/android/src/cpp/haptics_enabled.cpp @@ -1,6 +1,7 @@ #include "../../../shared/haptics.h" #include #include +#include namespace Ion { namespace Simulator { @@ -10,11 +11,8 @@ bool isEnabled() { JNIEnv * env = static_cast(SDL_AndroidGetJNIEnv()); jobject activity = static_cast(SDL_AndroidGetActivity()); jclass j_class = env->FindClass("com/numworks/calculator/EpsilonActivity"); - // TODO : GetMethodID is relatively costly, and could be performed only once. jmethodID j_methodId = env->GetMethodID(j_class,"hapticFeedbackIsEnabled", "()Z"); - if (j_methodId == 0) { - return false; - } + assert(j_methodId != 0); bool result = (env->CallBooleanMethod(activity, j_methodId) != JNI_FALSE); /* Local references are automatically deleted if a native function called from * Java side returns. For SDL this native function is main() itself. Therefore