The Supreme Court held today that prolonging a traffic stop for purposes of brining out a drug dog is against the Fourth amendment, even when the delay to do the dog sniff is very short.
The officer in the case held the defendant motorist for an additional 7 or 8 minutes on the side of the road after giving him a warning for a traffic offense in order to bring out a drug dog, which found meth in the vehicle.
Under the rationale of the decision, it seems clear that, even if the officer had done his tasks the other way round, there would be a Fourth Amendment violation because the drug dog search would still have prolonged the detention. However, if there were two officers and one could do the dog search while the other did the paperwork, there would likely be no violation as long as the dog sniffing officer finished first and the paperwork officer did not drag his feet.
Ironically, as the vigorous dissents point out, the officer could arguably have simply arrested the defendant on the traffic offense, did a search of the vehicle incident to arrest (which is a recognized fourth amendment exception), recovered the drugs and been upheld by the courts.