Merge "Protect failed setUidPolicy() and avoid storing invalid UIDs" into main