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

Commit a7f66443 authored by Jorge Gil's avatar Jorge Gil
Browse files

Fix WindowDecorationInsets equals() comparison

Equivalent WindowDecorationInsets data classes were not resulting in
equals() calls returning true for three reasons:
1) Migrating the class from Java to a Kotlin data class without
   implementing a custom equals did not WAI because the |boundingRects|
   field was an Array<Rect> which can't be compared with a plain equals.
   To fix this, the field is changed to a List<Rect>
2) With the introduction of relative insets, the |frame| provided to
   WindowDecorationInsets is not fully needed to update insets - only
   its height which means having |frame| in the data class will force
   fail an equals() for different frame rects that actually have the
   same height, so to be more efficient this change makes the primary
   constructor use height so that equals() is based on just the height
   and adds a secondary constructor with the |frame| Rect to keep
   callsites unchanged.
3) The |excludedFromAppBounds| and |taskBounds| are used together to set
   the app bounds exclusing captions. This is only needed when
   |excludedFromAppBounds| is true, but having |taskBounds| in the
   primary ctor even when false means that equals() fails because
   taskBounds can change even if they won't be used. To fix this a
   nullable AppBoundsExclusion data class encapsulates the two distinct
   states.

Flag: com.android.window.flags.enable_window_decoration_refactor
Bug: 409648813
Test: relayout same decoration twice, see only 1 inset update
Test: move task to another location (so frame changes but height
doesn't), see no additional updates
Test: atest WindowDecorationInsetsTest WindowDecorationTests

Change-Id: I5766e919ee57fef15e42e5eb514bb8d46f4474f1
parent 6f585e15
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment