In the novel, Vito tells Tom to bring Sonny to the office for the Bonasera meeting "so he should learn some things." But, as we saw in the film, Sonny's attention was wandering--no doubt he was thinking about Lucy Mancini instead of learning from Vito how to build loyalty with someone who rejected him earlier. Vito knew all about Sonny's affair with Lucy. That's why he whistled and asked if he was paying attention--he knew he wasn't.