apps/boot: Clean up applet

The applet had a few todos and a few gaps:
- setWithMetadata was not enforcing requiredLocks.
- extended apdu support for incoming data was added
- a metadata staging interface added to work around
  communication constraints on different devices.
- setting or unsetting a lock with 0 metadata and
  useMetadata, will clear the metadata contents.
- adds inBootloaderRaw to state output for diagnostics.

The libese interface did not change, but the
implementation reflects the new behavior.

The applet version is updated appropriately.

(This change increases the flash footprint by 2k, but
attempts to avoid actually writing to it.)

Test: submit a 4k key and it writes and reads.
      all ese-boot-tool functions pass.
      LOCK_OWNER behavior is enforced even when using metadata.
Bug: 38150381
Change-Id: I0759db7388f8f42a7828b699b7b05b6046ec5a53
diff --git a/apps/build.xml b/apps/build.xml
index 6eb0a75..77626cc 100644
--- a/apps/build.xml
+++ b/apps/build.xml
@@ -144,7 +144,7 @@
       <!-- Base version (Version + .1) for displacing a preinstalled package on early cards. -->
       <cap aid="A0000004765049584C424F4F540000"
            package="com.android.verifiedboot.storage"
-           version="2.1"
+           version="3.1"
            output="${out}/avb_storage_clobber.cap"
            sources="boot/card/src/com/android/verifiedboot"
            export="${build}/export/avb_storage">
@@ -164,9 +164,9 @@
         <import exps="${build}/export/avb_storage"/>
       </cap>
       <!-- 14th byte is the version. Increment on each release. -->
-      <cap aid="A0000004765049584C424F4F540200"
+      <cap aid="A0000004765049584C424F4F540300"
            package="com.android.verifiedboot.storage"
-           version="2.0"
+           version="3.0"
            output="${out}/avb_storage.cap"
            sources="boot/card/src/com/android/verifiedboot"
            export="${build}/export/avb_storage">
@@ -182,7 +182,7 @@
              16th byte is 01 for the applet.
           -->
         <applet class="com.android.verifiedboot.storage.Storage"
-                aid="A0000004765049584C424F4F54020101"/>
+                aid="A0000004765049584C424F4F54030101"/>
         <import exps="${build}/export/avb_storage"/>
       </cap>
     </javacard>