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

Commit c159a5ae authored by Robert Shih's avatar Robert Shih
Browse files

DO NOT MERGE MediaPlayerService: avoid invalid static cast

Bug: 30204103
Change-Id: Ie0dd3568a375f1e9fed8615ad3d85184bcc99028
parent 17a10c50
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -497,6 +497,12 @@ void MediaPlayerService::removeClient(wp<Client> client)
    mClients.remove(client);
}

bool MediaPlayerService::hasClient(wp<Client> client)
{
    Mutex::Autolock lock(mLock);
    return mClients.indexOf(client) != NAME_NOT_FOUND;
}

MediaPlayerService::Client::Client(
        const sp<MediaPlayerService>& service, pid_t pid,
        int32_t connId, const sp<IMediaPlayerClient>& client,
@@ -926,6 +932,10 @@ status_t MediaPlayerService::Client::setNextPlayer(const sp<IMediaPlayer>& playe
    ALOGV("setNextPlayer");
    Mutex::Autolock l(mLock);
    sp<Client> c = static_cast<Client*>(player.get());
    if (!mService->hasClient(c)) {
      return BAD_VALUE;
    }

    mNextClient = c;

    if (c != NULL) {
+1 −0
Original line number Diff line number Diff line
@@ -276,6 +276,7 @@ public:
            const char *host, int32_t port, const char *exclusionList);

            void                removeClient(wp<Client> client);
            bool                hasClient(wp<Client> client);

    // For battery usage tracking purpose
    struct BatteryUsageInfo {