summaryrefslogtreecommitdiff
path: root/core/java/android/view/InsetsSourceControl.java
Commit message (Collapse)AuthorAgeFilesLines
* Let the client know the initial visibility of an InsetsSourceControlTiger Huang2022-07-251-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the client compares the requested visibility with the source visibility to decide if it needs to play the insets animation or not. However, the source visibility is not stable while the client is gaining the control. If the source and the control come from IWindow#insetsControlChanged, the source has the previous visibility. So the client can detect the visibility change. If the the source and the control come from IWindowSession#relayout, the visibility of the source has been overriden by the requested visibility of the client. So the client cannot detect the change and cannot play the animation. This CL lets the client know the initial visibility of the control. While gaining leash, the client can use the information to decide if it needs to play animation or not. Fix: 209064170 Fix: 238496738 Test: atest ImeInsetsSourceConsumerTest InsetsAnimationControlImplTest InsetsControllerTest InsetsSourceConsumerTest DisplayImeControllerTest Test: 1. Enable shell transitions 2. Open camera. 3. Perform back gesture. See if there is status bar animation. Change-Id: I2c02e97e191ebd83238c0c54908e861d200d4c8d
* Don't set animation pending when gaining fake controlTiger Huang2022-04-201-0/+2
| | | | | | | | | | | | | | | | There are 2 cases that an insets source control doesn't have a leash: 1. The server hasn't applied the transaction of the initialization of a leash yet. 2. The control is a fake control. It is dispatched when the insets source is shown transiently by the server and we don't want the client to change its layout. We should only defer the insets animation for case 1. This CL uses the insetsHint to tell if a control is fake or not. Fix: 227083463 Test: atest --iterations 10 OpenAppNonResizeableTest Change-Id: I45f75d8013f5723b782857101d070729cf082166
* Refine WindowInsets logsMing-Shin Lu2021-08-301-0/+9
| | | | | | | | | | | | | | | | | - Add WM_DEBUG_WINDOW_INSETS ProtoLogGroup to use for logging general Insets logs in WM core. - Refine InsetsSourceProvider#updateVisibility proto log format to add insets type information. - Add InsetsSurceControl#toString to print control target info. Bug: 197189357 Test: adb shell wm logging enable-text WM_DEBUG_WINDOW_INSETS Test: atest ProtoLogImplTest \ ProtoLogViewerConfigReaderTest \ WmTests:ProtoLogIntegrationTest \ LogDataTypeTest \ protologtool-tests Change-Id: I1f01ce4d9fe5cb17f7bd60a424689260682b1dfc
* Release leashes of insets controls if they are not neededTiger Huang2021-06-241-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, leashes would be only released by GC in some cases, but the timing could be late. This CL proactively release them as long as they are not needed. The cases were: 1. The leashes in DisplayImeController. It didn't release leashes while receiving a new one. 2. The leashes returned from addWindow/relayoutWindow. The leashes would be copied to prevent others from releasing them before writeToParcel. The copied leashes could be redundant after writeToParcel. 3. The leashes held by the client whose window is removed. If a window is removed, the server won't invoke mClient.insetsControlChanged, so the client would never get notified about losing control to release the leashes. This could happen if the window doesn't have an exiting animation. Fix: 175851610 Test: Steps in the bug. Test: Show and dismiss a dialog which doesn't have FLAG_ALT_FOCUSABLE_IM or any window animation. Repeat this thousands of times. And see if there are many insets leashes as offscreen layers in `dumpsys SurfaceFlinger` Change-Id: I5eb774ac071154a8d7205dbd1ab4a5f8eca215c3
* Stop processing if the new control equals the current oneTiger Huang2021-04-191-0/+28
| | | | | | | | | | | | | | | | InsetsSourceConsumer#setControl compares the identities between the new control and current one. If they are the same, the function stops processing. However, the instance of the control returned from relayout will always be different, which makes setControl process more than expected. This CL overrides InsetsSourceControl#equals, and use it to decide if we should do further processing in setControl. Bug: 185193241 Fix: 185460364 Test: steps in the bug Change-Id: If347df353202ef441b57dabccfd0ef254ec72477
* Let insets can still be controlled if its window bounds is movedTiger Huang2021-03-161-12/+35
| | | | | | | | | | | | | | | | | | | | | | | | Insets source window can be moved by the display area policy so that the window would not on the edge of the display. This makes the window cannot provide insets to the display frame. The default animation uses the display frame to compute insets, so the moved types cannot be animated properly. This CL adds an insets hint to InsetsSourceControl. It is the insets computed from its owning window bounds. With the insets hint, the insets animation can be played regardless of the display frame. This CL also fixes an issue that the insets animation would be played in the wrong direction by the fixed-rotation window. Bug: 175775686 Fix: 181939099 Fix: 163018915 Test: atest ImeInsetsSourceConsumerTest InsetsAnimationControlImplTest InsetsControllerTest InsetsSourceConsumerTest DisplayImeControllerTest WindowInsetsTests (manual) Change-Id: Ic6a8a215bd9b3a3b1af18e425dabe803c9be323e
* Optimize the Parcel read/write of common window dataRiddle Hsu2021-02-241-4/+4
| | | | | | | | | | | | | | | | 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
* Better IME transition while switching app with recents (3/N)Ming-Shin Lu2020-12-281-0/+22
| | | | | | | | | | | | | | | | | | | - Add hasImeWindowSurface in TaskSnapShot - Add InsetsSourceControl#getAndClearSkipAnimationOnce for skiping IME showing animation once when starting window with IME surface Bug: 166736352 Bug: 153145997 Test: manual as below steps 0) Enabling developer options -> Quick settings developer tiles -> Window animation scale to slow down transition animation. 1) Launch an app with focusing an editor to show soft-input 2) Swipe out app task to back to launcher 3) Using quick switch or taping shortcut to bring back the app task 4) Verify that should be no IME showing animation happens during task transition. Change-Id: I83ffc03119e01da71ad12f8ad8043cf0730dfd50
* Add proto-based InputMethodService and server side dumping for IMEAnmol Gupta2020-10-071-1/+7
| | | | | | | | | | | | | | This CL implements a mechanism to dump InputMethodService and IME related server states into a proto file which can later be imported to Winscope to allow easy debugging. The Design Doc for the IME tracing project is: go/ime-tracing Bug: 154348613 Test: start trace by calling "adb shell ime tracing start" end trace by calling "adb shell ime tracing stop" pull trace using "adb pull /data/misc/wmtrace/ime_trace.pb ime_trace.pb" Change-Id: Icbfb8c11e882f29eb45dea9d4c23315c48e9d619
* Add proto-based client side dumping for IME tracingAnmol Gupta2020-09-291-0/+22
| | | | | | | | | | | | | | | | This CL implements a mechanism to dump IME related client states into a proto file which can later be imported to winscope to allow easy debugging. A new abstract class ImeTracing.java declares the methods related to scheduling, collecting and dumping logs. Two child class implement these methods for server and client separately. The Design Doc for the IME tracing project is: go/ime-tracing Bug: 154348613 Test: start trace by calling "adb shell ime tracing start" end trace by calling "adb shell ime tracing stop" pull trace using "adb pull /data/misc/wmtrace/ime_trace.pb ime_trace.pb" Change-Id: Ia89f11d5ef8a220ea7746191b18769cea5a8359d
* Pass in callsite of SurfaceControl constructor explicitly (1/3)Jorim Jaggi2020-06-261-1/+1
| | | | | | | | | | | Creating a new Throwable (and filling in the stack trace) can take up to 150us. Since we do this on the critical path when sending over SurfaceControl via binder multiple times, this is too much. Instead, add an option to pass in callsite manually. Bug: 159056748 Change-Id: I46c339c15a07192d61c4c546e46f260684a47120 Exempt-From-Owner-Approval: Large scale refactor
* Add Insets dumps and IME debug logsTaran Singh2020-05-271-0/+9
| | | | | | | | | | | | Add more dumps and logs to better help debug IME insets better Logging can be enabled by setting InsetsController.DEBUG to true. Bug: 154348613 Test: manually build and flash. Verify showing and hiding IME shows logs. verify adb shell dumpsys window windows has new dumps Change-Id: Iad0a21d81a22d6acfaaf5c5ca8b5131eec411e79
* Re-apply local client state when leash changesJorim Jaggi2020-04-071-2/+1
| | | | | | | | | | | When leash changes, we need to re-apply our local state, to ensure new leash has same state as before and new leash is visible on screen. Test: Switch IME while open Test: SurfaceControlTest Fixes: 152876819 Change-Id: Ieae1aecdc3ddc427ccb89c4aa7ef7ae9283f39eb
* Use separate thread if app doesn't listen to animationsJorim Jaggi2020-03-111-2/+4
| | | | | | | | | | | There is no need to introduce jank risk and run the inset animations on the main thread if the app doesn't listen to animation events. In that case, move the animations onto a separate thread. Bug: 118118435 Test: Inspect systrace Change-Id: Ib6e4b4ce8e9dd8e27761ced6eb8d7700b6236a32
* InsetController: Release leashes from RenderThreadRob Carr2020-03-091-2/+2
| | | | | | | | | | | | | | | We handle changes to the leashes from the UI thread, but use the same SurfaceControl wrapper object from the RenderThread with SyncRtSurfaceTransactionApplier. This means that at the time we release a SurfaceControl from the UI thread we might have already scheduled a SyncRtSurfaceTransactionApplier to use it, and actually that could be in the process of running, leading to racy access and crashes. To fix this we release the SurfaceControl from the RenderThread so that it happens behind all existing operations. Bug: 151086678 Test: Existing tests pass. Change-Id: I2308d1c64f3f368c32587f99ddfb9e05955f821f
* InsetSourceConsumer: Ensure we release Leash when finished.Rob Carr2020-03-051-0/+6
| | | | | | | | | | SurfaceControl resources may be heavy weight, and so we explicitly release them when finished. Specifically, we need to fix this to keep the CloseGuard from complaining in strict-mode. Bug: 150805473 Test: Existing tests pass Change-Id: Ie3c609f79a953374a4d336465676cdc312679f93
* Window Manager Flag Migration (8/n)Tiger Huang2019-12-241-0/+11
| | | | | | | | | | | | | | | | Dispatch the copied insets states and controls if the client and the server are in the same process. Otherwise, changing them at the server side will affect ones at the client side, and vice versa. Bug: 118118435 Test: atest InsetsSourceProviderTest InsetsStateControllerTest InsetsPolicyTest WindowStateTests CommandQueueTest RegisterStatusBarResultTest InsetsFlagsTest LightBarControllerTest RegisterStatusBarResultTest ViewRootImplTest DisplayPolicyLayoutTests DisplayPolicyInsetsTests DisplayPolicyTests TaskSnapshotSurfaceTest NavigationBarColorTest Change-Id: Iabe9fb1f345f576f08b156f32aa9bd3989911149
* Window Manager Flag Migration (6/n)Tiger Huang2019-11-181-3/+3
| | | | | | | | | | | | | | | | | Refactor the insets APIs: - Remove top/side in the names of types - Add a type for the caption bar - Rename InsetSide to InternalInsetsSide which is a enumeration, so that we can have a public @InsetsSide which is a bit-wise variable - Fix the naming about insets: inset --> insets Bug: 118118435 Test: atest InsetsSourceProviderTest InsetsStateControllerTest InsetsPolicyTest WindowStateTests CommandQueueTest RegisterStatusBarResultTest InsetsFlagsTest LightBarControllerTest RegisterStatusBarResultTest Change-Id: I27a066299eea9927ce61f6cb5d489ad79bca42ba
* Window Manager Flag Migration (3/n)Jorim Jaggi2019-09-121-3/+10
| | | | | | | | | | | | | | | | | | | Adds fake control which is an InsetsSourceControl without a leash in it. Fake control will be sent to the client when bars are shown transiently. So the client thinks it still have the control over the bars, but moving the bars won't take effect. InsetsController.show still works and dispatches the modified state to the server. The server can then listen to that state change, and abort transient showing mode, start a new animation, and send over the new control with an actual leash to the client. Bug: 118118435 Test: atest InsetsSourceProviderTest InsetsStateControllerTest WindowStateTests Change-Id: I8db5942e9f951e2652d4a3a34c9fde2efe5b9858
* All Parcelable CREATOR fields are @NonNull.Jeff Sharkey2019-02-281-1/+1
| | | | | | | | | If they were null, then the Parcelable would fail to work. Bug: 126726802 Test: manual Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014 Exempt-From-Owner-Approval: Trivial API annotations
* Send IME control to clientTarandeep Singh2019-02-041-1/+18
| | | | | | | | | | | | | | Sends the IME control to the client by calling InsetsStateController.onImeTargetChanged. Furthermore, since the frame we use to calculate the insets isn't necessarily the surface frame, we also need to pass down the surface position such that the client can calculate the final leash position correctly. Test: Open IME Bug: 111084606 Change-Id: Ifed8351b12d47f698efde504205bd7b77032d36b
* A brave new world for window insets (2 and 3/n)Jorim Jaggi2018-12-031-0/+72
Implements basic API's to control windows generating insets in the new insets world. Test: CTS tests will be added at some point in the future Bug: 118118435 Change-Id: I722d2e58c68734ac131b12da3d9978e946292130