Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5e1ac67 authored by Yifan Hong's avatar Yifan Hong Committed by Gerrit Code Review
Browse files

Merge "Update to use the correct library for logging."

parents 9f518064 0c4c7a30
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 {
+69 −44
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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>
+1 −1
Original line number Diff line number Diff line
#define LOG_TAG "hidl_test"
#include <android-base/logging.h>
#include <android/log.h>

#include "Child.h"

+1 −1
Original line number Diff line number Diff line
@@ -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();
}
Loading