keystore: add API to query storage type

Add an API to query the HAL to see what kind of storage it reports the
device is.

Change-Id: I37951e989ad724e2352df6e321f03f19e58b4fca
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 385f005..438a8e4 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -742,6 +742,10 @@
         return put(filename, &keyBlob);
     }
 
+    bool isHardwareBacked() const {
+        return (mDevice->flags & KEYMASTER_SOFTWARE_ONLY) != 0;
+    }
+
 private:
     static const char* MASTER_KEY_FILE;
     static const int MASTER_KEY_SIZE_BYTES = 16;
@@ -1648,6 +1652,10 @@
         return mKeyStore->put(target, &keyBlob);
     }
 
+    int32_t is_hardware_backed() {
+        return mKeyStore->isHardwareBacked() ? 1 : 0;
+    }
+
 private:
     inline bool isKeystoreUnlocked(State state) {
         switch (state) {