You are correct that the Courts have upheld police's right to do a lot of things which, although IMO are a direct violation of the spirit and letter of the Constitution.
It is also true that a lot of cops do a lot of things which the courts do not allow just because they can get by with it.
I have a friend who is a retired FBI agent. We once were discussing the little town of Ludowici, Georgia. This agent would never use his credentials for personal indentification, for one thing, it is illegal to do so, and it is just not good form. He did do so on one occassion.
He was driving a plain unmarked vehicle, (not a black Crown Vic, with black premium tires, no chrome etc.). He was looking for someone in Ludowici to ask some questions of when he noticed the Ludowici town police take notice of him. Sure enough, after about 10 minutes the local cop pulls him over, and asks, not for his license, but for ID. The agent knows this was his chance. He pulls out his plastic laminated credentials, opens it and says, "did you have probable cause to stop me."
The local about faints on the spot, turns red, stutters and profusely apologizes. The agent decides to cut the guy some slack, after all, he might need the guy's help sometime.