In Western culture, what someone is doing is considered that person’s private business, and asking about it is seen as an intrusion. The person asking must have some cause to ask the question in order for it to be appropriate. So, among family, friends and work colleagues it is OK to ask “what are you doing”, since it is reasonable to be interested in what a friend or family member is doing. Young children can also ask “what are you doing” to anyone, since it is normal for children to be curious. Among strangers, “what are you doing” becomes an indirect means to voice disapproval, or to express suspicion that the person is doing something inappropriate. The tone of voice is usually loud and stern. For example, if a Western woman riding on a bus discovers that a man has put his hand up her skirt, she may challenge the man by asking loudly “what are you doing”. Or, if a shopkeeper discovers that a person is putting unpaid goods in a pocket, the shopkeeper may ask the person “what are you doing”.
Variations include “what do you think you are doing”, or even “what the XXXX are you doing”, where XXXX is a swear word.
If you are genuinely interested in what a stranger is doing, you need to explain the reason behind your interest. For example, “excuse me sir, but I notice that you are putting paint on your face. May I ask what are you doing? Are you participating in the carnival?” In this case, the person asking the question may be interested in knowing more about the carnival, or in meeting carnival participants.