/* * Copyright (C) 2020 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. */ #pragma once #include #include #include #include #include "DumpstateServer.grpc.pb.h" #include "DumpstateServer.pb.h" namespace android::hardware::dumpstate::V1_1::implementation { namespace fs = android::hardware::automotive::filesystem; class DumpstateDevice : public IDumpstateDevice { public: explicit DumpstateDevice(const std::string& addr); // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow. Return dumpstateBoard(const hidl_handle& h) override; // Methods from ::android::hardware::dumpstate::V1_1::IDumpstateDevice follow. Return dumpstateBoard_1_1(const hidl_handle& h, const DumpstateMode mode, const uint64_t timeoutMillis) override; Return setVerboseLoggingEnabled(const bool enable) override; Return getVerboseLoggingEnabled() override; bool isHealthy(); Return debug(const hidl_handle& fd, const hidl_vec& options); private: bool dumpRemoteLogs(::grpc::ClientReaderInterface* reader, const fs::path& dumpPath); bool dumpString(const std::string& text, const fs::path& dumpPath); bool dumpHelperSystem(int textFd, int binFd); void debugDumpServices(std::function f); std::vector getAvailableServices(); std::string mServiceAddr; std::shared_ptr<::grpc::Channel> mGrpcChannel; std::unique_ptr mGrpcStub; }; sp makeVirtualizationDumpstateDevice(const std::string& addr); } // namespace android::hardware::dumpstate::V1_1::implementation