Skip to content
Commit 871e2235 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Revert^2 "Refresh layout parameter for bounds change from relayout"

The relayout method also assumes the client can get the latest
configuration. So if the client only relies on IWindow#resized
to compute its layout parameter, there may be a race that
resized gets config 1, and then even if relayout gets config 2,
the window still uses old layout parameter.

So this change simulates similar behavior as ViewRootImpl did:
check the config changes both from resized and relayout.

Also optimize a case if resized is called many times in a short
time from server side, or the ui thread is not able to consume
the events in time, then only the last event will be handled.
So several relayout invocations for outdated intermediate states
can be reduced.

This reverts commit cc067ed3.
The unit test ImageWallpaperTest was failed because it
uses a mocked Context which didn't provide getResources().
Fix it by moving the config initialization from constructor
to attach(), so unit test won't hit it.

Bug: 264829202
Test: atest ImageWallpaperTest
Test: Hardcoded to return a wrong bound from IWindow#resized
      to wallpaper, wallpaper can still show correct size.

Change-Id: I0b4a480c6e85133f2d0d30042603009cc94db9c0
parent cc067ed3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment