summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewGroup.java
Commit message (Collapse)AuthorAgeFilesLines
* view: add null check for dispatch touch viewjianzhou2022-11-021-1/+1
| | | | | | | | during monkey test, sometimes in low memory status, the view will be null when dispatching the touch event. Add null check to avoid this crash. Change-Id: I5b04cfbc6b1c5c46a1da7d1133d8a7e1b9af556f
* Add View.findOnBackInvokedDispatcherVadim Caen2022-04-011-0/+22
| | | | | | | | | | To make it easier for developer to migrate away from KEYCODE_BACK without having to walk up the view hierachy in order to find an OnBackDispatcher, introduce findOnBackInvokedDispatcher. Bug: 227301455 Test: android.view.cts.OnBackInvokedDispatcherTest#testGetDispatcherOnView Change-Id: I7f3e76df596d306fa26d72df8115d5b15d7ac564
* Fix drawing translationZ to software canvasJohn Reck2021-10-131-1/+1
| | | | | | Bug: 200578756 Test: DrawingOrderTest#testTranslationZOrder Change-Id: Ie53a8ab3bcaedfb47f1e109556bf3a649e8a48f4
* Fix typo by removing extra "the"Pankaj Singh2021-09-061-1/+1
| | | | | | BUG: 198740909 Test: N/A Change-Id: I160a435693d61dc18da10725bf416b9af6d291e7
* Merge "Fix IndexOutOfBoundsException when calling ↵Ahaan Ugale2021-05-141-1/+3
|\ | | | | | | | | | | | | | | dispatchProvideStructure()" into sc-dev am: 9e22972568 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14442225 Change-Id: Ib5fb32c868130ecddb6b4e69673ac6cb0ffe8017
| * Merge "Fix IndexOutOfBoundsException when calling ↵Ahaan Ugale2021-05-141-1/+3
| |\ | | | | | | | | | dispatchProvideStructure()" into sc-dev
| | * Fix IndexOutOfBoundsException when calling dispatchProvideStructure()Joanne Chung2021-05-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dispatchProvideStructure() will get preorderedList by buildOrderedChildList(). buildOrderedChildList() returns mPreSortedChildren directly. During the traversal, the mPreSortedChildren is changed by the View#populateAccessibilityNodeInfoDrawingOrderInParent(). When one of child traversal is done, the preorderedList is already changed, the IndexOutOfBoundsException will occurr when trying to travese the next child. To fix it, try to make a copy not directly refer to mPreSortedChildren. Bug: 185971133 Test: manual. App doesn't crash Test: atest CtsAutoFillServiceTestCases Change-Id: Ie077948dd45426c1204d153ca0a921c7c67351d8
* | | Merge "API feedback: Translation View API improvement." into sc-dev am: ↵Joanne Chung2021-05-121-4/+6
|\| | | | | | | | | | | | | | | | | | | | | | | f13de286ff Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14326990 Change-Id: I00d85356561bd5ff09f007e1a4bd038e72f88996
| * | API feedback: Translation View API improvement.Joanne Chung2021-05-101-4/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 1. Rename dispatchRequestTranslation(). 2. Provide what should be done in onViewTranslationResponse(). Bug: 186578468 Bug: 186578311 Test: atest CtsTranslationTestCases Test: manual. CTS-Coverage-Bug: 177960696 Change-Id: Id90e7d68a92ec17ec302d7ff05ef67c8bfa6454b
* | Merge "Account for padding in dispatchScrollCaptureSearch" into sc-dev am: ↵Mark Renouf2021-04-201-13/+8
|\| | | | | | | | | | | | | | | 4b45c3601b Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14163125 Change-Id: Ice4e1812769127f1d7f100a9b7d1acabd73a38eb
| * Merge "Account for padding in dispatchScrollCaptureSearch" into sc-devMark Renouf2021-04-201-13/+8
| |\
| | * Account for padding in dispatchScrollCaptureSearchMark Renouf2021-04-161-13/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dispatching to self, ViewGroup is not applying padding to localVisibleRect, only when dispatching to child views. Also when deducting padding from the visible bounds, it must be intersected with bounds, not subtracted. Test: atest ViewGroupScrollCaptureTest Bug: 185153400 Change-Id: Ib92e4c552fbe02fd863123f166878e19b8b1c952
* | | Merge "Fix UiTranslation for ListView." into sc-dev am: 44dccdbe1aAhaan Ugale2021-04-131-0/+11
|\| | | | | | | | | | | | | | | | | Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14064892 Change-Id: I8634683d1373e25cd8dd5dce52430a9649d3a1b1
| * | Fix UiTranslation for ListView.Ahaan Ugale2021-04-021-0/+11
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are 2 changes: * When a view is scrapped, Autofill IDs in its subtree are reset. This prevents flaky behavior like translating the wrong views when events are ordered a certain way. * Views that are being translated are marked as having transient state since the system needs to attach the response to it later as well as deliver UI Translation state changes to it. Bug: 182491706 Test: atest CtsTranslationTestCases Test: atest CtsContentCaptureServiceTestCases Test: atest CtsAutoFillServiceTestCases Test: manual - check in logs that autofill ids aren't reused on scrolling or new views appearing Test: manual - translated views stay translated while on the screen when other views are scrolled off the screen Test: manual - translated views stay translated when new views appear Change-Id: I20a52415e3fd191768442d70614d536e11633dfa
* / Fix index corner bug to search the target nodeSaho Kobayashi2021-04-061-1/+1
|/ | | | | | | | | | | | | | | | | | In dispatchTouchEvent(), the target node is searched by the for loop. When the TargetAccessibilityFocus flag is set, dispatchTouchEvent prioritizes finding the accessibility focused node first. When the accessibility focused node doesn't handle the event, the second search is done without the TargetAccessibilityFocus flag. To prepare for the second search, the index is reset when the accessibility focused node is found. Currently the index is reset to childrenCount - 1, which is the same as the initial index of the for loop, but to search the same range as the first search, we need to reset it to childrenCount, because the actual second search starts from the next loop. Bug: 182434603 Test: atest TouchExplorerTest Change-Id: Ifc88f7df43bd26e978b24a0d94cfb1ce60c6cb3b
* Merge "Correctly handle TargetAccessibilityFocus flag" into sc-devSaho Kobayashi2021-04-011-17/+14
|\
| * Correctly handle TargetAccessibilityFocus flagsahok2021-03-181-17/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In current implementation of GroupView, TargetAccessibilityFocus flag is not reflected while searching the node to dispatch the touch event. History: The logic to search the accessibility focused node was removed in CL [1]. CL [1] was reverted in [2], but the logic is not correctly restored. [1] I84bba65ac16e27e9c564b23a0c27d48245eef447 [2] I427b98c71ce8a2ac5b9285b2f34c1864f48c4a32 Bug: 159168795, 182434603 Test: atest TouchExplorerTest Change-Id: I911547dd506511dd830c8b051af3264523b75df2
* | Implement dispatchRequestTranslation for getting translation information.Joanne Chung2021-03-251-0/+25
|/ | | | | | | | | | | | This change doesn't contain the virtual view part and the API, it will be done in the next change. Bug: 178046780 Test: manual Test: atest CtsTranslationTestCases CTS-Coverage-Bug: 177960696 Change-Id: Idba66a882a90168ecdd93423c0d5d054ab040dad
* Long screenshots framework update and API unhideMark Renouf2021-02-251-73/+54
| | | | | | | | | | | | | | This change includes a series of API review changes. The most significant update is the addition of cancellation signals to API methods where needed. Renames some internal classes and interfaces to support the API changes and to simplify tests and improve quality. Test: numerous presubmits Bug: 175830670 CTS-Coverage-Bug: 180419562 Change-Id: I9b1b950a2779fc902ecf4d6394e3c35171926700
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-6/+6
| | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-6/+6
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-6/+6
| | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* Apply fixes for EfficientCollections.Jeff Sharkey2020-10-201-2/+3
| | | | | | | | | | Drop-in replacements suggested for inefficient collections. Also annotate a handful of places where we're unable to update. Bug: 155703208 Test: none Exempt-From-Owner-Approval: trivial refactoring Change-Id: I48b600508df8160ac9b40fea7afca974b2c972f6
* Merge changes from topic "sep11" am: c0b288133a am: 69e6f07347 am: ↵Jeff Sharkey2020-09-151-1/+1
|\ | | | | | | | | | | | | | | 741c0a78cc am: da7478b570 am: 487d394296 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1426195 Change-Id: Id01f468b43fd5b2aada78608010625b392c1b647
| * Update language to comply with Android's inclusive language guidanceJeff Sharkey2020-09-141-1/+1
| | | | | | | | | | | | | | | | | | See https://source.android.com/setup/contribute/respectful-code for reference Test: none Bug: 168334533 Exempt-From-Owner-Approval: docs updates Change-Id: I245b8d9cac722da76ea67983738a3cbb9deb68df
| * [DO NOT MERGE] Bring back touch events for double tap and double tap and hold.Ameer Armaly2020-06-221-4/+77
| | | | | | | | | | | | Bug: 159168795 Test: atest TouchExplorerTest Change-Id: I427b98c71ce8a2ac5b9285b2f34c1864f48c4a32
* | Merge "Bring back touch events for double tap and double tap and hold."TreeHugger Robot2020-07-211-3/+75
|\ \
| * | Bring back touch events for double tap and double tap and hold.Ameer Armaly2020-07-151-3/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | This CL includes all subsequent fixes that were caused by the original change. Bug: 159168795 Test: atest TouchExplorerTest Change-Id: I416b90cf49a2804890246f2d52ee3a168059630f Change-Id: Ibecc5f6cd1cdb682d1026869f6aa03da7f123e08
* | | Delay sending accessibility events a little for temporarily detached viewyingleiw2020-07-141-0/+11
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In RV, a view could be temporarily detached in one draw cycle. Accessibility events sent during this time will be lost. To prevent the events from being lost, we will set a flag when a view is detached by parent. And when sending accessibility events for detached view, we will delay it a little by ViewConfiguration.getSendRecurringAccessibilityEventsInterval. This way, if the view is attached in one draw cycle, the events will be sent out. Also add more setStateDescription() in CompoundButton to for safer code. (this is not the cause of this bug though). Fix: 151125936 Test: tested that the bug is fixed. Change-Id: Iffca8c87bad4fa2f66862b966e351562d77d6d76
* | Merge "Insets: Allow animations when setting SYSTEM_UI_LAYOUT_* flags" into ↵TreeHugger Robot2020-05-281-2/+4
|\| | | | | | | | | | | rvc-dev am: 9cf7941324 am: 790e618c22 am: 347da37a6b am: 3e0312f4e0 Change-Id: Id68d7aed6c7b6051a879daa5700935322823509b
| * Insets: Allow animations when setting SYSTEM_UI_LAYOUT_* flagsAdrian Roos2020-05-281-2/+4
| | | | | | | | | | | | Test: atest android.server.wm.WindowInsetsAnimationTests#testAnimationCallbacks_withLegacyFlags Fixes: 155955734 Change-Id: Idb35218abb4e17688bfb985abb97ae739a60136b
| * Scroll Capture FrameworkMark Renouf2020-04-201-6/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an implementation of long screenshots supporting interactive, incremental capture of scrolling content using a cooperative API between the app process and the system. Design goals: - Provide for tile based incremental screenshots of scrolling content - Support existing apps without developer action - Provide support for non View-based Apps & UI toolkits Bug: 148131831 Test: atest \ FrameworksCoreTests:android.view.ScrollCaptureClientTest \ FrameworksCoreTests:android.view.ScrollCaptureTargetResolverTest \ FrameworksCoreTests:com.android.internal.view.ViewGroupScrollCaptureTest \ FrameworksCoreTests:android.view.ScrollViewCaptureHelperTest \ WmTests:com.android.server.wm.DisplayContentTest Merged-In: I6c66a623faba274c35b8fa857d3a72030a763aea Change-Id: I6c66a623faba274c35b8fa857d3a72030a763aea
* | Merge "Switch Java calls to enableZ and disableZ; remove isRecordingFor"Leon Scroggins2020-05-071-5/+3
|\ \
| * | Switch Java calls to enableZ and disableZ; remove isRecordingForLeon Scroggins III2020-05-061-5/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 155422223 Test: make insertInOrderBarrier and insertReorderBarrier are @hide and deprecated. Remove them and update all callers to enableZ and disableZ, which are already public. Update native code to refer to enableZ instead of insertReorderBarrier. In addition, remove @hide Canvas#isRecordingFor. This method was originally used to prevent a single RenderNode from being in two display lists. This is now supported, so there's no reason to avoid it. The one caller used it to determine whether to reorder drawing its child Views (which, as the comment says, makes sense to determine based on whether the Canvas isHardwareAccelerated) and whether to call insertReorderBarrier/insertInOrderBarrier (now enableZ/disableZ). In the latter case, there is no need for a conditional, since enableZ/disableZ only work on a hardware Canvas. Change-Id: Ib216a19d6aeff40b2e23532bacd62d1795c2ab27
* / Scroll Capture FrameworkMark Renouf2020-04-171-6/+122
|/ | | | | | | | | | | | | | | | | | | | | | This is an implementation of long screenshots supporting interactive, incremental capture of scrolling content using a cooperative API between the app process and the system. Design goals: - Provide for tile based incremental screenshots of scrolling content - Support existing apps without developer action - Provide support for non View-based Apps & UI toolkits Bug: 148131831 Test: atest \ FrameworksCoreTests:android.view.ScrollCaptureClientTest \ FrameworksCoreTests:android.view.ScrollCaptureTargetResolverTest \ FrameworksCoreTests:com.android.internal.view.ViewGroupScrollCaptureTest \ FrameworksCoreTests:android.view.ScrollViewCaptureHelperTest \ WmTests:com.android.server.wm.DisplayContentTest Change-Id: I6c66a623faba274c35b8fa857d3a72030a763aea
* Use separate thread if app doesn't listen to animationsJorim Jaggi2020-03-111-0/+28
| | | | | | | | | | | 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
* Update API ExtraRenderingInfo by review feedbackDieter Hsu2020-03-061-1/+1
| | | | | | | | Bug: 150685398 Test: m update-api docs Change-Id: Id21dbde8d15dc936fbbe157b1b50e19564dcd051 Merged-In: Id21dbde8d15dc936fbbe157b1b50e19564dcd051 (cherry picked from commit 327bb81a789dfc8746887f708a28e205c147878c)
* Merge "Allow unbuffered MotionEvent dispatch for View (1/2)"TreeHugger Robot2020-02-191-0/+26
|\
| * Allow unbuffered MotionEvent dispatch for View (1/2)Arthur Hung2020-02-191-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MotionEvents sent from InputDispather would be buffered and dispatched align the vsync by default. And it would provides many of benifits. But for a high quality gaming experience, low latency input is critical when we use analogs inputs (e.g mouse or joystick, etc.). So It's important for gaming applications to process these input events in a raw way, without them being coalesced on each frame. - Add new api View.requestUnbufferedDispatch(source) to control which input source classes could be unbuffered while handled by the view. Bug: 135740001 Bug: 136277595 Test: atest ViewUnbufferedTest Change-Id: If65ed1906f59947dcd1e5062519b643a17d0e8e5
* | Refresh new extra data AccessibilityNodeInfo.ExtraRenderingInfoDieter Hsu2020-02-181-0/+25
|/ | | | | | Bug: 136404500 Test: atest AccessibilityTextActionTest AccessibilityNodeInfoTest Change-Id: Ib1a8556d662d31ffbf3366e1482588ba058530cd
* WindowInsetsAnimation: Clean up APIAdrian Roos2020-02-171-21/+20
| | | | | | | | | | | | | | | | | | | | | Fixes issues the app developers have raised with the WindowInsetsAnimation API: - it really makes more sense to have the Animation as the outer class, and the Callback nested within - it was not obvious previously that multiple animations could be running at the same time. A new argument to onProgress now makes this abundantly clear by passing in the list of running animations. - The dispatch mode really fits better as a final property on the callback, rather than it being queried once from a getter. Also fixes lint warnings. Fixes: 143556682 Test: make checkapi; atest WindowInsetsControllerTests Change-Id: I8cd8faac70dd5a15d779d2c983f0a0ea5d6bbd8e
* Replace OnContentApplyWindowInsetsListener with simple booleanJorim Jaggi2020-02-011-0/+12
| | | | | | | | | | | | | The concept will move into the support library (androidx), so in the framework we only need a simple boolean to toggle the default behavior. Also remove redundant methods on WIC to control IME. Bug: 143556682 Bug: 118118435 Test: WindowTest CTS Change-Id: I30fbffdfbe79a57b0f4166f0657c78370c7bcf02
* Window Manager Flag Migration (12/n)Tiger Huang2020-01-231-0/+2
| | | | | | | | | | | | - Unhide new APIs - MaxInsets -> InsetsIgnoringVisibility - Deprecate SystemUI flags - Deprecate some other stuff Bug: 118118435 Test: Build, CTS coming soon Change-Id: I0a0cbdb48258b3779d536668b59e8c88f3c96d18 Exempt-From-Owner-Approval: Trivial rename
* Introduce Window.setContentOnApplyWindowInsetsListenerJorim Jaggi2020-01-221-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When root-level content containers fit insets, they used to just apply and consume the entire system insets. However, with the new Inset APIs, and with deprecating ADJUST_RESIZE IME flag, we want to give apps an easy way to customize this behavior. For that, we introduce Window.setOnContentApplyWindowInsetsListener that returns what kind of margins/padding should be applied and what should be dispatched to the content views. This is essentially a replacement for SYSTEM_UI_FLAG_LAYOUT_* as well as SOFT_INPUT_ADJUST_RESIZE: It allows apps to choose which insets should be handled on the window level vs view level. For that, we mark the window decor views as FRAMEWORK_OPTIONAL_FIT_SYSTEM_WINDOWS, in order to distinguish the case when support library calls makeOptionalFitSystemWindows(). This is because of two reasons: - We don't want the listener to be invoked twice. - We can not do the compat ping-pong between onApplyWindowInsets and fitSystemWindows. This is because during the ping-pong, the result of the OnContentApplyWindowInsetsListener would be lost. However, we still need to do the compat ping-pong for ActionBarOverlayLayout in the support library (until that gets migrated to use onApplyWindowInsets), so we have this separate dispatching path that only gets used for framework optional fitting views. Test: WindowTest Bug: 118118435 Change-Id: I4b514addd9e094163062d651972f85615b4a35db
* Fix up new insets dispatch behaviorJorim Jaggi2020-01-211-8/+41
| | | | | | | | | | | | | - Fix up target SDK check - Keep WindowInsets.CONSUMED concept to stop dispatch for performance optimization. If the insets are handled at some point in the hierarchy, we really don't need to dispatch it to all the children. However, deprecate all the individual consuming methods instead. Bug: 118118435 Test: ViewGroupTest Change-Id: I6b6627fb9c0a43444ee3f9dbeb978109f9138fbd
* Correct layout/draw/animation interleaving for insets callbacksJorim Jaggi2020-01-101-6/+16
| | | | | | | | | | | | See WindowInsetsAnimationCallback.onPrepare for detailed description of new behavior. Also rename InsetsSourceConsumer.setVisible to setRequestedVisible to communicate that this is client intent vs. current state. Test: windowinsetstest application Bug: 111084606 Change-Id: Id35c60e0f59a8aa4f0d300220391d1e2b96a91fd
* Merge "Add public access to debug layout bounds flag."George Mount2019-12-201-2/+2
|\
| * Add public access to debug layout bounds flag.George Mount2019-12-201-2/+2
| | | | | | | | | | | | | | | | | | | | Jetpack compose UI wants to respond to the developer setting that shows the layout bounds of Views to show layout bounds of it sub-elements. This API gives access to that value. Bug: 146676765 Test: New CTS test Change-Id: I1c45f9e6f0ab1192f231ad34df88e392214fa061
* | Use new UnsupportedAppUsage annotation.Artur Satayev2019-12-181-1/+1
| | | | | | | | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I5be7335b23a92b8ac80d2fd890198273b66ad644
* | API update for insetsTarandeep Singh2019-12-161-6/+11
|/ | | | | | | | | | | | | | | | | | - Rename WindowInsetsAnimationListener to WindowInsetsAnimationCallback - Make onAnimation WindowInsetsAnimationCallback.onStarted hierarchical by giving the client a chance to consume AnimationBounds, which then will be dispatched to its children. - Clarify that WindowInsetsAnimationController insets are always relative to the window. - Introduce progress variable for inset animations. Since DecorView will be consuming insets, apps still need a way to calculate the full progress. Instead of also dispatching the root insets, we offer a animation progress instead. Bug: 111084606 Test: CTS will be added in the future Change-Id: I7df27581d01c1db0118eef469ec089249012ba5f