What you have described will give you two segments. Assuming both flight are on the same itinerary, and your AP number is included, each flight will count as 1 status segment, giving you two. Even if they are on seperate itineraries, the same will apply, so long as your aeroplan number is listed on both tickets (or you can apply for credit retroactively, if not). The only exception for this itinerary would be if you booked a Tango fare - where the first flight you'd be looking at only 25% status miles (not sure what happens with segments in that case).
Any UA segment, and any segment on any *A carrier for that matter, will count as a status segment when credited to AP, no matter if it is listed on your ticket as an AC flight number or the operating carrier's number.
The only exception might be on some of the most discounted fares on certain airlines, usually on Asian or European carriers like LH or SQ, which don't give out full miles for certain fare class. The Aeroplan earning chart will show which fare classes on those carriers don't earn full miles. The other exception is for some non *A partners, such as Jet Airways, where the flight has to be booked as an AC flight number.