Initialize layers with metadata

layers weren't being initialized with metadata, this meant a
traversal was required in order to apply the setmetadata call.
While this seemed to happen in practice, its a weird thing to
rely on.

Bug: 122925737
Test: Behavior is same
Change-Id: I455f6c69ce92e6045aa0c12f8cfbb70c1d283088
5 files changed