Detect when the Weaver applet is not installed.
Report no available storage in the Weaver applet when the applet is not
installed to allow the framework to fallback to a software mechanism
rather than failing becase the Weaver applet isn't there.
Test: Removed applet and zero was returned, restored applet and expected
number of slots were reported.
Change-Id: I5bead1ca68dbebe0cce148de3632c1a8b24a464d
diff --git a/esed/Weaver.cpp b/esed/Weaver.cpp
index df0b91b..d6cd673 100644
--- a/esed/Weaver.cpp
+++ b/esed/Weaver.cpp
@@ -53,7 +53,18 @@
// Open SE session for applet
EseWeaverSession ws;
ese_weaver_session_init(&ws);
- if (ese_weaver_session_open(mEse.ese_interface(), &ws) != ESE_APP_RESULT_OK) {
+ EseAppResult res = ese_weaver_session_open(mEse.ese_interface(), &ws);
+ if (EseAppResultValue(res) == ESE_APP_RESULT_ERROR_OS) {
+ switch (EseAppResultAppValue(res)) {
+ case 0x6999: // SW_APPLET_SELECT_FAILED
+ case 0x6A82: // SW_FILE_NOT_FOUND
+ // No applet means no Weaver storage. Report no slots to prompt
+ // fallback to software mode.
+ _hidl_cb(WeaverStatus::OK, WeaverConfig{0, 0, 0});
+ return Void();
+ }
+ } else if (res != ESE_APP_RESULT_OK) {
+ // Transient error
_hidl_cb(WeaverStatus::FAILED, WeaverConfig{});
return Void();
}