Merge "Rename key_dir to metadata_key_dir and refactor" am: 60a55d91dc

Change-Id: Id85b38917e611199515ffdd795ca384cc4e04e13