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

Commit f8828992 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5743138 from 38172ad8 to qt-qpr1-release

Change-Id: Ia65857712cfba9e1c0e409e170041ef116177926
parents 893a37fc 38172ad8
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -2037,6 +2037,13 @@ bool Layer::isRemovedFromCurrentState() const {
    return mRemovedFromCurrentState;
}

// Debug helper for b/137560795
#define INT32_MIGHT_OVERFLOW(n) (((n) >= INT32_MAX / 2) || ((n) <= INT32_MIN / 2))

#define RECT_BOUNDS_INVALID(rect)                                               \
    (INT32_MIGHT_OVERFLOW((rect).left) || INT32_MIGHT_OVERFLOW((rect).right) || \
     INT32_MIGHT_OVERFLOW((rect).bottom) || INT32_MIGHT_OVERFLOW((rect).top))

InputWindowInfo Layer::fillInputInfo() {
    InputWindowInfo info = mDrawingState.inputInfo;

@@ -2066,6 +2073,26 @@ InputWindowInfo Layer::fillInputInfo() {
        layerBounds = getCroppedBufferSize(getDrawingState());
    }
    layerBounds = t.transform(layerBounds);

    // debug check for b/137560795
    {
        if (RECT_BOUNDS_INVALID(layerBounds)) {
            ALOGE("layer %s bounds are invalid (%" PRIi32 ", %" PRIi32 ", %" PRIi32 ", %" PRIi32
                  ")",
                  mName.c_str(), layerBounds.left, layerBounds.top, layerBounds.right,
                  layerBounds.bottom);
            std::string out;
            getTransform().dump(out, "Transform");
            ALOGE("%s", out.c_str());
            layerBounds.left = layerBounds.top = layerBounds.right = layerBounds.bottom = 0;
        }

        if (INT32_MIGHT_OVERFLOW(xSurfaceInset) || INT32_MIGHT_OVERFLOW(ySurfaceInset)) {
            ALOGE("layer %s surface inset are invalid (%" PRIi32 ", %" PRIi32 ")", mName.c_str(),
                  int32_t(xSurfaceInset), int32_t(ySurfaceInset));
            xSurfaceInset = ySurfaceInset = 0;
        }
    }
    layerBounds.inset(xSurfaceInset, ySurfaceInset, xSurfaceInset, ySurfaceInset);

    // Input coordinate should match the layer bounds.