Clean up lockscreen target configuration code (2/2)

Get rid of a lot of duplicated code.

Change-Id: I03faf36d5e767053072f1809f670882600ea0830