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

Commit 51efd244 authored by Robert Shih's avatar Robert Shih Committed by android-build-merger
Browse files

MediaPlayerService: avoid invalid static cast am: ee0a0e39 am: 7b6a8554 am: b07255f6

am: d5608308

Change-Id: I77a7c93a2ae554532accb3be47bdee687b99f271
parents be78a1c7 d5608308
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -559,6 +559,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,
@@ -1056,6 +1062,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
@@ -226,6 +226,7 @@ public:
    virtual status_t            dump(int fd, const Vector<String16>& args);

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

    // For battery usage tracking purpose
    struct BatteryUsageInfo {