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

Commit 88b45664 authored by Vineeta Srivastava's avatar Vineeta Srivastava Committed by Android (Google) Code Review
Browse files

Merge "libmediaplayerservice: fix deadlock in dump()"

parents 366d92e0 330c8e3f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -442,6 +442,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",
@@ -453,6 +456,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");
@@ -465,6 +469,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);
                }
            }
        }