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

Commit 2942a4e2 authored by Eric Tan's avatar Eric Tan
Browse files

Remove --json option from dumpsys media.audio_flinger

The more recent work that this was supposed to become is reflected in
dumpsys media.log, so this commit removes some code clutter that is not
used anymore.

Other Changes:
- Use std::make_unique for creating unique_ptr objects

Test: build, dumpsys media.audio_flinger
Bug: 68148948
Change-Id: I4841e118c2cdee4ada4c6cdc0fff1ec2e12b38c4
parent ea055e6d
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -22,9 +22,6 @@ LOCAL_SHARED_LIBRARIES := \
	libsoundtriggerservice \
	libutils

LOCAL_STATIC_LIBRARIES := \
	libjsoncpp

# TODO oboeservice is the old folder name for aaudioservice. It will be changed.
LOCAL_C_INCLUDES := \
	frameworks/av/services/audioflinger \
+0 −1
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ LOCAL_SHARED_LIBRARIES := \

LOCAL_STATIC_LIBRARIES := \
    libcpustats \
    libjsoncpp \
    libsndfile \

LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
+0 −41
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
//#define LOG_NDEBUG 0

#include "Configuration.h"
#include <algorithm>    // std::any_of
#include <dirent.h>
#include <math.h>
#include <signal.h>
@@ -58,8 +57,6 @@

#include <audio_utils/primitives.h>

#include <json/json.h>

#include <powermanager/PowerManager.h>

#include <media/IMediaLogService.h>
@@ -437,18 +434,6 @@ status_t AudioFlinger::dump(int fd, const Vector<String16>& args)
    if (!dumpAllowed()) {
        dumpPermissionDenial(fd, args);
    } else {
        // XXX This is sort of hacky for now.
        const bool formatJson = std::any_of(args.begin(), args.end(),
                [](const String16 &arg) { return arg == String16("--json"); });
        if (formatJson) {
            Json::Value root = getJsonDump();
            Json::FastWriter writer;
            std::string rootStr = writer.write(root);
            // XXX consider buffering if the string happens to be too long.
            dprintf(fd, "%s", rootStr.c_str());
            return NO_ERROR;
        }

        // get state of hardware lock
        bool hardwareLocked = dumpTryLock(mHardwareLock);
        if (!hardwareLocked) {
@@ -575,32 +560,6 @@ status_t AudioFlinger::dump(int fd, const Vector<String16>& args)
    return NO_ERROR;
}

Json::Value AudioFlinger::getJsonDump()
{
    Json::Value root(Json::objectValue);
    const bool locked = dumpTryLock(mLock);

    // failed to lock - AudioFlinger is probably deadlocked
    if (!locked) {
        root["deadlock_message"] = kDeadlockedString;
    }
    // FIXME risky to access data structures without a lock held?

    Json::Value playbackThreads = Json::arrayValue;
    // dump playback threads
    for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
        playbackThreads.append(mPlaybackThreads.valueAt(i)->getJsonDump());
    }

    if (locked) {
        mLock.unlock();
    }

    root["playback_threads"] = playbackThreads;

    return root;
}

sp<AudioFlinger::Client> AudioFlinger::registerPid(pid_t pid)
{
    Mutex::Autolock _cl(mClientLock);
+0 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@
#include <mutex>
#include <deque>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -81,7 +80,6 @@

#include <powermanager/IPowerManager.h>

#include <json/json.h>
#include <media/nblog/NBLog.h>
#include <private/media/AudioEffectShared.h>
#include <private/media/AudioTrackShared.h>
@@ -117,7 +115,6 @@ public:
    static const char* getServiceName() ANDROID_API { return "media.audio_flinger"; }

    virtual     status_t    dump(int fd, const Vector<String16>& args);
                Json::Value getJsonDump();

    // IAudioFlinger interface, in binder opcode order
    virtual sp<IAudioTrack> createTrack(const CreateTrackInput& input,
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
//#define AUDIO_WATCHDOG

// uncomment to display CPU load adjusted for CPU frequency
//define CPU_FREQUENCY_STATISTICS
//#define CPU_FREQUENCY_STATISTICS

// uncomment to enable fast threads to take performance samples for later statistical analysis
#define FAST_THREAD_STATISTICS
Loading