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

Commit 8b84761b authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Automerger Merge Worker
Browse files

Merge "mcp: Fix possible null pointer exception" am: b4d17e1c

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Bluetooth/+/1841373

Change-Id: I3017a6871c996e2a1e3a06d32301c17066b8b0cd
parents db4a15f3 b4d17e1c
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