Buggy code:
public PinnedPopupWindow ( ) { } public void show ( ) { getPositionListener ( ) . addSubscriber ( this , false ) ; computeLocalPosition ( ) ; final Editor . PositionListener positionListener = getPositionListener ( ) ; updatePosition ( positionListener . getPositionX ( ) , positionListener . getPositionY ( ) ) ; } protected void measureContent ( ) { } private void computeLocalPosition ( ) { } private void updatePosition ( int parentPositionX , int parentPositionY ) { } public void hide ( ) { } @ Override public void updatePosition ( int parentPositionX , int parentPositionY , boolean parentPositionChanged , boolean parentScrolled ) { } public boolean isShowing ( ) { } } private class SuggestionsPopupWindow extends Editor . PinnedPopupWindow implements OnItemClickListener { private static final int MAX_NUMBER_SUGGESTIONS = SuggestionSpan . SUGGESTIONS_MAX_SIZE ; private static final int ADD_TO_DICTIONARY = - 1 ; private static final int DELETE_TEXT = - 2 ; private Editor . SuggestionsPopupWindow . SuggestionInfo [ ] mSuggestionInfos ; private int mNumberOfSuggestions ; private boolean mCursorWasVisibleBeforeSuggestions ; private boolean mIsShowingUp = false ; private Editor . SuggestionsPopupWindow . SuggestionAdapter mSuggestionsAdapter ; private final Comparator < SuggestionSpan > mSuggestionSpanComparator ; private final HashMap < SuggestionSpan , Integer > mSpansLengths ; private class CustomPopupWindow extends PopupWindow { public CustomPopupWindow ( Context context , int defStyleAttr ) { } @ Override public void dismiss ( ) { } } public SuggestionsPopupWindow ( ) { } @ Override protected void createPopupWindow ( ) { } @ Override protected void initContentView ( ) { } public boolean isShowingUp ( ) { } public void onParentLostFocus ( ) { } private class SuggestionInfo { int suggestionStart ; int suggestionEnd ; SuggestionSpan suggestionSpan ; int suggestionIndex ; SpannableStringBuilder text = new SpannableStringBuilder ( ) ; TextAppearanceSpan highlightSpan = new TextAppearanceSpan ( mTextView . getContext ( ) , style . TextAppearance_SuggestionHighlight ) ; } private class SuggestionAdapter extends BaseAdapter { private LayoutInflater mInflater = ( ( LayoutInflater ) ( mTextView . getContext ( ) . getSystemService ( LAYOUT_INFLATER_SERVICE ) ) ) ; @ Override public int getCount ( ) { } @ Override public Object getItem ( int position ) { } @ Override public long getItemId ( int position ) { } @ Override public View getView ( int position , View convertView , ViewGroup parent ) { } } private class SuggestionSpanComparator implements Comparator < SuggestionSpan > { public int compare ( SuggestionSpan span1 , SuggestionSpan span2 ) { } } private SuggestionSpan [ ] getSuggestionSpans ( ) { } @ Override public void show ( ) { if ( ! ( ( mTextView . getText ( ) ) instanceof Editable ) ) return ; if ( updateSuggestions ( ) ) { mCursorWasVisibleBeforeSuggestions = mCursorVisible ; mTextView . setCursorVisible ( false ) ; mIsShowingUp = true ; super . show ( ) ; } } @ Override protected void measureContent ( ) { } @ Override protected int getTextOffset ( ) { } @ Override protected int getVerticalLocalPosition ( int line ) { } @ Override protected int clipVertically ( int positionY ) { } @ Override public void hide ( ) { } private boolean updateSuggestions ( ) { } private void highlightTextDifferences ( Editor . SuggestionsPopupWindow . SuggestionInfo suggestionInfo , int unionStart , int unionEnd ) { } @ Override public void onItemClick ( AdapterView < ? > parent , View view , int position , long id ) { } } private class SelectionActionModeCallback implements ActionMode . Callback { @ Override public boolean onCreateActionMode ( ActionMode mode , Menu menu ) { } @ Override public boolean onPrepareActionMode ( ActionMode mode , Menu menu ) { } @ Override public boolean onActionItemClicked ( ActionMode mode , MenuItem item ) { } @ Override public void onDestroyActionMode ( ActionMode mode ) { } } private class ActionPopupWindow extends Editor . PinnedPopupWindow implements OnClickListener { private static final int POPUP_TEXT_LAYOUT = layout . text_edit_action_popup_text ; private TextView mPasteTextView ; private TextView mReplaceTextView ; @ Override protected void createPopupWindow ( ) { } @ Override protected void initContentView ( ) { } @ Override public void show ( ) { <START_BUG> boolean canPaste = ( mTextView . canPaste ( ) ) && ( ( mSelectionActionMode ) == null ) ; <END_BUG> boolean canSuggest = ( mTextView . isSuggestionsEnabled ( ) ) && ( isCursorInsideSuggestionSpan ( ) ) ; mPasteTextView . setVisibility ( ( canPaste ? View . VISIBLE : View . GONE ) ) ; mReplaceTextView . setVisibility ( ( canSuggest ? View . VISIBLE : View . GONE ) ) ; if ( ( ! canPaste ) && ( ! canSuggest ) ) return ; super . show ( ) ; } @ Override public void onClick ( View view ) { } @ Override protected int getTextOffset ( ) { } @ Override protected int getVerticalLocalPosition ( int line ) { } @ Override protected int clipVertically ( int positionY ) { } } private final class CursorAnchorInfoNotifier implements Editor . TextViewPositionListener { final Builder mSelectionInfoBuilder = new CursorAnchorInfo . Builder ( ) ; final int [ ] mTmpIntOffset = new int [ 2 ] ; final Matrix mViewToScreenMatrix = new Matrix ( ) ; @ Override public void updatePosition ( int parentPositionX , int parentPositionY , boolean parentPositionChanged , boolean parentScrolled ) { } } private abstract class HandleView extends View implements Editor . TextViewPositionListener { protected Drawable mDrawable ; protected Drawable mDrawableLtr ; protected Drawable mDrawableRtl ; private final PopupWindow mContainer ; private int mPositionX ; private int mPositionY ; private boolean mIsDragging ; private float mTouchToWindowOffsetX ; private float mTouchToWindowOffsetY ; protected int mHotspotX ; protected int mHorizontalGravity ; private float mTouchOffsetY ; private float mIdealVerticalOffset ; private int mLastParentX ; private int mLastParentY ; protected Editor . ActionPopupWindow mActionPopupWindow ; private int mPreviousOffset = - 1 ; private boolean mPositionHasChanged = true ; private Runnable mActionPopupShower ; private int mMinSize ; public HandleView ( Drawable drawableLtr , Drawable drawableRtl ) { }

Fix:
boolean canPaste = mTextView . canPaste ( ) ;