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

Change-Id: I66a3e4f00e35af10fb37990d03f4e262a3d71605