diff --git a/services/core/jni/tvinput/JTvInputHal.cpp b/services/core/jni/tvinput/JTvInputHal.cpp index 0f6ef036c46bf..3453cbdcb4de7 100644 --- a/services/core/jni/tvinput/JTvInputHal.cpp +++ b/services/core/jni/tvinput/JTvInputHal.cpp @@ -42,8 +42,11 @@ JTvInputHal* JTvInputHal::createInstance(JNIEnv* env, jobject thiz, const sp(new ITvInputWrapper(hidlITvInput)), looper); } - ::ndk::SpAIBinder binder(AServiceManager_waitForService(TV_INPUT_AIDL_SERVICE_NAME)); - std::shared_ptr aidlITvInput = AidlITvInput::fromBinder(binder); + std::shared_ptr aidlITvInput = nullptr; + if (AServiceManager_isDeclared(TV_INPUT_AIDL_SERVICE_NAME)) { + ::ndk::SpAIBinder binder(AServiceManager_waitForService(TV_INPUT_AIDL_SERVICE_NAME)); + aidlITvInput = AidlITvInput::fromBinder(binder); + } if (aidlITvInput == nullptr) { ALOGE("Couldn't get tv.input service."); return nullptr;