How is orientation change handled in the message queue?

Is this an atomic operation?

I mean, is it possible that something else will be executed in the main thread during the orientation change?

For example, let's say a stream in the main stream looks something like this:

someOperation → orientationChangeStart → someOtherOperation → orientationChangeEnd

Is it possible?

Can someOtherOperation execute in the user interface thread during orientation changes?

Thanks in advance.

+6
source share
2 answers

Yes, this is an atomic operation.

in a pseudo-field it looks like this:

 void setNewOrientation(int state) { currentState = state; runOrientationChangedEvent(); } 

And then usually Activity recreated. Only the re-creation of an Activity adds to the message queue, so you can see how quickly the orientation of the device changes.

You cannot start and end this process because it just changes a few int variables that can tell you about the current orientation, for example, the orientation :

 getActivity().getResources().getConfiguration().orientation 

or rotation

 getWindowManager().getDefaultDisplay().getRotation(); 

This way you can only get the event after .

+3
source

You probably cannot measure the time between theChangeStart orientation and theChangeEnd orientation , but you can perform someOtherOperation onConfigurationChanged operation. Example: How to use onConfigurationChanged () and newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE in android 2.3.3

+2
source

All Articles