Source:
void onConnectedNotLocked() { if (DEBUG) { Log.d(TAG, "onConnectedNotLocked token=" + mToken); } final SessionCommandGroup2 allowedCommands; final List<CommandButton> customLayout; synchronized (mLock) { if (mIsReleased || mConnected) { return; } mPlaybackStateCompat = mControllerCompat.getPlaybackState(); mAllowedCommands = MediaUtils2.convertToSessionCommandGroup( mControllerCompat.getFlags(), mPlaybackStateCompat); mPlayerState = MediaUtils2.convertToPlayerState(mPlaybackStateCompat); mBufferedPosition = mPlaybackStateCompat == null ? UNKNOWN_TIME : mPlaybackStateCompat.getBufferedPosition(); mCustomLayout = MediaUtils2.convertToCustomLayout(mPlaybackStateCompat); allowedCommands = mAllowedCommands; customLayout = mCustomLayout; mPlaybackInfo = MediaUtils2.toPlaybackInfo2(mControllerCompat.getPlaybackInfo()); mRepeatMode = mControllerCompat.getRepeatMode(); mShuffleMode = mControllerCompat.getShuffleMode(); mQueue = MediaUtils2.removeNullElements(mControllerCompat.getQueue()); if (mQueue == null || mQueue.size() == 0) { mQueue = null; mPlaylist = null; } else { mPlaylist = MediaUtils2.convertQueueItemListToMediaItem2List(mQueue); } mPlaylistMetadata = MediaUtils2.convertToMediaMetadata2( mControllerCompat.getQueueTitle()); setCurrentMediaItemLocked(mControllerCompat.getMetadata()); mConnected = true; } mCallbackExecutor.execute(new Runnable() { @Override public void run() { mCallback.onConnected(mInstance, allowedCommands); } }); if (customLayout.size() != 0) { mCallbackExecutor.execute(new Runnable() { @Override public void run() { mCallback.onSetCustomLayout(mInstance, customLayout); } }); } }

Target:
void onConnectedNotLocked() { if (DEBUG) { Log.d(TAG, "onConnectedNotLocked token=" + mToken); } final SessionCommandGroup2 allowedCommands; final List<CommandButton> customLayout; synchronized (mLock) { if (mIsReleased || mConnected) { return; } mPlaybackStateCompat = mControllerCompat.getPlaybackState(); mAllowedCommands = MediaUtils2.convertToSessionCommandGroup( mControllerCompat.getFlags(), mPlaybackStateCompat); mPlayerState = MediaUtils2.convertToPlayerState(mPlaybackStateCompat); mBufferedPosition = mPlaybackStateCompat == null ? UNKNOWN_TIME : mPlaybackStateCompat.getBufferedPosition(); mCustomLayout = MediaUtils2.convertToCustomLayout(mPlaybackStateCompat); allowedCommands = mAllowedCommands; customLayout = mCustomLayout; mPlaybackInfo = MediaUtils2.toPlaybackInfo2(mControllerCompat.getPlaybackInfo()); mRepeatMode = mControllerCompat.getRepeatMode(); mShuffleMode = mControllerCompat.getShuffleMode(); mQueue = MediaUtils2.removeNullElements(mControllerCompat.getQueue()); if (mQueue == null || mQueue.size() == 0) { mQueue = null; mPlaylist = null; } else { mPlaylist = MediaUtils2.convertQueueItemListToMediaItem2List(mQueue); } mPlaylistMetadata = MediaUtils2.convertToMediaMetadata2( mControllerCompat.getQueueTitle()); setCurrentMediaItemLocked(mControllerCompat.getMetadata()); mConnected = true; } mCallbackExecutor.execute(new Runnable() { @Override public void run() { mCallback.onConnected(mInstance, allowedCommands); } }); if (!customLayout.isEmpty()) { mCallbackExecutor.execute(new Runnable() { @Override public void run() { mCallback.onSetCustomLayout(mInstance, customLayout); } }); } }