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

Commit 9b5257c9 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

MediaSessionLegacyHelper uses global Application context

MediaSessionLegacyHelper used a Context passed by an application
  which can cause a leak of Activity instances. Use the global
  Application context instead.
Also prevent crash if a null Context is supplied (method not
  documented as requesting a non-null Context).

Bug 18767503

Change-Id: I8281047d0af233a323f3fc11ababedff848829ec
parent 296aa925
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -69,12 +69,9 @@ public class MediaSessionLegacyHelper {
    }

    public static MediaSessionLegacyHelper getHelper(Context context) {
        if (DEBUG) {
            Log.d(TAG, "Attempting to get helper with context " + context);
        }
        synchronized (sLock) {
            if (sInstance == null) {
                sInstance = new MediaSessionLegacyHelper(context);
                sInstance = new MediaSessionLegacyHelper(context.getApplicationContext());
            }
        }
        return sInstance;