Upgrade android.hardware.dumpstate from HIDL 1.1 to AIDL 1

lshal is not supported for AIDL, now use dumpsys instead.
Update the debug command as below.
  Old: lshal debug android.hardware.dumpstate@1.1::IDumpstateDevice/default [section]
  New: dumpsys android.hardware.dumpstate.IDumpstateDevice/default [section]

Currently dumpsys does not start the Lazy HAL service, only dumpstate does.
Because we need to run dumpsys for debugging, keep the dumpstate HAL running at boot.
Do not set it to be a lazy HAL.

Test: atest VtsHalDumpstateTargetTest pass
      adb shell dumpsys -t 30 android.hardware.dumpstate.IDumpstateDevice/default all
Bug: 223118410
Change-Id: I7f866a57c3eff8c9783fee89dce205cf9728c459
This commit is contained in:
Alex Hong 2022-03-30 00:40:39 +08:00
parent 101c17fc95
commit cbc81c7f5b
9 changed files with 136 additions and 183 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 The Android Open Source Project
* Copyright (C) 2022 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.
@ -13,31 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.dumpstate@1.0-service.gs201"
#define LOG_TAG "android.hardware.dumpstate-service.gs201"
#include <hidl/HidlSupport.h>
#include <hidl/HidlTransportSupport.h>
#include "Dumpstate.h"
#include "DumpstateDevice.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using ::android::hardware::configureRpcThreadpool;
using ::android::hardware::dumpstate::V1_1::IDumpstateDevice;
using ::android::hardware::dumpstate::V1_1::implementation::DumpstateDevice;
using ::android::hardware::joinRpcThreadpool;
using ::android::sp;
using aidl::android::hardware::dumpstate::Dumpstate;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Dumpstate> dumpstate = ndk::SharedRefBase::make<Dumpstate>();
int main(int /* argc */, char* /* argv */ []) {
sp<IDumpstateDevice> dumpstate = new DumpstateDevice;
configureRpcThreadpool(1, true);
const std::string instance = std::string() + Dumpstate::descriptor + "/default";
binder_status_t status =
AServiceManager_registerLazyService(dumpstate->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
android::status_t status = dumpstate->registerAsService();
if (status != android::OK)
{
ALOGE("Could not register DumpstateDevice service (%d).", status);
return -1;
}
joinRpcThreadpool();
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // Unreachable
}