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

Commit 450f5405 authored by Kuowei Li's avatar Kuowei Li Committed by Mikhail Naganov
Browse files

audio: add dump on Streams, StreamWrapper and Module.

Add dump on Streams and StreamWrapper, so that dump of stream can be
requested via service of IModule.
Add default dump implementation for Module which dumps all streams.

Bug: 399383436
Test: adb shell dumpsys media.audio_flinger
      adb shell dumpsys android.hardware.audio.core.IModule/default
Change-Id: I478c750b1b102b1ced0c0523e5b6df700938e573
parent 0f715415
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -612,6 +612,15 @@ ndk::ScopedAStatus Module::updateStreamsConnectedState(const AudioPatch& oldPatc
    return ndk::ScopedAStatus::ok();
}

binder_status_t Module::dump(int fd, const char** args, uint32_t numArgs) {
    for (const auto& portConfig : getConfig().portConfigs) {
        if (portConfig.ext.getTag() == AudioPortExt::Tag::mix) {
            getStreams().dump(portConfig.id, fd, args, numArgs);
        }
    }
    return STATUS_OK;
}

ndk::ScopedAStatus Module::setModuleDebug(
        const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) {
    LOG(DEBUG) << __func__ << ": " << mType << ": old flags:" << mDebug.toString()
+2 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@ class Module : public BnModule {
    // The vendor extension done via inheritance can override interface methods and augment
    // a call to the base implementation.

    binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;

    ndk::ScopedAStatus setModuleDebug(
            const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) override;
    ndk::ScopedAStatus getTelephony(std::shared_ptr<ITelephony>* _aidl_return) override;
+12 −0
Original line number Diff line number Diff line
@@ -651,6 +651,12 @@ class StreamWrapper {
        return ndk::ScopedAStatus::ok();
    }

    void dump(int fd, const char** args, uint32_t numArgs) const {
        auto s = ::ndk::ICInterface::asInterface(mStreamBinder.get());
        if (s) s->dump(fd, args, numArgs);
        return;
    }

  private:
    std::weak_ptr<StreamCommonInterface> mStream;
    ndk::SpAIBinder mStreamBinder;
@@ -692,6 +698,12 @@ class Streams {
        }
        return ndk::ScopedAStatus::ok();
    }
    void dump(int32_t portConfigId, int fd, const char** args, uint32_t numArgs) const {
        if (auto it = mStreams.find(portConfigId); it != mStreams.end()) {
            it->second.dump(fd, args, numArgs);
        }
        return;
    }

  private:
    // Maps port ids and port config ids to streams. Multimap because a port