esed: OemLock HAL implementation.

This change adds basic OemLock behavior
using libese-app-boot as well as a client
integration test (which should later move into
VTS-style testing).

It also moves OemLock and Weaver over to
a ScopedEseConnection which will open and close
the ese based on use.  At present, it will log
on error and let later errors handle failures.
In the future, it can aid in helping with power
down delay requests and the HAL endpoints can
handle init() failures explicitly.

Test: starts eѕed and run the integration tests. Also confirm failure of
device lock flipping when production=true and boot_priv is high.
Bug: 35628284
Change-Id: I67442ec04ded2dc8f1ed1f37fe6b89af1e7e98e9
diff --git a/esed/Weaver.cpp b/esed/Weaver.cpp
index d6cd673..8ed10d3 100644
--- a/esed/Weaver.cpp
+++ b/esed/Weaver.cpp
@@ -23,6 +23,7 @@
 #include <utils/String8.h>
 
 #include "../apps/weaver/include/ese/app/weaver.h"
+#include "ScopedEseConnection.h"
 
 // libutils
 using android::String8;
@@ -49,8 +50,9 @@
 // Methods from ::android::hardware::weaver::V1_0::IWeaver follow.
 Return<void> Weaver::getConfig(getConfig_cb _hidl_cb) {
     LOG(VERBOSE) << "Running Weaver::getNumSlots";
-
     // Open SE session for applet
+    ScopedEseConnection ese{mEse};
+    ese.init();
     EseWeaverSession ws;
     ese_weaver_session_init(&ws);
     EseAppResult res = ese_weaver_session_open(mEse.ese_interface(), &ws);
@@ -88,7 +90,8 @@
 Return<WeaverStatus> Weaver::write(uint32_t slotId, const hidl_vec<uint8_t>& key,
                            const hidl_vec<uint8_t>& value) {
     LOG(INFO) << "Running Weaver::write on slot " << slotId;
-
+    ScopedEseConnection ese{mEse};
+    ese.init();
     // Validate the key and value sizes
     if (key.size() != kEseWeaverKeySize) {
         return Status::fromExceptionCode(Status::EX_ILLEGAL_ARGUMENT, WRONG_KEY_SIZE_MSG);
@@ -126,6 +129,8 @@
     }
 
     // Open SE session for applet
+    ScopedEseConnection ese{mEse};
+    ese.init();
     EseWeaverSession ws;
     ese_weaver_session_init(&ws);
     if (ese_weaver_session_open(mEse.ese_interface(), &ws) != ESE_APP_RESULT_OK) {