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

Commit b4d17e1c authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

Merge "mcp: Fix possible null pointer exception"

parents fa699f0b e90e3d92
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -212,8 +212,6 @@ public class MediaControlProfile implements MediaControlServiceCallbacks {
        } else {
            mMediaPlayerList = new MediaPlayerList(Looper.myLooper(), mContext);
        }

        mMediaPlayerList.init(new ListCallback());
    }

    @Override
@@ -651,6 +649,7 @@ public class MediaControlProfile implements MediaControlServiceCallbacks {

    public void init() {
        mCurrentData = new MediaData(null, null, null);
        mMediaPlayerList.init(new ListCallback());

        String appToken = mContext.getPackageName();
        synchronized (mServiceMap) {
+3 −2
Original line number Diff line number Diff line
@@ -133,10 +133,11 @@ public class MediaControlProfileTest {
        mMediaControlProfile.onServiceInstanceRegistered(ServiceStatus.OK, mMockGMcsService);
        mMcpServiceCallbacks = mMediaControlProfile;

        // Make sure callbacks are not called before it's fully initialized
        verify(mMockMediaPlayerList, times(0)).init(any());
        mMediaControlProfile.init();


        verify(mMockMediaPlayerList).init(listCallbackCaptor.capture());

        listCallback = listCallbackCaptor.getValue();
        listCallback.run(mMockMediaData);
        // Give some time to verify if post function finishes on update player state method call