Merge "Rename key_dir to metadata_key_dir and refactor" am: a7463139cd am: 8cf1eda025

Change-Id: I0933c434c9c63e15f8af648aa99250eea95aa3bd