ExportResult implement Parcelable interface

Simplify the code and prepare for the switch to cpp-aidl generated
    interface, proxy and stub file.

Change-Id: I6873ee376642e62aff8cd88da7bdcb6f16d30df7
Signed-off-by: Bin Chen <pierr.chen@gmail.com>
diff --git a/keystore/IKeystoreService.cpp b/keystore/IKeystoreService.cpp
index 6507f79..2996659 100644
--- a/keystore/IKeystoreService.cpp
+++ b/keystore/IKeystoreService.cpp
@@ -105,7 +105,8 @@
 ExportResult::~ExportResult() {
 }
 
-void ExportResult::readFromParcel(const Parcel& in) {
+status_t ExportResult::readFromParcel(const Parcel* inn) {
+    const Parcel& in = *inn;
     resultCode = in.readInt32();
     ssize_t length = in.readInt32();
     dataLength = 0;
@@ -123,9 +124,10 @@
             ALOGE("Failed to readInplace ExportData data");
         }
     }
+    return OK;
 }
 
-void ExportResult::writeToParcel(Parcel* out) const {
+status_t ExportResult::writeToParcel(Parcel* out) const {
     out->writeInt32(resultCode);
     out->writeInt32(dataLength);
     if (exportData && dataLength) {
@@ -136,6 +138,7 @@
             ALOGE("Failed to writeInplace ExportResult data.");
         }
     }
+    return OK;
 }
 
 KeymasterArguments::KeymasterArguments() {
@@ -1126,9 +1129,8 @@
             result->resultCode = KM_ERROR_UNKNOWN_ERROR;
             return;
         }
-        if (reply.readInt32() != 0) {
-            result->readFromParcel(reply);
-        }
+
+        reply.readParcelable(result);
     }
 
     virtual void begin(const sp<IBinder>& appToken, const String16& name,
@@ -1724,8 +1726,7 @@
             ExportResult result;
             exportKey(name, format, clientId.get(), appData.get(), &result);
             reply->writeNoException();
-            reply->writeInt32(1);
-            result.writeToParcel(reply);
+            reply->writeParcelable(result);
 
             return NO_ERROR;
         }