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

Change-Id: I40e45522feec13f7d32ea6206e37b0796e6c4fc5