Is a guy flirting when he messes with a girl's hair?

So I told one of my guy friends that I liked him back in December, and he said he wasn't ready to date.

Now he's doing this thing when we walk together; he stops and looks at me and then starts messing up my hair. Then when I give him a hug, he hugs me back tight then walks away.

So is he testing me since he knows I like him? Is this a weird way of you guys to flirt?

Please tell me what you think!

xoxo
Updates
+1 y
p.s, what should I do if it so happens to be flirting?
Is a guy flirting when he messes with a girl's hair?
Post Opinion