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

Commit c96ca439 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Show list of loaded extractors in dumpsys

Bug: 67908547
Test: build, boot, dumpsys
Change-Id: Ib398dd000979b6b5d85db5e446946c0c8ded1793
parent 7ffa062a
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -146,9 +146,14 @@ struct ExtractorPlugin : public RefBase {
    MediaExtractor::ExtractorDef def;
    void *libHandle;
    String8 libPath;
    String8 uuidString;

    ExtractorPlugin(MediaExtractor::ExtractorDef definition, void *handle, String8 &path)
        : def(definition), libHandle(handle), libPath(path) { }
        : def(definition), libHandle(handle), libPath(path) {
        for (size_t i = 0; i < sizeof MediaExtractor::ExtractorDef::extractor_uuid; i++) {
            uuidString.appendFormat("%02x", def.extractor_uuid.b[i]);
        }
    }
    ~ExtractorPlugin() {
        if (libHandle != nullptr) {
            ALOGV("closing handle for %s %d", libPath.c_str(), def.extractor_version);
@@ -307,4 +312,20 @@ void MediaExtractorFactory::UpdateExtractors(const char *newUpdateApkPath) {
    gPluginsRegistered = true;
}

status_t MediaExtractorFactory::dump(int fd, const Vector<String16>&) {
    Mutex::Autolock autoLock(gPluginMutex);
    String8 out;
    out.append("Available extractors:\n");
    for (auto it = gPlugins->begin(); it != gPlugins->end(); ++it) {
        out.appendFormat("  %25s: uuid(%s), version(%u), path(%s)\n",
                (*it)->def.extractor_name,
                (*it)->uuidString.c_str(),
                (*it)->def.extractor_version,
                (*it)->libPath.c_str());
    }
    write(fd, out.string(), out.size());
    return OK;
}


}  // namespace android
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ public:
    static sp<IMediaExtractor> CreateFromService(
            const sp<DataSource> &source, const char *mime = NULL);
    static void LoadPlugins(const ::std::string& apkPath);
    static status_t dump(int fd, const Vector<String16>& args);

private:
    static Mutex gPluginMutex;
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ sp<IDataSource> MediaExtractorService::makeIDataSource(int fd, int64_t offset, i
}

status_t MediaExtractorService::dump(int fd, const Vector<String16>& args) {
    return dumpExtractors(fd, args);
    return MediaExtractorFactory::dump(fd, args) || dumpExtractors(fd, args);
}

status_t MediaExtractorService::onTransact(uint32_t code, const Parcel& data, Parcel* reply,