diff options
| author | 2024-05-30 20:44:33 +0000 | |
|---|---|---|
| committer | 2024-05-30 22:46:59 +0000 | |
| commit | 4c36345746c9f00a53e77a69a74901e12f96ffc9 (patch) | |
| tree | caaad0e68e4b35a455385fd2e98bf789887b1362 /libs | |
| parent | ae648c05cba85b9d6649c8bf4890b564c7a71677 (diff) | |
[Divider] Fix veil color
Read the activity window background color when showing the veils
(instead of when updating the divider properties) to ensure that
the veil colors are up to date.
Bug: 343523804
Test: atest SplitControllerTest DividerPresenterTest and manual
Change-Id: I2ad3869a9e3b82e85fb31fd1a80e2ba8831dca59
Diffstat (limited to 'libs')
2 files changed, 21 insertions, 17 deletions
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/DividerPresenter.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/DividerPresenter.java index 774b2129497d..23dc96c39bde 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/DividerPresenter.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/DividerPresenter.java @@ -245,11 +245,9 @@ class DividerPresenter implements View.OnTouchListener { isReversedLayout, parentInfo.getDisplayId(), isDraggableExpandType, - getContainerBackgroundColor( - primaryContainer, DEFAULT_PRIMARY_VEIL_COLOR), - getContainerBackgroundColor( - secondaryContainer, DEFAULT_SECONDARY_VEIL_COLOR) - )); + primaryContainer, + secondaryContainer) + ); } } @@ -965,8 +963,10 @@ class DividerPresenter implements View.OnTouchListener { private final int mDisplayId; private final boolean mIsReversedLayout; private final boolean mIsDraggableExpandType; - private final Color mPrimaryVeilColor; - private final Color mSecondaryVeilColor; + @NonNull + private final TaskFragmentContainer mPrimaryContainer; + @NonNull + private final TaskFragmentContainer mSecondaryContainer; private final int mDividerWidthPx; @VisibleForTesting @@ -979,8 +979,8 @@ class DividerPresenter implements View.OnTouchListener { boolean isReversedLayout, int displayId, boolean isDraggableExpandType, - @NonNull Color primaryVeilColor, - @NonNull Color secondaryVeilColor) { + @NonNull TaskFragmentContainer primaryContainer, + @NonNull TaskFragmentContainer secondaryContainer) { mConfiguration = configuration; mDividerAttributes = dividerAttributes; mDecorSurface = decorSurface; @@ -989,8 +989,8 @@ class DividerPresenter implements View.OnTouchListener { mIsReversedLayout = isReversedLayout; mDisplayId = displayId; mIsDraggableExpandType = isDraggableExpandType; - mPrimaryVeilColor = primaryVeilColor; - mSecondaryVeilColor = secondaryVeilColor; + mPrimaryContainer = primaryContainer; + mSecondaryContainer = secondaryContainer; mDividerWidthPx = getDividerWidthPx(dividerAttributes); } @@ -1014,8 +1014,8 @@ class DividerPresenter implements View.OnTouchListener { && a.mDisplayId == b.mDisplayId && a.mIsReversedLayout == b.mIsReversedLayout && a.mIsDraggableExpandType == b.mIsDraggableExpandType - && a.mPrimaryVeilColor.equals(b.mPrimaryVeilColor) - && a.mSecondaryVeilColor.equals(b.mSecondaryVeilColor); + && a.mPrimaryContainer == b.mPrimaryContainer + && a.mSecondaryContainer == b.mSecondaryContainer; } private static boolean areSameSurfaces( @@ -1328,8 +1328,12 @@ class DividerPresenter implements View.OnTouchListener { } private void showVeils(@NonNull SurfaceControl.Transaction t) { - t.setColor(mPrimaryVeil, colorToFloatArray(mProperties.mPrimaryVeilColor)) - .setColor(mSecondaryVeil, colorToFloatArray(mProperties.mSecondaryVeilColor)) + final Color primaryVeilColor = getContainerBackgroundColor( + mProperties.mPrimaryContainer, DEFAULT_PRIMARY_VEIL_COLOR); + final Color secondaryVeilColor = getContainerBackgroundColor( + mProperties.mSecondaryContainer, DEFAULT_SECONDARY_VEIL_COLOR); + t.setColor(mPrimaryVeil, colorToFloatArray(primaryVeilColor)) + .setColor(mSecondaryVeil, colorToFloatArray(secondaryVeilColor)) .setLayer(mDividerSurface, DIVIDER_LAYER) .setLayer(mPrimaryVeil, VEIL_LAYER) .setLayer(mSecondaryVeil, VEIL_LAYER) diff --git a/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/DividerPresenterTest.java b/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/DividerPresenterTest.java index 4515187f231e..3f676079f080 100644 --- a/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/DividerPresenterTest.java +++ b/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/DividerPresenterTest.java @@ -166,8 +166,8 @@ public class DividerPresenterTest { false /* isReversedLayout */, Display.DEFAULT_DISPLAY, false /* isDraggableExpandType */, - Color.valueOf(Color.BLACK), /* primaryVeilColor */ - Color.valueOf(Color.GRAY) /* secondaryVeilColor */ + mockPrimaryContainer, + mockSecondaryContainer ); mDividerPresenter = new DividerPresenter( |