Toggling the Flashlight/Torch during the operation of the camera has known issue with returning the proper enable/disable states. ThirdEye has built an .aar library as a secondary approach to checking the flash state.
All that needed is to add the .aar lib as a dependency and then you can control the torch outside of the normal Android way.
Usages:
torch = new TorchNativeLib(); if(torch.isTorchEnabled()){ Log.e(TAG, "Torch is enabled"); }else{ Log.e(TAG, "Torch is disabled"); }