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

Commit 5db73079 authored by Marco Nelissen's avatar Marco Nelissen Committed by The Android Automerger
Browse files

Get service by value instead of reference

to prevent a cleared service binder from being used.

Bug: 26040840
Change-Id: Ifb5483c55b172d3553deb80dbe27f2204b86ecdb
parent b7c8681b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public:
    const char* extractMetadata(int keyCode);

private:
    static const sp<IMediaPlayerService>& getService();
    static const sp<IMediaPlayerService> getService();

    class DeathNotifier: public IBinder::DeathRecipient
    {
+2 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ Mutex MediaMetadataRetriever::sServiceLock;
sp<IMediaPlayerService> MediaMetadataRetriever::sService;
sp<MediaMetadataRetriever::DeathNotifier> MediaMetadataRetriever::sDeathNotifier;

const sp<IMediaPlayerService>& MediaMetadataRetriever::getService()
const sp<IMediaPlayerService> MediaMetadataRetriever::getService()
{
    Mutex::Autolock lock(sServiceLock);
    if (sService == 0) {
@@ -62,7 +62,7 @@ const sp<IMediaPlayerService>& MediaMetadataRetriever::getService()
MediaMetadataRetriever::MediaMetadataRetriever()
{
    ALOGV("constructor");
    const sp<IMediaPlayerService>& service(getService());
    const sp<IMediaPlayerService> service(getService());
    if (service == 0) {
        ALOGE("failed to obtain MediaMetadataRetrieverService");
        return;