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

Commit 93f5bcab authored by Marco Nelissen's avatar Marco Nelissen Committed by android-build-merger
Browse files

Get service by value instead of reference

am: 61a6d26a

* commit '61a6d26a':
  Get service by value instead of reference
parents 33514675 61a6d26a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -77,7 +77,7 @@ public:
    const char* extractMetadata(int keyCode);
    const char* extractMetadata(int keyCode);


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


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


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