summaryrefslogtreecommitdiff
path: root/core/java/android/window/ClientWindowFrames.java
Commit message (Collapse)AuthorAgeFilesLines
* Refine the naming about compatible scaleTiger2022-12-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | | There can be 2 reasons that we need to apply compatible scale to a window: 1. The app doesn't support large screen. We would layout the window as if it is on a small display. And then we need to scale its window up to match the display. 2. We put a running app into a container that the size doesn't fit. We need to down-scale the app so that it can fit the container. The scaling of case 2 is also known as size-compat-scale which is fully controlled at the server side. The client shouldn't know about it. And this CL refines the naming. Fix: 258393096 Bug: 254187021 Test: presubmit Change-Id: Ifbd2ca725bed231d9e6dd8190df3dc773d4402b7 (cherry picked from commit bcbd60c45c047c625bd66d7cc018b0c65f02d3fd) Merged-In: Ifbd2ca725bed231d9e6dd8190df3dc773d4402b7
* Send size-compat scale to the clientTiger Huang2022-07-271-1/+7
| | | | | | | | | | | | | | | | | | | | | | | The client computes the window frame on its own in ViewRootImpl#setView. However, the bounds obtained from WindowConfiguration is not size- compatible, which makes legacy apps produce wrong frames. The frame is larger than expected, so when computing WindowInsets with size- compatible InsetsState, the window cannot receive insets. Although the client will receive the correct window frame from relayout, but the first WindowInsets has been dispatched before that. This CL sends the size-compat scale to the client, so the client can use the correct WindowConfiguration to compute frames. This is also a step to enable the client to perform local window layout. Bug: 237749017 Bug: 161810301 Bug: 175861127 Test: atest StartingSurfaceDrawerTests WindowAddRemovePerfTest ActivityRecordTests WindowManagerServiceTests Change-Id: I6b23901f4b1f009444c04da7e078ea971a386ad7
* Send the attached frame to the clientTiger Huang2022-06-201-0/+13
| | | | | | | | | | | | | | | | | | | | The attached frame is the frame of the parent window that its child attaches to, as long as the child is not TYPE_APPLICATION_ATTACHED_DIALOG. It is a factor while computing the window frame. Previously, we let the child obtain the attached frame from its parent view root. However, if the parent and the child are not in the same process, it can be tricky. This CL sends the attached frame from the server to the client via ClientWindowFrames. In this way, the child can compute its window frame without having to accessing the parent view root. Bug: 161810301 Bug: 175861127 Test: atest ActivityRecordTests WindowLayoutTests Change-Id: Ia844a4c927027e305a56114216eaee2bf7933b1f
* Let the client compute the backdrop frame on its ownTiger Huang2022-03-201-7/+0
| | | | | | | | | | | | | | | | | | | Since the new split-screen doesn't need the fullscreen backdrop frame. The backdrop frame will always be the window frame. The server doesn't need to send the backdrop frame to the client. The client just needs to offset the backdrop frame to (0, 0). This CL also moves the logic of calling onWindowSizeIsChanging to the handler thread because it reads some fields which should only be accessed on the handler thread. Otherwise, there might be race conditions. Bug: 161810301 Test: 1. Perform drag-resize and drag-move on a freeform app, and see if the layout is expected. 2. Move the divider in the split-screen mode, and see if there is any abnormal. Change-Id: Ie0058db0447260dd0561634179fc7721d965a9e2
* Use ClientWindowFrames to collect frames computed by WindowLayoutTiger Huang2022-03-141-13/+23
| | | | | | | | | | | | | This is a step to move the window layout to the client side. ClientWindowFrames is used to carry window frames dispatched from the server to the client for now. Later, the window frames will be computed at the client side, and the frames will be sent to the server side via ClientWindowFrames. Bug: 161810301 Test: presubmit (no behavior change but only code refactors) Change-Id: I83d8cfff2432e09759ef5b3d5f3b21731fc71bff
* Optimize the Parcel read/write of common window dataRiddle Hsu2021-02-241-3/+3
| | | | | | | | | | | | | | | | The Parcel read/write speed of MergedConfiguration/InsetsSource becomes 4x+ faster. Because writeParcelable sends additional type info which is unnecessary if the type is known on the reading side, replace the usages to writeTypedObject and well-written readFromParcel. That saves the time of class lookup and object creation. Bug: 181025587 Test: vogar --mode app_process --benchmark \ frameworks/base/core/tests/benchmarks/src/android/os/ParcelableBenchmark.java Change-Id: I29548ce6c2e5886f0e90a5dc70d8e9ecc0fb25a8
* Send display cutout to client via insetsChangedTiger Huang2021-01-051-11/+1
| | | | | | | | | | | | | | | | | | | | | Since the display cutout is a type of insets and the display cutout can be obtained from WindowInsets, it makes sense that InsetsState has the display cutout instance. In this way, we can send the display cutout to client via W#insetsChanged instead of W#resized. This can be a step to remove the class of ClientWindowFrames, and can also be a step to make client compute its window frame locally. Fix: 175858810 Bug: 161810301 Test: atest WindowAddRemovePerfTest ImeInsetsSourceConsumerTest InsetsControllerTest InsetsStateTest ViewRootImplTest WindowInsetsControllerTests ActivityRecordTests DisplayPolicyLayoutTests LaunchParamsControllerTests TaskSnapshotSurfaceTest WindowMetricsActivityTests WindowMetricsWindowContextTests WindowMetricsTest WindowFrameTests WindowStateTests WmDisplayCutoutTest Change-Id: I9a930b1d2f7df3cea2b29629b767a4a5f31bca17
* Don't dispatch legacy insets to clientTiger Huang2020-10-211-20/+0
| | | | | | | | | | | | | | | | The server won't dispatch the legacy content insets, stable insets, and visible insets to the client. The insets would be computed from the insets state by the client. This CL also fixes the insets scaling issue in compatible mode. Bug: 149813814 Fix: 169940916 Fix: 165412978 Test: atest WindowAddRemovePerfTest InsetsAnimationControlImplTest ActivityRecordTests DisplayPolicyLayoutTests InsetsPolicyTest InsetsStateControllerTest Change-Id: I83570973f587a6abf887752494f750b46e3e484d
* Remove Session#getDisplayFrameRiddle Hsu2020-09-101-0/+125
The frame won't be changed if there is no IWindow#resized or IWindowSession#relayout. So it can be retrieved from these methods directly instead of another binder transaction. And because some parameters are usually used together for layout, the parameters are consolidated into a new ClientWindowFrames. That reduces changing the interface in the future if the frame related information needs to be changed. Also refine the resize handling in ViewRootImpl to make it easier to read. There should be no behavior change by this modification. Bug: 161781274 Test: WmTests, DialogFrameTests Change-Id: I9f711ad2023442046fa8582944320b98e7c4ecfa