Clean up lockscreen target configuration code (1/2)

Get rid of a lot of duplicated code.

Change-Id: I80fb0b0cd9b5f7d79a5760f8fa6ae338d9ca7205
Fix fetching icons from packages.
Change-Id: I857d35bb601425be56b5eb730d63344e1173e4a2