After carefully think about this issue, it's not easy as you said. As you mentioned, NativeAppWindow should maintain the locking status. Extension needs the status determine whether it should fire an JS event. They both have to be observers of SensorProvider. This cause two observers have dependency.

I have an idea to solve it that add a sub sensor provider for each runtime to keep locking status. NativeAppWindow and extension are the observers of the sub-provider. If an orientation is not allowed in the runtime, no observer will be notified.

I plan to refactory the sensor support in M4 stage, including move some files to upper level tizen subdirectory and simplify the tizen sensor provider. This PR does works and already tested although the implementation is not perfect. So can we merge the PR this time to add the API feature in M3? And I will continue to improve it.

Regarding the threading issue, I'll update.