Merge "Refactor key generation to handle both normal and metadata encryption." am: 8e0780cba2

Change-Id: I59510b64f6803f5e76fefa359abfcc9207420126