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

Commit a2066a99 authored by Jim Huang's avatar Jim Huang Committed by Steve Kondik
Browse files

[frameworks] Applied fixes from Code Aurora Forum



Partially based on the below change:

commit 52c2e0e8d06f8943f5b443c9738a22d36f9fe54b
Author: Amar Singhal <c_amars@quicinc.com>
Date:   Thu May 28 15:36:31 2009 -0700

    Initial Contribution
(cherry picked from commit bbfbb99013d982bff0101c786ad1ba6738afb360)

Signed-off-by: default avatarTick Chen <tick@0xlab.org>
parent adf79e0b
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -2382,6 +2382,25 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        if (mOnLongClickListener != null) {
            handled = mOnLongClickListener.onLongClick(View.this);
        }

        // This is to avoid the Race condition when the parent window get
        // destroyed and context Menu window still tries to attach itself
        // to the parent window
        if (mAttachInfo != null) {
            final Rect displayFrame = new Rect();
            try {
                mAttachInfo.mSession.getDisplayFrame(mAttachInfo.mWindow,
                                                     displayFrame);
            } catch (RemoteException e) {
                return handled;
            }
            if ((displayFrame.top == 0) && (displayFrame.bottom == 0) &&
                (displayFrame.left == 0) && (displayFrame.right == 0)) {
                Log.w(VIEW_LOG_TAG, "Warning: Parent window is already destroyed. So do nothing");
               return true;
            }
        }

        if (!handled) {
            handled = showContextMenu();
        }
+10 −1
Original line number Diff line number Diff line
@@ -1255,6 +1255,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te

            child = mAdapter.getView(position, scrapView, this);

            if (child != null) {
            if (ViewDebug.TRACE_RECYCLER) {
                ViewDebug.trace(child, ViewDebug.RecyclerTraceType.BIND_VIEW,
                        position, getChildCount());
@@ -1270,16 +1271,20 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                            position, -1);
                }
            }
	    }
        } else {
            child = mAdapter.getView(position, null, this);
            if (mCacheColorHint != 0) {
                child.setDrawingCacheBackgroundColor(mCacheColorHint);
            }

	    if (child != null) {
            if (ViewDebug.TRACE_RECYCLER) {
                ViewDebug.trace(child, ViewDebug.RecyclerTraceType.NEW_VIEW,
                        position, getChildCount());
            }
        }
        }

        return child;
    }
@@ -1937,7 +1942,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        case MotionEvent.ACTION_DOWN: {
            int motionPosition = pointToPosition(x, y);
            if (!mDataChanged) {
                // Check if the position that we paqss is valid.
                // Check if position >= 0 and also position is always less
                // than the total count of ListAdapter
                if ((mTouchMode != TOUCH_MODE_FLING) && (motionPosition >= 0)
                    && (motionPosition < getAdapter().getCount())
                    && (getAdapter().isEnabled(motionPosition))) {
                    // User clicked on an actual view (and was not stopping a fling). It might be a
                    // click or a scroll. Assume it is a click until proven otherwise
+6 −0
Original line number Diff line number Diff line
@@ -301,6 +301,12 @@ public class GridView extends AbsListView {
        while (nextBottom > end && pos >= 0) {

            View temp = makeRow(pos, nextBottom, false);

            // Added the check to Avoid the Race condition.
            if (mReferenceView == null) {
                return selectedView;
            }

            if (temp != null) {
                selectedView = temp;
            }
+5 −1
Original line number Diff line number Diff line
@@ -184,7 +184,11 @@ public class HeaderViewListAdapter implements WrapperListAdapter, Filterable {
            int adjPosition = position - numHeaders;
            int adapterCount = mAdapter.getCount();
            if (adjPosition >= adapterCount) {
                if (mFooterViewInfos != null) {
               // When adjPosition >= adapterCount get the footer view at
               // that postion but ensure that the total footers count is
               // greater than adjPosition - adapterCount.
                if (mFooterViewInfos != null &&
                    getFootersCount() > (adjPosition - adapterCount)) {
                    return mFooterViewInfos.get(adjPosition - adapterCount).view;
                }
            } else {
+5 −3
Original line number Diff line number Diff line
@@ -636,6 +636,7 @@ public class ListView extends AbsListView {
            boolean selected = pos == mSelectedPosition;
            View child = makeAndAddView(pos, nextTop, true, mListPadding.left, selected);

            if (child != null)
                nextTop = child.getBottom() + mDividerHeight;
            if (selected) {
                selectedView = child;
@@ -1668,6 +1669,7 @@ public class ListView extends AbsListView {
        child = obtainView(position);

        // This needs to be positioned and measured
        if (child != null)
            setupChild(child, position, y, flow, childrenLeft, selected, false);

        return child;
@@ -2567,7 +2569,7 @@ public class ListView extends AbsListView {
            int startPos = (mSelectedPosition != INVALID_POSITION) ?
                    mSelectedPosition - 1 :
                    firstPosition + getChildCount() - 1;
            if (startPos < 0) {
            if (startPos < 0 || startPos >= mAdapter.getCount()) {
                return INVALID_POSITION;
            }
            if (startPos > last) {
Loading