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

Commit 8cb9f4e7 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Convert to using inputConfig for clone info in WindowInfo"

parents 359e4d73 8577ea8e
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ bool WindowInfo::operator==(const WindowInfo& info) const {
            info.inputConfig == inputConfig && info.displayId == displayId &&
            info.replaceTouchableRegionWithCrop == replaceTouchableRegionWithCrop &&
            info.applicationInfo == applicationInfo && info.layoutParamsType == layoutParamsType &&
            info.layoutParamsFlags == layoutParamsFlags && info.isClone == isClone;
            info.layoutParamsFlags == layoutParamsFlags;
}

status_t WindowInfo::writeToParcel(android::Parcel* parcel) const {
@@ -124,8 +124,7 @@ status_t WindowInfo::writeToParcel(android::Parcel* parcel) const {
        parcel->write(touchableRegion) ?:
        parcel->writeBool(replaceTouchableRegionWithCrop) ?:
        parcel->writeStrongBinder(touchableRegionCropHandle.promote()) ?:
        parcel->writeStrongBinder(windowToken) ?:
        parcel->writeBool(isClone);
        parcel->writeStrongBinder(windowToken);
    // clang-format on
    return status;
}
@@ -176,8 +175,7 @@ status_t WindowInfo::readFromParcel(const android::Parcel* parcel) {
        parcel->read(touchableRegion) ?:
        parcel->readBool(&replaceTouchableRegionWithCrop) ?:
        parcel->readNullableStrongBinder(&touchableRegionCropHandleSp) ?:
        parcel->readNullableStrongBinder(&windowToken) ?:
        parcel->readBool(&isClone);
        parcel->readNullableStrongBinder(&windowToken);
    // clang-format on

    if (status != OK) {
+2 −2
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@ struct WindowInfo : public Parcelable {
                static_cast<uint32_t>(os::InputConfig::SPY),
        INTERCEPTS_STYLUS =
                static_cast<uint32_t>(os::InputConfig::INTERCEPTS_STYLUS),
        CLONE =
                static_cast<uint32_t>(os::InputConfig::CLONE),
        // clang-format on
    };

@@ -236,8 +238,6 @@ struct WindowInfo : public Parcelable {

    void setInputConfig(ftl::Flags<InputConfig> config, bool value);

    bool isClone = false;

    void addTouchableRegion(const Rect& region);

    bool touchableRegionContainsPoint(int32_t x, int32_t y) const;
+0 −2
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ TEST(WindowInfo, Parcelling) {
    i.applicationInfo.name = "ApplicationFooBar";
    i.applicationInfo.token = new BBinder();
    i.applicationInfo.dispatchingTimeoutMillis = 0x12345678ABCD;
    i.isClone = true;

    Parcel p;
    i.writeToParcel(&p);
@@ -102,7 +101,6 @@ TEST(WindowInfo, Parcelling) {
    ASSERT_EQ(i.replaceTouchableRegionWithCrop, i2.replaceTouchableRegionWithCrop);
    ASSERT_EQ(i.touchableRegionCropHandle, i2.touchableRegionCropHandle);
    ASSERT_EQ(i.applicationInfo, i2.applicationInfo);
    ASSERT_EQ(i.isClone, i2.isClone);
}

TEST(InputApplicationInfo, Parcelling) {
+6 −0
Original line number Diff line number Diff line
@@ -144,4 +144,10 @@ enum InputConfig {
     * It is not valid to set this configuration if {@link #TRUSTED_OVERLAY} is not set.
     */
    INTERCEPTS_STYLUS            = 1 << 15,

    /**
     * The window is a clone of another window. This may be treated differently since there's
     * likely a duplicate window with the same client token, but different bounds.
     */
    CLONE                        = 1 << 16,
}
+1 −1
Original line number Diff line number Diff line
@@ -2418,7 +2418,7 @@ WindowInfo Layer::fillInputInfo(const ui::Transform& displayTransform, bool disp
    // If the layer is a clone, we need to crop the input region to cloned root to prevent
    // touches from going outside the cloned area.
    if (isClone()) {
        info.isClone = true;
        info.inputConfig |= WindowInfo::InputConfig::CLONE;
        if (const sp<Layer> clonedRoot = getClonedRoot()) {
            const Rect rect = displayTransform.transform(Rect{clonedRoot->mScreenBounds});
            info.touchableRegion = info.touchableRegion.intersect(rect);