The simplest and cheapest ‘smart’ technology would be to adapt what high end cars use. Put a RFID chip in a wrist band and a chip in the handgun with a range of about a foot. Gun works fine in the wristband wearers hand. Bad guy gets control of the gun, put your arm behind your back and it won’t work for him.
"...put an RFID chip..."
However, the police would be denied the use of their alternate hands to fire the weapon, nor could they share weapons - bad idea.