Which thread calls SensorEventListener.onSensorChanged

From my records, it seems that the SensorEventListener.onSensorChanged callback is caused by the same thread that registered the callback. I. There will be some synchronization of the message queue in the background, allowing UI-Thread activity to handle callbacks.

This leads to my question: is there a need to synchronize SensorEventListener.onSensorChanged with the UI-thread activity, assuming that a SensorEventListener has registered the activity of the UI thread?

I cannot find links to the documentation, but I can see various examples calling invalidate (), unsynchronized or synchronizing the entire callback.

I used something in the lines

Log.i(TAG, "" + Thread.currentThread().getId()); 

to get stream information.

I am running android 2.1 update.

Regards, Christoph

+3
source share

Source: https://habr.com/ru/post/1743922/


All Articles