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

Commit f37df070 authored by Adam Powell's avatar Adam Powell
Browse files

resolved conflicts for merge of b39470b5 to master

Change-Id: If441c8684c576b6cbc485a37088d6869ad3fb23f
parents f1ec1ddd b39470b5
Loading
Loading
Loading
Loading
+45 −34
Original line number Diff line number Diff line
@@ -6279,28 +6279,6 @@
 visibility="public"
>
</field>
<field name="kraken_resource_pad58"
 type="int"
 transient="false"
 volatile="false"
 value="16843463"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="kraken_resource_pad59"
 type="int"
 transient="false"
 volatile="false"
 value="16843462"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="kraken_resource_pad6"
 type="int"
 transient="false"
@@ -6312,17 +6290,6 @@
 visibility="public"
>
</field>
<field name="kraken_resource_pad60"
 type="int"
 transient="false"
 volatile="false"
 value="16843461"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="kraken_resource_pad7"
 type="int"
 transient="false"
@@ -10129,6 +10096,39 @@
 visibility="public"
>
</field>
<field name="textSelectHandle"
 type="int"
 transient="false"
 volatile="false"
 value="16843463"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="textSelectHandleLeft"
 type="int"
 transient="false"
 volatile="false"
 value="16843461"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="textSelectHandleRight"
 type="int"
 transient="false"
 volatile="false"
 value="16843462"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="textSize"
 type="int"
 transient="false"
@@ -239587,8 +239587,19 @@
 visibility="public"
>
</method>
<method name="isShowing"
 return="boolean"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="onTouchEvent"
 return="void"
 return="boolean"
 abstract="true"
 native="false"
 synchronized="false"
+59 −2
Original line number Diff line number Diff line
@@ -1612,16 +1612,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     */
    private static final int AWAKEN_SCROLL_BARS_ON_ATTACH = 0x08000000;

    /**
     * Indicates that this view has a visible/touchable overlay.
     * @hide
     */
    static final int HAS_OVERLAY = 0x10000000;

    /**
     * Indicates that pivotX or pivotY were explicitly set and we should not assume the center
     * for transform operations
     *
     * @hide
     */
    private static final int PIVOT_EXPLICITLY_SET = 0x10000000;
    private static final int PIVOT_EXPLICITLY_SET = 0x20000000;

    /** {@hide} */
    static final int ACTIVATED                    = 0x20000000;
    static final int ACTIVATED                    = 0x40000000;

    /**
     * The parent this view is attached to.
@@ -3034,6 +3040,57 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        resetPressedState();
    }

    /**
     * Enable or disable drawing overlays after a full drawing pass. This enables a view to
     * draw on a topmost overlay layer after normal drawing completes and get right of first
     * refusal for touch events in the window.
     * 
     * <em>Warning:</em> Views that use this feature should take care to disable/enable overlay
     * appropriately when they are attached/detached from their window. All overlays should be
     * disabled when detached.
     * 
     * @param enabled true if overlay drawing should be enabled for this view, false otherwise
     * 
     * @see #onDrawOverlay(Canvas)
     * 
     * @hide
     */
    protected void setOverlayEnabled(boolean enabled) {
        final boolean oldValue = (mPrivateFlags & HAS_OVERLAY) == HAS_OVERLAY;
        mPrivateFlags = (mPrivateFlags & ~HAS_OVERLAY) | (enabled ? HAS_OVERLAY : 0);
        if (enabled != oldValue) {
            final ViewParent parent = getParent();
            if (parent != null) {
                try {
                    parent.childOverlayStateChanged(this);
                } catch (AbstractMethodError e) {
                    Log.e(VIEW_LOG_TAG, "Could not propagate hasOverlay state", e);
                }
            }
        }
    }

    /**
     * @return true if this View has an overlay enabled.
     * 
     * @see #setOverlayEnabled(boolean)
     * @see #onDrawOverlay(Canvas)
     * 
     * @hide
     */
    public boolean isOverlayEnabled() {
        return (mPrivateFlags & HAS_OVERLAY) == HAS_OVERLAY;
    }

    /**
     * Override this method to draw on an overlay layer above all other views in the window
     * after the standard drawing pass is complete. This allows a view to draw outside its
     * normal boundaries.
     * @hide
     */
    public void onDrawOverlay(Canvas canvas) {
    }

    private void resetPressedState() {
        if ((mViewFlags & ENABLED_MASK) == DISABLED) {
            return;
+101 −2
Original line number Diff line number Diff line
@@ -244,10 +244,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     */
    protected static final int FLAG_DISALLOW_INTERCEPT = 0x80000;

    /**
     * When set, at least one child of this ViewGroup will return true from hasOverlay.
     */
    private static final int FLAG_CHILD_HAS_OVERLAY = 0x100000;

    /**
     * When set, this ViewGroup will split MotionEvents to multiple child Views when appropriate.
     */
    private static final int FLAG_SPLIT_MOTION_EVENTS = 0x100000;
    private static final int FLAG_SPLIT_MOTION_EVENTS = 0x200000;

    /**
     * Indicates which types of drawing caches are to be kept in memory.
@@ -904,6 +909,34 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                // who can handle it, start with the front-most child.
                final View[] children = mChildren;
                final int count = mChildrenCount;

                // Check for children with overlays first. They don't rely on hit rects to determine
                // if they can accept a new touch event.
                if ((mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY) {
                    for (int i = count - 1; i >= 0; i--) {
                        final View child = children[i];
                        // Don't let children respond to events as an overlay during an animation.
                        if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE
                                && child.getAnimation() == null
                                && child.isOverlayEnabled()) {
                            // offset the event to the view's coordinate system
                            final float xc = scrolledXFloat - child.mLeft;
                            final float yc = scrolledYFloat - child.mTop;
                            ev.setLocation(xc, yc);
                            child.mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT;
                            if (child.dispatchTouchEvent(ev))  {
                                // Event handled, we have a target now.
                                mMotionTarget = child;
                                return true;
                            }
                            // The event didn't get handled, try the next view.
                            // Don't reset the event's location, it's not
                            // necessary here.
                        }
                    }
                }

                // Now check views normally.
                for (int i = count - 1; i >= 0; i--) {
                    final View child = children[i];
                    if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE
@@ -2741,6 +2774,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        if (clearChildFocus != null) {
            clearChildFocus(clearChildFocus);
        }

        mGroupFlags &= ~FLAG_CHILD_HAS_OVERLAY;
    }

    /**
@@ -2989,7 +3024,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                final int left = mLeft;
                final int top = mTop;

                if (dirty.intersect(0, 0, mRight - left, mBottom - top) ||
                if ((mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY ||
                        dirty.intersect(0, 0, mRight - left, mBottom - top) ||
                        (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION) {
                    mPrivateFlags &= ~DRAWING_CACHE_VALID;

@@ -3976,6 +4012,69 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        mAnimationListener = animationListener;
    }

    /**
     * Called when a child's overlay state changes between enabled/disabled.
     * @param child Child view whose state has changed or null
     * @hide
     */
    public void childOverlayStateChanged(View child) {
        boolean childHasOverlay = false;
        if (child != null) {
            childHasOverlay = child.isOverlayEnabled();
        } else {
            final int childCount = getChildCount();
            for (int i = 0; i < childCount; i++) {
                if (childHasOverlay |= getChildAt(i).isOverlayEnabled()) {
                    break;
                }
            }
        }
        
        final boolean hasChildWithOverlay = childHasOverlay ||
                (mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY;

        final boolean oldValue = isOverlayEnabled();
        mGroupFlags = (mGroupFlags & ~FLAG_CHILD_HAS_OVERLAY) |
                (hasChildWithOverlay ? FLAG_CHILD_HAS_OVERLAY : 0);
        if (isOverlayEnabled() != oldValue) {
            final ViewParent parent = getParent();
            if (parent != null) {
                try {
                    parent.childOverlayStateChanged(this);
                } catch (AbstractMethodError e) {
                    Log.e("ViewGroup", "Could not propagate hasOverlay state", e);
                }
            }
        }
    }

    /**
     * @hide
     */
    public boolean isOverlayEnabled() {
        return super.isOverlayEnabled() ||
                ((mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY);
    }

    /**
     * @hide
     */
    @Override
    public void onDrawOverlay(Canvas canvas) {
        if ((mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY) {
            final int childCount = getChildCount();
            for (int i = 0; i < childCount; i++) {
                final View child = getChildAt(i);
                if (child.isOverlayEnabled()) {
                    canvas.translate(child.mLeft + child.mScrollX, child.mTop + child.mScrollY);
                    child.onDrawOverlay(canvas);
                    canvas.translate(-(child.mLeft + child.mScrollX),
                            -(child.mTop + child.mScrollY));
                }
            }
        }
    }

    /**
     * LayoutParams are used by views to tell their parents how they want to be
     * laid out. See
+7 −0
Original line number Diff line number Diff line
@@ -222,4 +222,11 @@ public interface ViewParent {
     */
    public boolean requestChildRectangleOnScreen(View child, Rect rectangle,
            boolean immediate);

    /**
     * Called when a child view's overlay state changes between enabled/disabled.
     * @param child Child view whose state changed or null.
     * @hide
     */
    public void childOverlayStateChanged(View child);
}
+18 −0
Original line number Diff line number Diff line
@@ -207,6 +207,8 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn

    private final int mDensity;
    
    private boolean mHasOverlay;

    public static IWindowSession getWindowSession(Looper mainLooper) {
        synchronized (mStaticInit) {
            if (!mInitialized) {
@@ -1357,6 +1359,9 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn
                        canvas.setScreenDensity(scalingRequired
                                ? DisplayMetrics.DENSITY_DEVICE : 0);
                        mView.draw(canvas);
                        if (mHasOverlay) {
                            mView.onDrawOverlay(canvas);
                        }
                    } finally {
                        mAttachInfo.mIgnoreDirtyState = false;
                    }
@@ -2739,6 +2744,19 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn
        return scrollToRectOrFocus(rectangle, immediate);
    }

    /**
     * @hide
     */
    public void childOverlayStateChanged(View child) {
        final boolean oldState = mHasOverlay;
        mHasOverlay = child.isOverlayEnabled();
        // Invalidate the whole thing when we change overlay states just in case
        // something left chunks of data drawn someplace it shouldn't have.
        if (mHasOverlay != oldState) {
            child.invalidate();
        }
    }

    class TakenSurfaceHolder extends BaseSurfaceHolder {
        @Override
        public boolean onAllowLockCanvas() {
Loading