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

Change-Id: I4df8daf1210a31b4ae0e32ee8c04f8f7acdc827b