Charge localization and trapping at surfaces in lead-iodide perovskites: The role of polarons and defects