I'm working on eye contact. I can do it while I'm doing the talking most of the time, but it's hard to do constantly while I'm being talked to by an alpha/authority figure.

Anyway, here's the scenario I'm sure all of you are familiar with:

You are walking straight toward a person from very far away (you and the person approaching you are the only 2 people); the person is also walking toward you. I normally avoid contact by simply taking out my phone pretending to text until last second, which is when I make brief eye contact and give them a friendly nod or grin.

Again, emphasis on the fact that you and the person walking toward you are the only two people in the area; there is no escaping!

This used to happen to me all the time in high school if I went to the restroom during class and a random teacher would be walking toward me in a loooong ass hallway, and I would have NO IDEA how to handle this awkward, 15-30 second period of death. It's almost a pet peeve of mine when this long hallway scenario happens.

What's the best way to handle this prolonged interaction?

It's weird because you don't want to say/ask something too early and then have to fill the awkward space until you pass each other with more awkward bs.

Do you ignore them? Stare past them off into the distance like a soldier at attention? Stare them dead in the eye?

Thanks guys