It is not a violation if A2 catches the ball in the air unless the ball is on its downward flight towards the basket with a chance to go it - in that case it would be offensive goaltending.
Otherwise, it is a legal play for A2 to catch the ball and shoot either before or after returning to the floor.
A1 cannot toss the ball off the backboard to himself, of course.