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

Commit a2f747c5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Workaround glitches from SOFT_INPUT_ADJUST_PAN" into oc-dev

parents 52a4125f 3e04f091
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -341,6 +341,7 @@ public final class ThreadedRenderer {

    private boolean mEnabled;
    private boolean mRequested = true;
    private boolean mIsOpaque = false;

    ThreadedRenderer(Context context, boolean translucent, String name) {
        final TypedArray a = context.obtainStyledAttributes(null, R.styleable.Lighting, 0, 0);
@@ -355,6 +356,7 @@ public final class ThreadedRenderer {
        long rootNodePtr = nCreateRootRenderNode();
        mRootNode = RenderNode.adopt(rootNodePtr);
        mRootNode.setClipToBounds(false);
        mIsOpaque = !translucent;
        mNativeProxy = nCreateProxy(translucent, rootNodePtr);
        nSetName(mNativeProxy, name);

@@ -571,7 +573,12 @@ public final class ThreadedRenderer {
     * Change the ThreadedRenderer's opacity
     */
    void setOpaque(boolean opaque) {
        nSetOpaque(mNativeProxy, opaque && !mHasInsets);
        mIsOpaque = opaque && !mHasInsets;
        nSetOpaque(mNativeProxy, mIsOpaque);
    }

    boolean isOpaque() {
        return mIsOpaque;
    }

    /**
+11 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.PixelFormat;
import android.graphics.Point;
@@ -2651,6 +2652,15 @@ public final class ViewRootImpl implements ViewParent,

    @Override
    public void onPreDraw(DisplayListCanvas canvas) {
        // If mCurScrollY is not 0 then this influences the hardwareYOffset. The end result is we
        // can apply offsets that are not handled by anything else, resulting in underdraw as
        // the View is shifted (thus shifting the window background) exposing unpainted
        // content. To handle this with minimal glitches we just clear to BLACK if the window
        // is opaque. If it's not opaque then HWUI already internally does a glClear to
        // transparent, so there's no risk of underdraw on non-opaque surfaces.
        if (mCurScrollY != 0 && mHardwareYOffset != 0 && mAttachInfo.mThreadedRenderer.isOpaque()) {
            canvas.drawColor(Color.BLACK);
        }
        canvas.translate(-mHardwareXOffset, -mHardwareYOffset);
    }

@@ -2668,7 +2678,7 @@ public final class ViewRootImpl implements ViewParent,
    void outputDisplayList(View view) {
        view.mRenderNode.output();
        if (mAttachInfo.mThreadedRenderer != null) {
            ((ThreadedRenderer)mAttachInfo.mThreadedRenderer).serializeDisplayListTree();
            mAttachInfo.mThreadedRenderer.serializeDisplayListTree();
        }
    }