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

Commit e0ba4e94 authored by chaviw's avatar chaviw
Browse files

Added windowToken to WindowInfo object

windowToken can be used to identify which WindowInfo relates to which
client window.

Test: WindowInfoTest
Bug: 188792659
Change-Id: I0ade0cf3b7020e95952735ed790922cf010aa04d
parent 9ea0a767
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -114,7 +114,8 @@ status_t WindowInfo::writeToParcel(android::Parcel* parcel) const {
        applicationInfo.writeToParcel(parcel) ?:
        applicationInfo.writeToParcel(parcel) ?:
        parcel->write(touchableRegion) ?:
        parcel->write(touchableRegion) ?:
        parcel->writeBool(replaceTouchableRegionWithCrop) ?:
        parcel->writeBool(replaceTouchableRegionWithCrop) ?:
        parcel->writeStrongBinder(touchableRegionCropHandle.promote());
        parcel->writeStrongBinder(touchableRegionCropHandle.promote()) ?:
        parcel->writeStrongBinder(windowToken);
    // clang-format on
    // clang-format on
    return status;
    return status;
}
}
@@ -188,7 +189,8 @@ status_t WindowInfo::readFromParcel(const android::Parcel* parcel) {
    touchableRegionCropHandle = parcel->readStrongBinder();
    touchableRegionCropHandle = parcel->readStrongBinder();
    transform.set({dsdx, dtdx, tx, dtdy, dsdy, ty, 0, 0, 1});
    transform.set({dsdx, dtdx, tx, dtdy, dsdy, ty, 0, 0, 1});


    return OK;
    status = parcel->readNullableStrongBinder(&windowToken);
    return status;
}
}


// --- WindowInfoHandle ---
// --- WindowInfoHandle ---
+4 −0
Original line number Original line Diff line number Diff line
@@ -132,6 +132,10 @@ struct WindowInfo : public Parcelable {
    // This value should NOT be used to uniquely identify the window. There may be different
    // This value should NOT be used to uniquely identify the window. There may be different
    // input windows that have the same token.
    // input windows that have the same token.
    sp<IBinder> token;
    sp<IBinder> token;

    // The token that identifies which client window this WindowInfo was created for.
    sp<IBinder> windowToken;

    // This uniquely identifies the input window.
    // This uniquely identifies the input window.
    int32_t id = -1;
    int32_t id = -1;
    std::string name;
    std::string name;
+2 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@ TEST(WindowInfo, Parcelling) {
    sp<IBinder> touchableRegionCropHandle = new BBinder();
    sp<IBinder> touchableRegionCropHandle = new BBinder();
    WindowInfo i;
    WindowInfo i;
    i.token = new BBinder();
    i.token = new BBinder();
    i.windowToken = new BBinder();
    i.id = 1;
    i.id = 1;
    i.name = "Foobar";
    i.name = "Foobar";
    i.flags = WindowInfo::Flag::SLIPPERY;
    i.flags = WindowInfo::Flag::SLIPPERY;
@@ -85,6 +86,7 @@ TEST(WindowInfo, Parcelling) {
    WindowInfo i2;
    WindowInfo i2;
    i2.readFromParcel(&p);
    i2.readFromParcel(&p);
    ASSERT_EQ(i.token, i2.token);
    ASSERT_EQ(i.token, i2.token);
    ASSERT_EQ(i.windowToken, i2.windowToken);
    ASSERT_EQ(i.id, i2.id);
    ASSERT_EQ(i.id, i2.id);
    ASSERT_EQ(i.name, i2.name);
    ASSERT_EQ(i.name, i2.name);
    ASSERT_EQ(i.flags, i2.flags);
    ASSERT_EQ(i.flags, i2.flags);