Apple gains smartphone market share in Q2, even as broader market shrinks