summaryrefslogtreecommitdiff
path: root/core/java/android/view/InsetsSource.java
Commit message (Collapse)AuthorAgeFilesLines
* Fixing input coordinates discrepancyMaryam2022-09-151-1/+2
| | | | | | | | | | Their was a input coordinate discrepancy for dialogs when we use the wm caption in the shell. Test: tested manually on multiple builds Bug: 244190356 Bug: 243950192 Change-Id: I84cf95a933e90062f20978e4e1f83276c100c326
* Fixed cts failure of WindowInsetsControllerTestsshawnlin2022-04-281-0/+17
| | | | | | | | | | | | | | If the device is a tablet, the navigation bar will be taskbar, and it will draw fake rounded corners above itself when it's shown and unstashed. When apps request to hide taskbar from such state, it will cause an extra window insets change from server side. Move the calculation of rounded corner inset to client side so that we can make the window insets change come only once. Bug: 229825307 Test: atest WindowInsetsControllerTests ActivityRecordTests Change-Id: I081142facbe0fe676b89c8883fa690ba5ae13d79
* Optimize the Parcel read/write of common window dataRiddle Hsu2021-02-241-11/+2
| | | | | | | | | | | | | | | | 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
* Fix non-zero window insetChris Li2021-02-171-1/+5
| | | | | | | | | | | | | We support 0-width/height window to get shared edge with inset for b/150696052, but we should limit that to only 0-width/height window. This will fix the issue that in a dual-display device, when the ime is only shown on one display, the app on the other display shouldn't get the inset. Bug: 175779509 Test: atest InsetsSourceTest Change-Id: I3c73278a082b084e36be8241c20fa89fb00e405a
* Remove beginLayoutLw and redundant logic about layoutTiger Huang2021-01-221-0/+8
| | | | | | | | | | | | | | | | | This CL makes every window always ready to layout. DisplayFrames and InsetsState will be always up-to-date so that we don't need to update them in beginLayoutLw anymore. This CL also removes PRIVATE_FLAG_PRESERVE_GEOMETRY which is not used by anyone. This can be a step to make the client compute its window frame locally. Bug: 161810301 Test: atest DisplayPolicyLayoutTests DisplayPolicyTests LaunchParamsControllerTests SizeCompatTests TaskLaunchParamsModifierTests WallpaperControllerTests Change-Id: I43a3713246ae67fc4da40eae9bbd6d3c8e26cbb9
* Add @Nullable annotation to the parameter of Object.equals() methods.Roman Kalukiewicz2020-10-151-2/+2
| | | | | | | | | | | | | | | | | | Those annotations could be inferred by some tools (like Kotlin), but the https://checkerframework.org/ doesn't check inherited annotations complaining about all equals() invocations that get nullable argument. The change was generated by running find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /' in the frameworks/base directory and by automatically adding and formatting required imports if needed. No manual edits. Bug: 170883422 Test: Annotation change only. Should have not impact. Exempt-From-Owner-Approval: Mechanical change not specific to any component. Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
* 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/+16
| | | | | | | | | | | | | | | | 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
* Disable user animations on insets whose visible frame is empty (refined)Tiger Huang2020-06-231-0/+5
| | | | | | | | | | | Floating IME or fullscreen IME won't cause insets (except the area overlapped with navigation bar). It doesn't make much sense to let apps move the IME at these cases. Fix: 157777145 Test: atest InsetsSourceConsumerTest GlobalActionsImeTest ImeInsetsControllerTest Change-Id: Id70f59be7653beedc02d6c8bc3b1bd50a357f4fe
* Merge "Revert "Disable user animations on insets whose visible frame is ↵TreeHugger Robot2020-06-161-4/+0
|\ | | | | | | empty"" into rvc-dev
| * Revert "Disable user animations on insets whose visible frame is empty"Yohei Yukawa2020-06-161-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0b9450bab933007af1c9ceb28bb90ef31cabd198. Reason for revert: Broke ImeInsetsControllerTest#testChangeSizeWhileControlling Bug: 157777145 Fix: 159154994 Test: atest CtsInputMethodTestCases Test: atest InsetsSourceConsumerTest Change-Id: I6c47ec5f8498a3566c543d4d1d6ef62e325ccd8e
* | Merge "Disable user animations on insets whose visible frame is empty" into ↵Tiger Huang2020-06-161-0/+4
|\| | | | | | | rvc-dev
| * Disable user animations on insets whose visible frame is emptyTiger Huang2020-06-141-0/+4
| | | | | | | | | | | | | | | | | | | | Floating IME or fullscreen IME won't cause insets (except the area overlapped with navigation bar). It doesn't make much sense to let apps move the IME at these cases. Fix: 157777145 Test: atest InsetsSourceConsumerTest Change-Id: Ibdf5454843c880d7e726a66a8f1107ca511e5025
* | Exclude non-observable insets changeJorim Jaggi2020-06-101-0/+9
|/ | | | | | | | | | | | | | When we notify insets changed, legacy behavior forces us to force a new measure on the entire hierarchy. However, this can cause jank in various scenarios. Make sure that we don't report an insets change if non-observable state changes. Test: InsetsStateTest Test: Swipe up to home while IME open Bug: 157123435 Change-Id: I9c51066c6489888720b307240d03054cc18c4172
* Merge "Report caption insets change when layout" into rvc-devYunfan Chen2020-04-301-3/+3
|\
| * Report caption insets change when layoutYunfan Chen2020-04-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch let DecorCaptionView report back to it's owner about height change, instead of let the DecorView query the height. The previous query points enableCaption() and updateDecorCaptionStatus() cannot ensure the caption layout is finished and attached to the phone window. Such that it may return a zero caption insets when it shouldn't be, if the app do window configuration change handling by restarting. The layout will ensure the caption insets get set when everything is ready. There will be no caption height change when resizing or moving, make sure the calculated insets always include the caption regardless of the frame position. Bug: 154792488 Test: Manuel test with message and settings app. Test: go/wm-smoke Test: atest InsetsControllerTest#testCaptionInsetsStateAssemble Test: atest InsetsSourceTest#testCalculateInsets_caption_resizing Change-Id: I1728628eccb32b912210a64fe3a1c9cbe9e3b302
* | Merge "Update more Parcelables to send Strings UTF-8." into rvc-devJeff Sharkey2020-04-291-4/+22
|\ \
| * | Update more Parcelables to send Strings UTF-8.Jeff Sharkey2020-04-291-4/+22
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | An earlier CL with benchmarks has shown that sending strings as UTF-8 is 50% faster for US-ASCII strings, and still 68% faster for complex strings referencing higher Unicode planes. (So an improvement in both cases!) Since code across the OS still makes heavy assumptions about Parcel strings typically being UTF-16, we need to carefully migrate Parcelables by hand, which is what this CLs begins doing. Bug: 154436100 Test: manual Change-Id: I9a675473e0ce3a4a5c5e305dd851b40bb1560e1c
* / Shift Primary stack as well as secondary during ime adjustmentEvan Rosky2020-04-281-4/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, was only 'adjusting' the secondary split for ime. So the secondary had functional insets and drag/drop. However, the primary wasn't being adjusted (accorcding to WM). This caused its insets to be calculated against its originla position (which allowed ime insets to potentially overlap it) and it meant that WM didn't use its visual position when calculating drag/drop coordinates. So, this does the same with the primary stack as what was done with secondary. However, doing this required some other fixes in WM. Basically, if appbounds is explicitly overridden, just use them instead of intersecting with parent. Also, WSA doesn't apply crop for splits (maybe it shouldn't apply crop to anything anymore). Additionally, insets calculation was applying top insets to the bottom if the inset frame's top wasn't exactly equal to the window's top -- because of a catch-all else condition. So this adds checks for matching the bottoms as well. Bug: 154056542 Bug: 151862790 Test: Open two apps in split screen and open IME in secondary. Drag from secondary to primary. Change-Id: I2391783e726e4a1c8ed3150628af2f398218fe90
* Make caption a insets sourceYunfan Chen2020-03-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | | This patch introduced setCaptionInsets, and set the Insets in ViewRootImpl when dispatch the insets if there's a caption. Modification is made in Window and DecorCaptionView to make caption overlay with the app content, and pass the value to ViewRootImpl to apply when dispatch. It is necessary to trigger a dispatch when caption enabled status chanaged, otherwise sometimes it will not be updated. Because caption is now updated locally on the client side. Some old logic to deal with the overlay caption without insets are removed, including the touch event dispatch override, the color override. Bug: 134531136 Test: go/wm-smoke Test: Manually change the value in dispatchApplyInsets, can observe a blank content area when there's a caption bar. Test: atest InsetsStateTest Test: atest InsetsControllerTest Change-Id: I356344a13c8569512d8f51f7ea19a5603f778252
* Let insets sources can produce insets on 0-width or 0-height windowsTiger Huang2020-03-131-2/+24
| | | | | | | | | | | Window Manager allows the client to add 0-width or 0-height windows. These windows can get insets in the legacy insets mode even they only intersect with the insets source window on the edges. This CL make this behavior compatible with the legacy insets mode. Fix: 150696052 Test: atest InsetsSourceTest Change-Id: I9ed76bb615a0133ad55e1f93b22fbc03ae5cb437
* Make display cutout can produce insetsTiger Huang2020-03-021-0/+4
| | | | | | | | | | | | | | This CL creates InsetsType and InternalInsetsType for display cutout. With this CL, WindowInsets.getSystemWindowInsets() can be compatible with the legacy insets mode. Fix: 149932355 Test: Open an app which has LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS and hides navigation bar on the display which has double display cutout. And check if the app can get the correct result from WindowInsets.getSystemWindowInsets(). Change-Id: I381a083d8c30e1678c835eaf5341e941139aa0d7
* Refine logic about controlling transient barsTiger Huang2020-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | - Use copied InsetsSourceControl to prevent the leash from being released while the control gets revoked while playing transient bar animations. - Start the animation after mAnimationControl gets assigned to prevent NullPointerException. - Let SystemUI to change the bar mode to transient mode before WM plays the transient bar animation. - Remove a redundunt call to the super method. - Fix InsetsPolicyTest - Fix InsetsStateControllerTest - Fix misc things Bug: 118118435 Test: Manually swipe to show transient bars many times. Test: atest InsetsSourceProviderTest InsetsStateControllerTest InsetsPolicyTest WindowStateTests CommandQueueTest RegisterStatusBarResultTest InsetsFlagsTest LightBarControllerTest RegisterStatusBarResultTest ViewRootImplTest DisplayPolicyInsetsTests DisplayPolicyTests TaskSnapshotSurfaceTest InsetsAnimationControlImplTest Change-Id: I7d445b7dc6f47a64048937cd439bdd5ffa7fa3a3
* Merge "Implement Transient Insets Animation"TreeHugger Robot2020-02-031-0/+9
|\
| * Implement Transient Insets AnimationYunfan Chen2020-02-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the transient insets animation. To have InsetsPolicy run the animation, this patch: 1. Let InsetsPolicy implements InsetsAnimationControlCallbacks; 2. Make several properties, methods and subclasses in InsetsController public, to let InsetsPolicy re-use them when possible. 3. Do everything necessary in InsetsPolicy to let the animation run correctly. Other misc changes in this CL includes: 1. Removed some un-necessary imports; 2. Implemented two toString method, for debug purpose. Bug: 118118435 Test: Manual test with the new Insets API test app, everything works as expected; Test: go/wm-smoke Test: atest InsetsPolicyTest Change-Id: I6c45bd557573fcabb1a3f5aea3dcd58229280613
* | Add missing visible frame copyJorim Jaggi2020-01-311-0/+4
| | | | | | | | | | | | | | | | | | Test: Inspect systrace, ensure not a constant ping-pong between apps and server Test: InsetsStateTest Bug: 118118435 Change-Id: I35937971897cf76ad9187c7c23a7abf394d59e46
* | IME always provides bottom insets, if anyJorim Jaggi2020-01-291-0/+8
|/ | | | | | | | | | | | This fixes an issue where IME wasn't visible in landscape with a cutout, because IME window didn't cover full edge. Also fix an issue where floating IME didn't work because alpha was calculated the wrong way. Test: InsetsSourceTest Bug: 111084606 Change-Id: I29b7a45cd590a52ecb03f2e539edde57aef4dba3
* Move visible insets calculation to clientJorim Jaggi2020-01-101-1/+30
| | | | | | | | | As otherwise they may be out of sync, leading to shifting when the IME disappears. Bug: 111084606 Test: InsetsSourceTest, InsetsStateTest, InsetsSourceProviderTest Change-Id: Ifd7dfa6694efccf8693fd46bec1a9dea879790ff
* Fix issue with letterboxingJorim Jaggi2020-01-061-0/+1
| | | | | | | | | | | | | | | | | | | | | - Only consider client state if new API is actually turned on. - We only sent the state the client was actually controlling. However, we then later check for visibility for state that may not even exist. Thus, we keep the state but only update the sources the client is actually controlling. - Initialize source with default visibility. This prevents issues where the source may not exist but we still check it. This fixes issues where a letterbox was accidentally placed on screen because WM was thinking client requested fullscreen flag (hiding the status bar), and other places where we checked requested visibility. Also renamed client state to requested state. Test: Open any app, open IME Bug: 111084606 Change-Id: Ibead561fc5593d8944400320f5e31dbe262612fe
* Window Manager Flag Migration (6/n)Tiger Huang2019-11-181-4/+4
| | | | | | | | | | | | | | | | | 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
* 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
* A brave new world for window insets (6/n)Jorim Jaggi2018-12-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Mirror state back to server In case the client does some local visibility modification to the leash, the server needs to be informed for a couple of reasons: - Dispatching state to other apps - Updating accessibility services - Updating SystemUI/IME system For that we send the state back whenever we modified it and send it via IWindowSession.insetsModified. The server ensures that visibility state is only updated if we have a match for the controlling app, and then updates the visibility state and dispatches it to other apps. We also invert mHidden to mVisible in InsetsSourceConsumer as it was really really confusing. Bug: 118118435 Change-Id: I92f187bf892a5f26b8b007ed7e6fbf4d2c7b13e6
* A brave new world for window insets (5/n)Jorim Jaggi2018-12-211-1/+2
| | | | | | | | | | | | Implement controlWindowInsetsAnimation Based on the leashes we have on the client, and the insets the client has requested, we are able to move the surfaces around such that the resulting insets will match what the client requested. Bug: 118118435 Change-Id: I0616e53455a6544aaf374c1b0eb10e258aced21d
* A brave new world for window insets (1/n)Jorim Jaggi2018-11-291-0/+159
This CL starts a journey to discover a brave new inset world. The path to get us there may be rocky, but it's going to be rocky. One of the main pledges of the new API is that an app can retrieve what is causing a certain inset easily. For that, we need to dispatch metadata who is causing what inset, such that we can query it from the client side. Furthermore, the client will be able to manipulate insets directly, but also listen to animation changes. We don't want to go through window manager for that, thus, there needs to be a local codepath from (global window state -> WindowInsets). Because we have these two requirements, we dispatch the relevant global window state for insets, represented by InsetsState, and dispatch it to the client. On the client side we take the frame and the InsetsState and generate WindowInsets out of it. Bug: 118118435 Test: InsetsSourceTest, InsetsStateTest, InsetsSourceProviderTest, InsetsStateControllerTest Change-Id: I2bfe9dda376512916261823fc2ee35cbedeb6731