[Demonstration 1]

[Buggy Method]
@Override
protected void stopPlayback(boolean clearSurface) {
    audioFocusHelper.abandonFocus();
    videoViewImpl.stopPlayback(clearSurface);
    setKeepScreenOn(false);
    if (videoControls != null && videoControls instanceof TestControllers) {
        ((TestControllers) videoControls).updatePlaybackState(false, false);
    }
}

[Buggy Hunk]
((TestControllers) videoControls).updatePlaybackState(false, false);

[Patch]
((TestControllers) videoControls).updatePlaybackStateAndHideController(false);

[Demonstration 2]

[Buggy Method]
void setSelection(long trackerID) {
    if (trackerIDToSelectionIDMap.containsKey(trackerID)) {
        int item = trackerIDToSelectionIDMap.get(trackerID);
        spinner.setSelection(item, true);
    }
}

[Buggy Hunk]
spinner.setSelection(item, true);

[Patch]
spinner.setSelection(item);

[Demonstration 3]

[Buggy Method]
@Override
public void updateRotationStateForImmersive() {
    int orientation = mContext.getResources().getConfiguration().orientation;
    boolean shouldEnable = false;
    /**
     * int mOrientationImmersiveState:
     * 0 - Both
     * 1 - Landscape only
     * 2 - Portrait only
     */
    switch(orientation) {
        case Configuration.ORIENTATION_LANDSCAPE:
            if (mOrientationImmersiveState == 1) {
                shouldEnable = true;
            }
            if (mOrientationImmersiveState == 2) {
                shouldEnable = false;
            }
            break;
        case Configuration.ORIENTATION_PORTRAIT:
            if (mOrientationImmersiveState == 2) {
                shouldEnable = true;
            }
            if (mOrientationImmersiveState == 1) {
                shouldEnable = false;
            }
            break;
    }
    // update the immersive settings
    if (!mImmersiveState || !shouldEnable) {
        mImmersiveModeBehavior = 0;
    } else {
        mImmersiveModeBehavior = Settings.System.getIntForUser(resolver, Settings.System.GLOBAL_IMMERSIVE_MODE_STYLE, 2, UserHandle.USER_CURRENT);
    }
    if (mGlobalImmersiveModeStyle != mImmersiveModeBehavior) {
        mGlobalImmersiveModeStyle = mImmersiveModeBehavior;
    }
    if (mImmersiveModeConfirmation != null) {
        mImmersiveModeConfirmation.loadSetting(mCurrentUserId);
    }
}

[Buggy Hunk]
mImmersiveModeBehavior = Settings.System.getIntForUser(resolver,

[Patch]
mImmersiveModeBehavior = Settings.System.getIntForUser(mContext.getContentResolver(),