OSDN Git Service

Update to use the correct library for logging.
authorYifan Hong <elsk@google.com>
Mon, 28 Nov 2016 23:59:24 +0000 (15:59 -0800)
committerYifan Hong <elsk@google.com>
Tue, 29 Nov 2016 21:10:15 +0000 (13:10 -0800)
Generates: b/33193497
Test: mma
Change-Id: Ib8bfc4d2f1d68947099e4756f661ed06689ffd62

tests/bar/1.0/default/Bar.cpp
tests/foo/1.0/default/Foo.cpp
tests/foo/1.0/default/FooCallback.cpp
tests/inheritance/1.0/default/Child.cpp
tests/inheritance/1.0/default/Fetcher.cpp
tests/inheritance/1.0/default/Parent.cpp
tests/pointer/1.0/default/Graph.cpp
tests/pointer/1.0/default/Pointer.cpp
tests/pointer/1.0/default/Pointer.h
tests/pointer/1.0/default/lib/PointerHelper.cpp

index c07e2fa..b3f971a 100644 (file)
@@ -2,7 +2,7 @@
 #define LOG_TAG "hidl_test"
 
 #include "Bar.h"
-#include <android-base/logging.h>
+#include <android/log.h>
 #include <inttypes.h>
 
 namespace android {
index 7053b44..5a51532 100644 (file)
@@ -17,7 +17,7 @@ namespace implementation {
 
 // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
 Return<void> Foo::doThis(float param) {
-    ALOGI("SERVER(Foo) doThis(%.2f)", param);
+    LOG(INFO) << "SERVER(Foo) doThis(" << param << ")";
 
     return Void();
 }
@@ -49,7 +49,7 @@ Return<double> Foo::doQuiteABit(
 
 Return<void> Foo::doSomethingElse(
         const hidl_array<int32_t, 15> &param, doSomethingElse_cb _cb) {
-    ALOGI("SERVER(Foo) doSomethingElse(...)");
+    LOG(INFO) << "SERVER(Foo) doSomethingElse(...)";
 
     hidl_array<int32_t, 32> result;
     for (size_t i = 0; i < 15; ++i) {
@@ -66,7 +66,7 @@ Return<void> Foo::doSomethingElse(
 
 Return<void> Foo::doStuffAndReturnAString(
         doStuffAndReturnAString_cb _cb) {
-    ALOGI("SERVER(Foo) doStuffAndReturnAString");
+    LOG(INFO) << "SERVER(Foo) doStuffAndReturnAString";
 
     _cb("Hello, world");
 
@@ -75,7 +75,7 @@ Return<void> Foo::doStuffAndReturnAString(
 
 Return<void> Foo::mapThisVector(
         const hidl_vec<int32_t> &param, mapThisVector_cb _cb) {
-    ALOGI("SERVER(Foo) mapThisVector");
+    LOG(INFO) << "SERVER(Foo) mapThisVector";
 
     hidl_vec<int32_t> out;
     out.resize(param.size());
@@ -91,80 +91,98 @@ Return<void> Foo::mapThisVector(
 
 Return<void> Foo::callMe(
         const sp<IFooCallback> &cb) {
-    ALOGI("SERVER(Foo) callMe %p", cb.get());
+    LOG(INFO) << "SERVER(Foo) callMe " << cb.get();
 
     if (cb != NULL) {
-
         hidl_array<nsecs_t, 3> c;
-        ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYou, " \
-              "should return immediately", cb.get());
+        LOG(INFO) << "SERVER(Foo) callMe "
+                  << cb.get()
+                  << " calling IFooCallback::heyItsYou, should return immediately";
         c[0] = systemTime();
         cb->heyItsYou(cb);
         c[0] = systemTime() - c[0];
-        ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYou " \
-              "returned after %" PRId64 "ns", cb.get(), c[0]);
-
-        ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYouIsntIt, " \
-              "should block for %" PRId64 " seconds", cb.get(),
-              DELAY_S);
+        LOG(INFO) << "SERVER(Foo) callMe "
+                  << cb.get()
+                  << " calling IFooCallback::heyItsYou, returned after"
+                  << c[0]
+                  << "ns";
+        LOG(INFO) << "SERVER(Foo) callMe "
+                  << cb.get()
+                  << " calling IFooCallback::heyItsYouIsntIt, should block for"
+                  << DELAY_S
+                  << " seconds";
         c[1] = systemTime();
         Return<bool> ret = cb->heyItsYouIsntIt(cb);
         if (!ret.isOk()) {
-            ALOGE("SERVER(Foo) callMe %p encountered transport error (%d).",
-                  cb.get(), ret.getStatus().exceptionCode());
+            LOG(ERROR) << "SERVER(Foo) callMe "
+                      << cb.get()
+                      << " encountered transport error ("
+                      << ret.getStatus().exceptionCode()
+                      << ").";
             return Void();
         }
         bool answer = ret.get();
         c[1] = systemTime() - c[1];
-        ALOGI("SERVER(Foo) callMe %p IFooCallback::heyItsYouIsntIt " \
-              "responded with %d after %" PRId64 "ns", cb.get(), answer, c[1]);
 
-        ALOGI("SERVER(Foo) callMe %p calling " \
-              "IFooCallback::heyItsTheMeaningOfLife, " \
-              "should return immediately ", cb.get());
+        LOG(INFO) << "SERVER(Foo) callMe "
+                  << cb.get()
+                  << " calling IFooCallback::heyItsYouIsntIt, responded with "
+                  << answer
+                  << " after "
+                  << c[1]
+                  << "ns";
+
+        LOG(INFO) << "SERVER(Foo) callMe "
+                  << cb.get()
+                  << " calling IFooCallback::heyItsTheMeaningOfLife,"
+                  << " should return immediately";
         c[2] = systemTime();
         cb->heyItsTheMeaningOfLife(42);
         c[2] = systemTime() - c[2];
-        ALOGI("SERVER(Foo) callMe %p After call to " \
-              "IFooCallback::heyItsTheMeaningOfLife " \
-              "responded after %" PRId64 "ns", cb.get(), c[2]);
 
-        ALOGI("SERVER(Foo) callMe %p calling IFooCallback::youBlockedMeFor " \
-              "to report times", cb.get());
+        LOG(INFO) << "SERVER(Foo) callMe "
+                  << cb.get()
+                  << " cAfter call to IFooCallback::heyItsTheMeaningOfLife responded after "
+                  << c[2]
+                  << "ns";
+        LOG(INFO) << "SERVER(Foo) callMe "
+                  << cb.get()
+                  << " calling IFooCallback::youBlockedMeFor to report times";
         cb->youBlockedMeFor(c);
-        ALOGI("SERVER(Foo) callMe %p After call to " \
-              "IFooCallback::heyYouBlockedMeFor", cb.get());
+        LOG(INFO) << "SERVER(Foo) callMe "
+                  << cb.get()
+                  << " After call to IFooCallback::youBlockedMeFor";
     }
 
     return Void();
 }
 
 Return<Foo::SomeEnum> Foo::useAnEnum(SomeEnum param) {
-    ALOGI("SERVER(Foo) useAnEnum %d", (int)param);
+    LOG(INFO) << "SERVER(Foo) useAnEnum " << (int)param;
 
     return SomeEnum::goober;
 }
 
 Return<void> Foo::haveAGooberVec(const hidl_vec<Goober>& param) {
-    ALOGI("SERVER(Foo) haveAGooberVec &param = %p", &param);
+    LOG(INFO) << "SERVER(Foo) haveAGooberVec &param = " << &param;
 
     return Void();
 }
 
 Return<void> Foo::haveAGoober(const Goober &g) {
-    ALOGI("SERVER(Foo) haveaGoober g=%p", &g);
+    LOG(INFO) << "SERVER(Foo) haveaGoober g=" << &g;
 
     return Void();
 }
 
 Return<void> Foo::haveAGooberArray(const hidl_array<Goober, 20> & /* lots */) {
-    ALOGI("SERVER(Foo) haveAGooberArray");
+    LOG(INFO) << "SERVER(Foo) haveAGooberArray";
 
     return Void();
 }
 
 Return<void> Foo::haveATypeFromAnotherFile(const Abc &def) {
-    ALOGI("SERVER(Foo) haveATypeFromAnotherFile def=%p", &def);
+    LOG(INFO) << "SERVER(Foo) haveATypeFromAnotherFile def=" << &def;
 
     return Void();
 }
@@ -172,10 +190,14 @@ Return<void> Foo::haveATypeFromAnotherFile(const Abc &def) {
 Return<void> Foo::haveSomeStrings(
         const hidl_array<hidl_string, 3> &array,
         haveSomeStrings_cb _cb) {
-    ALOGI("SERVER(Foo) haveSomeStrings([\"%s\", \"%s\", \"%s\"])",
-          array[0].c_str(),
-          array[1].c_str(),
-          array[2].c_str());
+
+    LOG(INFO) << "SERVER(Foo) haveSomeStrings([\""
+              << array[0].c_str()
+              << "\", \""
+              << array[1].c_str()
+              << "\", \""
+              << array[2].c_str()
+              << "\"])";
 
     hidl_array<hidl_string, 2> result;
     result[0] = "Hello";
@@ -189,10 +211,13 @@ Return<void> Foo::haveSomeStrings(
 Return<void> Foo::haveAStringVec(
         const hidl_vec<hidl_string> &vector,
         haveAStringVec_cb _cb) {
-    ALOGI("SERVER(Foo) haveAStringVec([\"%s\", \"%s\", \"%s\"])",
-          vector[0].c_str(),
-          vector[1].c_str(),
-          vector[2].c_str());
+    LOG(INFO) << "SERVER(Foo) haveAStringVec([\""
+              << vector[0].c_str()
+              << "\", \""
+              << vector[1].c_str()
+              << "\", \""
+              << vector[2].c_str()
+              << "\"])";
 
     hidl_vec<hidl_string> result;
     result.resize(2);
@@ -207,7 +232,7 @@ Return<void> Foo::haveAStringVec(
 
 Return<void> Foo::transposeMe(
         const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) {
-    ALOGI("SERVER(Foo) transposeMe(%s)", to_string(in).c_str());
+    LOG(INFO) << "SERVER(Foo) transposeMe(" << to_string(in).c_str() << ")";
 
     hidl_array<float, 5, 3> out;
     for (size_t i = 0; i < 5; ++i) {
@@ -216,7 +241,7 @@ Return<void> Foo::transposeMe(
         }
     }
 
-    ALOGI("SERVER(Foo) transposeMe returning %s", to_string(out).c_str());
+    LOG(INFO) << "SERVER(Foo) transposeMe returning " << to_string(out).c_str();
 
     _cb(out);
 
@@ -225,7 +250,7 @@ Return<void> Foo::transposeMe(
 
 Return<void> Foo::callingDrWho(
         const MultiDimensional &in, callingDrWho_cb _hidl_cb) {
-    ALOGI("SERVER(Foo) callingDrWho(%s)", MultiDimensionalToString(in).c_str());
+    LOG(INFO) << "SERVER(Foo) callingDrWho(" << MultiDimensionalToString(in).c_str() << ")";
 
     MultiDimensional out;
     for (size_t i = 0; i < 5; ++i) {
index e4704f2..ff3a545 100644 (file)
@@ -2,7 +2,7 @@
 #define LOG_TAG "hidl_test"
 
 #include "FooCallback.h"
-#include <android-base/logging.h>
+#include <android/log.h>
 #include <hidl-test/FooHelper.h>
 #include <inttypes.h>
 #include <utils/Timers.h>
index 66720b3..fd6608c 100644 (file)
@@ -1,5 +1,5 @@
 #define LOG_TAG "hidl_test"
-#include <android-base/logging.h>
+#include <android/log.h>
 
 #include "Child.h"
 
index 74f8d07..f3b576b 100644 (file)
@@ -28,7 +28,7 @@ Return<void> selectService(bool sendRemote, CB &_hidl_cb, sp<IChild> &local) {
     } else {
         toSend = local;
     }
-    ALOGI("SERVER(Fetcher) selectService returning %p", toSend.get());
+    LOG(INFO) << "SERVER(Fetcher) selectService returning " << toSend.get();
     _hidl_cb(toSend);
     return Void();
 }
index bdd20c9..a6fd911 100644 (file)
@@ -1,5 +1,5 @@
 #define LOG_TAG "hidl_test"
-#include <android-base/logging.h>
+#include <android/log.h>
 
 #include "Parent.h"
 
index 5aa2243..9852407 100644 (file)
@@ -1,5 +1,7 @@
+#define LOG_TAG "hidl_test"
+
 #include "Graph.h"
-#include <android-base/logging.h>
+#include <android/log.h>
 #include <hidl-test/PointerHelper.h>
 
 #define PUSH_ERROR_IF(__cond__) if(__cond__) { errors.push_back(std::to_string(__LINE__) + ": " + #__cond__); }
index d7cd772..2b4a323 100644 (file)
@@ -1,4 +1,7 @@
+#define LOG_TAG "hidl_test"
+
 #include "Pointer.h"
+#include <android/log.h>
 
 namespace android {
 namespace hardware {
@@ -7,6 +10,14 @@ namespace pointer {
 namespace V1_0 {
 namespace implementation {
 
+Return<int32_t> Pointer::getErrors() {
+    if(!errors.empty()) {
+        for(const auto& e : errors)
+            ALOGW("SERVER(Pointer) error: %s", e.c_str());
+    }
+    return errors.size();
+}
+
 IPointer* HIDL_FETCH_IPointer(const char* /* name */) {
     return new Pointer();
 }
index 87b0f56..d6e3e48 100644 (file)
@@ -2,7 +2,6 @@
 #define ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H
 
 #include <android/hardware/tests/pointer/1.0/IPointer.h>
-#include <android-base/logging.h>
 #include <hidl/Status.h>
 
 #include <hidl/MQDescriptor.h>
@@ -28,13 +27,7 @@ struct Pointer : public IPointer {
 private:
     std::vector<std::string> errors;
 public:
-    Return<int32_t> getErrors() {
-        if(!errors.empty()) {
-            for(const auto& e : errors)
-                ALOGW("SERVER(Pointer) error: %s", e.c_str());
-        }
-        return errors.size();
-    }
+    Return<int32_t> getErrors() override;
     Return<void> foo1(const IPointer::Sam& s, IPointer::Sam const* s_ptr) override {
         PUSH_ERROR_IF(!(&s == s_ptr));
         return Void();
@@ -71,9 +64,6 @@ public:
         return Void();
     }
     Return<void> foo9(::android::hardware::hidl_string const* str_ref) override {
-        ALOGI("SERVER(Pointer) foo9 got string @ %p (size = %ld) \"%s\"",
-            str_ref->c_str(),
-            (unsigned long) str_ref->size(), str_ref->c_str());
         PUSH_ERROR_IF(!(strcmp(str_ref->c_str(), "meowmeowmeow") == 0));
         return Void();
     }
index ed7d49a..3bc82c2 100644 (file)
@@ -1,5 +1,5 @@
 #define LOG_TAG "hidl_test"
-#include <android-base/logging.h>
+#include <android/log.h>
 #include "PointerHelper.h"
 namespace android {