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

Commit 4aab170b authored by Steven Moreland's avatar Steven Moreland Committed by android-build-merger
Browse files

Merge "dumpstate example: use new lazy hal mechanism" am: 60d9b984 am: 045e3f99

am: 8a27154f

Change-Id: I367ddc344691e8ff6306045d412174059f96d507
parents 9c075cc2 8a27154f
Loading
Loading
Loading
Loading
+0 −5
Original line number Original line Diff line number Diff line
@@ -37,11 +37,6 @@ Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
    // NOTE: this is just an example on how to use the DumpstateUtil.h functions to implement
    // NOTE: this is just an example on how to use the DumpstateUtil.h functions to implement
    // this interface.
    // this interface.


    // Exit when dump is completed since this is a lazy HAL.
    addPostCommandTask([]() {
        exit(0);
    });

    if (handle == nullptr || handle->numFds < 1) {
    if (handle == nullptr || handle->numFds < 1) {
        ALOGE("no FDs\n");
        ALOGE("no FDs\n");
        return Void();
        return Void();
+8 −4
Original line number Original line Diff line number Diff line
@@ -15,22 +15,26 @@
 */
 */
#define LOG_TAG "android.hardware.dumpstate@1.0-service"
#define LOG_TAG "android.hardware.dumpstate@1.0-service"


#include <hidl/HidlLazyUtils.h>
#include <hidl/HidlSupport.h>
#include <hidl/HidlSupport.h>
#include <hidl/HidlTransportSupport.h>
#include <hidl/HidlTransportSupport.h>


#include "DumpstateDevice.h"
#include "DumpstateDevice.h"


using ::android::OK;
using ::android::sp;
using ::android::hardware::configureRpcThreadpool;
using ::android::hardware::configureRpcThreadpool;
using ::android::hardware::joinRpcThreadpool;
using ::android::hardware::LazyServiceRegistrar;
using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
using ::android::hardware::dumpstate::V1_0::implementation::DumpstateDevice;
using ::android::hardware::dumpstate::V1_0::implementation::DumpstateDevice;
using ::android::hardware::joinRpcThreadpool;
using ::android::OK;
using ::android::sp;


int main(int /* argc */, char* /* argv */ []) {
int main(int /* argc */, char* /* argv */ []) {
    sp<IDumpstateDevice> dumpstate = new DumpstateDevice;
    sp<IDumpstateDevice> dumpstate = new DumpstateDevice;
    configureRpcThreadpool(1, true /* will join */);
    configureRpcThreadpool(1, true /* will join */);
    if (dumpstate->registerAsService() != OK) {

    auto registrar = LazyServiceRegistrar::getInstance();
    if (registrar.registerService(dumpstate) != OK) {
        ALOGE("Could not register service.");
        ALOGE("Could not register service.");
        return 1;
        return 1;
    }
    }