Fix multiple issues with the keystore grant mechanism
am: af7783f735  -s ours

Change-Id: Id919cd01ea98116316db03487ea8c1c039c3d973