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

Commit 53ea8f9e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "libmediaplayerservice: fix deadlock in dump()"

parents 04f384ab ecb44d93
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -456,6 +456,9 @@ status_t MediaPlayerService::dump(int fd, const Vector<String16>& args)
    const size_t SIZE = 256;
    char buffer[SIZE];
    String8 result;
    SortedVector< sp<Client> > clients; //to serialise the mutex unlock & client destruction.
    SortedVector< sp<MediaRecorderClient> > mediaRecorderClients;

    if (checkCallingPermission(String16("android.permission.DUMP")) == false) {
        snprintf(buffer, SIZE, "Permission Denial: "
                "can't dump MediaPlayerService from pid=%d, uid=%d\n",
@@ -467,6 +470,7 @@ status_t MediaPlayerService::dump(int fd, const Vector<String16>& args)
        for (int i = 0, n = mClients.size(); i < n; ++i) {
            sp<Client> c = mClients[i].promote();
            if (c != 0) c->dump(fd, args);
            clients.add(c);
        }
        if (mMediaRecorderClients.size() == 0) {
                result.append(" No media recorder client\n\n");
@@ -479,6 +483,7 @@ status_t MediaPlayerService::dump(int fd, const Vector<String16>& args)
                    write(fd, result.string(), result.size());
                    result = "\n";
                    c->dump(fd, args);
                    mediaRecorderClients.add(c);
                }
            }
        }