incidentd can now handle multiple callers asking it for incident reports

Test: bit incident_test:* GtsIncidentManagerTestCases:*
Bug: 123543706
Change-Id: I9f671dd5d8b2ad139f952a23e575c2be16120459
diff --git a/libs/services/src/content/ComponentName.cpp b/libs/services/src/content/ComponentName.cpp
new file mode 100644
index 0000000..adb67ee
--- /dev/null
+++ b/libs/services/src/content/ComponentName.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android/content/ComponentName.h>
+
+namespace android {
+namespace content {
+
+ComponentName::ComponentName()
+        :mPackage(),
+         mClass() {
+}
+
+ComponentName::ComponentName(const ComponentName& that)
+        :mPackage(that.mPackage),
+         mClass(that.mClass) {
+}
+
+ComponentName::ComponentName(const string& pkg, const string& cls)
+        :mPackage(pkg),
+         mClass(cls) {
+}
+
+ComponentName::~ComponentName() {
+}
+
+bool ComponentName::operator<(const ComponentName& that) const {
+    if (mPackage < that.mPackage) {
+       return true;
+    } else if (mPackage > that.mPackage) {
+       return false;
+    }
+    return mClass < that.mClass;
+}
+
+status_t ComponentName::readFromParcel(const Parcel* in) {
+    status_t err;
+
+    // Note: This is a subtle variation from the java version, which
+    // requires non-null strings, but does not require non-empty strings.
+    // This code implicitly requires non-null strings, because it's impossible,
+    // but reading null strings that were somehow written by the java
+    // code would turn them into empty strings.
+
+    err = in->readUtf8FromUtf16(&mPackage);
+    if (err != NO_ERROR) {
+        return err;
+    }
+
+    err = in->readUtf8FromUtf16(&mClass);
+    if (err != NO_ERROR) {
+        return err;
+    }
+
+    return NO_ERROR;
+}
+
+status_t ComponentName::writeToParcel(android::Parcel* out) const {
+    status_t err;
+
+    err = out->writeUtf8AsUtf16(mPackage);
+    if (err != NO_ERROR) {
+        return err;
+    }
+
+    err = out->writeUtf8AsUtf16(mClass);
+    if (err != NO_ERROR) {
+        return err;
+    }
+
+    return NO_ERROR;
+}
+
+}} // namespace android::content
+
diff --git a/libs/services/src/os/DropBoxManager.cpp b/libs/services/src/os/DropBoxManager.cpp
index 681d5f7..429f996 100644
--- a/libs/services/src/os/DropBoxManager.cpp
+++ b/libs/services/src/os/DropBoxManager.cpp
@@ -225,7 +225,10 @@
     if (service == NULL) {
         return Status::fromExceptionCode(Status::EX_NULL_POINTER, "can't find dropbox service");
     }
-    return service->add(entry);
+    ALOGD("About to call service->add()");
+    Status status = service->add(entry);
+    ALOGD("service->add returned %s", status.toString8().string());
+    return status;
 }
 
 }} // namespace android::os