summaryrefslogtreecommitdiff
path: root/core/java/android/widget/PopupWindow.java
Commit message (Collapse)AuthorAgeFilesLines
* Migrate PopupWindow to use OnBackInvokedDispatcherVadim Caen2022-04-041-0/+40
| | | | | | | Bug: 219968356 Test: In BackTestApp, show popup window and swipe back to close it. Test: CTS: android.widget.cts.BackInvokedOnWidgetsTest#popupWindowDismissedOnBackGesture Change-Id: Ic22c12e2ed9f1c961f6e0abfdaf3d2a9a7bd2934
* Clear popups on KEYCODE_ESCAPE as well as KEYCODE_BACKMatthew Duggan2021-07-061-1/+2
| | | | | | | | | | | | On desktop devices, users expect that the Escape key will clear various popup windows in the same way as the Back button will on mobile devices. This adds support for Escape to places the Back button currently clears ListPopupWindow, AutoCompleteTextView, PopupWindow, and ScrollView. Bug: 174164194 Test: Open popups of each type on a device with a physical keyboard and press escape. Change-Id: I32e65ce4317db7de043c8a050d87126b0f38acce
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | 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-1/+1
| | | | | | | | | | 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
* Fix PopupWindow's wrong locationhh83.kim2020-02-261-2/+2
| | | | | | | | | | | | | Sometimes, we have seen cases that Popupwindow is located in the wrong place. So we suggest some modification of logics in tryFitVertical and tryFitHorizontal methods of PopupWindow. In those methods, there exists a statement whether the positions of anchor (anchorTopInScreen and anchorLeftInScreen) are bigger than 0. However, there are some cases that those values become positive even though corresponding popup windows are not visible to user (places out of window area), especially on devices with displaycuout, or apps with multiwindow modes. So we modify to the anchor's top and left position values should be compared with top and left value of displayFrame, respectively, not 0. Test: CtsWidgetTestCases:test android.widget.cts.PopupWindowTest Bug: b/135749682
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-061-3/+2
| | | | | | | | 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: I41e12e425284e74561c6b61663241df364ae54a1
* Revert "Revert "Removing deprecated APIs added to Q""Ian Pedowitz2019-05-121-0/+4
| | | | | | | | | This reverts commit 1600c5a6152d0e643d6eab1896f798ec5d9a2439. Reason for revert: Rolling forward for Q-Finalization Bug: 129975435 Change-Id: I1ffb8162cb5e6f386fd3c417fabfd4298ef86ffd
* Revert "RESTRICT AUTOMERGE Removing deprecated APIs added to Q"Ian Pedowitz2019-05-021-4/+0
| | | | | | | | | This reverts commit f6ed8afa405dfae445a16f7433e4d8a9f20115b9. Reason for revert: QT SDK Finalization. Will be merged again on/after May 13th Bug: 129975435 Change-Id: If94098b7cc9cf75cf9782d2b70e01881f9c40430
* RESTRICT AUTOMERGE Removing deprecated APIs added to QSuprabh Shukla2019-05-011-0/+4
| | | | | | | Test: Builds, boots Bug: 129975435 Change-Id: If083957effedf7987b200c366f65d6863b99bca1
* Revert deletion and deprecate few PopupWindow methodsMatvei Malkov2019-03-141-0/+52
| | | | | | | | | | After method rename procedure b/126354063 we discovered that androidx-platform-dev already depends on that methods added during fixit week, so revert deletion of these methods and deprecate them. Bug: b/126354063 Test: PopupWindowTests Change-Id: I17b985542ffd661358059740bdf620e1bfb5b550
* Rename methods for PopupWindowMatvei Malkov2019-03-121-10/+10
| | | | | | | | | This CL renames 4 methods for PopupWindow based on API council suggestions. Also remove unused import in order to `repo upload` Bug: b/126354063 Test: All ListPopupWindow, MenuPopup and PopupWindow passed Change-Id: I5db93b1c18a7a3dc9033cb9c5bbe89107ac22024
* Epicenter API for ListPopupWindowMatvei Malkov2019-02-101-2/+2
| | | | | | | | | | Introduced epicenter API for ListPopupWindow to mirror the same API that we've made for PopupWindow (b/123768589). Also add mutability protection to PopupWindow epicenter rects Bug: b/124094855 Test: All widgets tests passed. getter / setter tests introduced in I648c169b67972c80befbeae9c37c2819eaad27d4 Change-Id: I2b79a16039d345c9c8893b815735a2811543cf60
* Changes in PopupWindow APIMatvei Malkov2019-02-081-24/+79
| | | | | | | | | | | | | | | Restriced access to private mScrollChangedListener private field and to private invokePopup method. Removed @hide annotation for several methods to allow deeper customization of PopupWindow and it's transitions. Bug: 123768397 Bug: 123769350 Bug: 123769516 Bug: 123768511 Bug: 123768510 Bug: 123768589 Test: Tests has been added to PopupWindowTest in I468b592a3ba2e5f2f895210d21843d328a454794 Change-Id: I7fb4d8e28f0de889e110b7b90f71ebec9ab4cc9d
* Restrict usage of PopupWindow::mOverlayAnchorMatvei Malkov2019-02-051-1/+1
| | | | | | | | | | | The field mOverlayAnchor has getter and setter since API 23 and it's a recommended way to access and set this field. All the usages from opensource is mostly AppCompatPopupWindow forks (some with version check, some are not), so they can easily migrate to getter and setters. Bug: 123768692 Test: PopupWindow and PopupMenu tests passed Change-Id: Ida3077b17a043b2acf2d89456e4501d7ed052e4e
* Limit access to suspected false positives.Mathew Inwood2018-12-281-2/+2
| | | | | | | | | | | | | | | | | | | | | Members modified herein are suspected to be false positives: i.e. things that were added to the greylist in P, but subsequent data analysis suggests that they are not, in fact, used after all. Add a maxTargetSdk=P to these APIs. This is lower-risk that simply removing these things from the greylist, as none of out data sources are perfect nor complete. For APIs that are not supported yet by annotations, move them to hiddenapi-greylist-max-p.txt instead which has the same effect. Exempted-From-Owner-Approval: Automatic changes to the codebase affecting only @UnsupportedAppUsage annotations, themselves added without requiring owners approval earlier. Bug: 115609023 Test: m Change-Id: I020a9c09672ebcae64c5357abc4993e07e744687
* API Review: StateListDrawables#getDrawableForStateNader Jawad2018-09-051-1/+1
| | | | | | | | | Renamed getStateDrawableIndex to findStateDrawableIndex based on API review feedback. Change-Id: If07fe279fb02bc8180a28c7f58ea84ca030773ad Fixes: 113856171 Test: Re-ran CTS
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-211-0/+36
| | | | | | | | | | | | | | | | For packages: android.widget This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Ic61019b1df85448a158fc2ba55c326353222c6b9
* Merge "Don't end transitions on a detached window, prevent crash in WindowId"TreeHugger Robot2018-02-211-1/+3
|\
| * Don't end transitions on a detached window, prevent crash in WindowIdAlan Viverette2018-02-201-1/+3
| | | | | | | | | | | | | | | | | | A WindowId's token should never be null, but let's avoid getting into that situation in the first place. Fixes: 70015590 Test: manual, cannot reliably repro in CTS test Change-Id: I378ba9ba822ecc445d3b8de265b5ec0d20a12dd3
* | autofill: render autofill ui in fullscreen for tvDake Gu2018-02-141-1/+1
|/ | | | | | | | | | | | When IME and autofill are both showing on TV, it's confusing which window has the input focus. This CL changes autofill window to full screen for TV. Bug: 72122929 Test: Manual tested on TV with github example. Manually tested on phone that UI doesn't change. Change-Id: Id97b6389523b2ee744d02f5bc7847b307b0b29e4
* Merge "Make PopupWindows into root namespaces"Evan Rosky2017-11-081-0/+1
|\
| * Make PopupWindows into root namespacesEvan Rosky2017-10-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | PopupWindows weren't marked as root namespaces. This was causing problems for focus-related searches since they often used isRootNamespace to detect when hitting the root of a tree. Bug: 38026649 Test: Ran Docs and verified that default cluster is detected properly in popup windows. Change-Id: If8e1db2bb83626d04770a18c0e5ccb88b3793de4
* | Fixed several core and CTS testsEvan Rosky2017-10-201-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes in framework include: - ListPopupWindow requests focus for itself so it can receive MENU key. - PopupWindow uses setTransitionVisibility to avoid losing focus upon enter transition. - First-traversal will explicitly handle FOCUS_AFTER_DESCENDANTS on the current focus if applicable -- details in code comment. Fixes in tests usually just required focusing what they expected to have initial focus; however, there were a couple tests that had been broken for other reasons for a long time. app.cts.ActionBarTest app.cts.ToolbarActionBarTest android.view.DisabledLongpressTest android.widget.scroll.arrowscroll.ShortButtonsTest android.view.VisibilityTest android.widget.listview.ListScrollListenerTest android.widget.listview.arrowscroll.ListOfThinItemsTest andorid.widget.listview.arrowscroll.ListWithNoFadingEdgeTest android.view.LongpressTest android.widget.focus.ScrollingThroughListOfFocusablesTest android.widget.gridview.GridScrollListenerTest Bug: 67467972 Test: Failing tests should pass now. Change-Id: I9e2fbfeb183eb777f35c67eca53e1f70809b7670
* Hide autofill popup if anchor removedSvet Ganov2017-09-231-3/+8
| | | | | | | | | Test: Manual Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases bug:64601372 Change-Id: Ic55dabb99cd5015d318ab3be1231b6aa5c67294e
* Clean up popup window titlesPhil Weaver2017-06-261-29/+4
| | | | | | | | | | | | | | | | | Removing the recently-added APIs to adjust the title for the popup window, and moving setting the title to preparePopup(), which is guaranteed to have a context. (The bug is a crash because we didn't have a context.) Apps wishing to specify their own title can still do so in the LayoutParams without bothering with the get/set. Bug: 62675086 Test: With TalkBack running, navigate to Settings-> Network & Internet. Select the more options button and double-tap to select it. It now announces "Popup Window". Change-Id: I9735ace42c24ef4977d3f4d5150f768d44aff351
* Add accessibility titles to PopupWindowPhil Weaver2017-06-121-0/+29
| | | | | | | | | | | | Adding a default title and a hidden API to customize the title. Bug: 30177642 Test: With TalkBack running, navigate to Settings-> Network & Internet. Select the more options button and double-tap to select it. It now announces "Popup Window". Change-Id: I38591a25be0fe1d5bf57c9edee29f09c92e258ea
* Revert "Respect PopupWindow.setOverlapAnchor when above anchor"Vladislav Kaznacheev2017-05-121-20/+5
| | | | | | | | This reverts commit 07084924be4ce0dc67f150d77b886f21fcb01aa7. Bug: 37951656 Test: android.widget.cts.PopupWindowTest Change-Id: I6c950d19bbf5c778f799a652595550a2733aae08
* Merge "Fixed yet another missing check for null anchor..."TreeHugger Robot2017-03-281-1/+1
|\
| * Fixed yet another missing check for null anchor...Felipe Leme2017-03-271-1/+1
| | | | | | | | | | | | | | Test: CtsAutoFillServiceTestCases pass Bug: 36643768 Change-Id: I6f97f3aec88c59a94c593958aca8b4a992d4806e
* | Merge "Avoid NPE when PopupWindow is shown while dismissing"Alan Viverette2017-03-271-18/+28
|\ \ | |/ |/|
| * Avoid NPE when PopupWindow is shown while dismissingAlan Viverette2017-03-231-18/+28
| | | | | | | | | | | | Bug: 36468675 Test: PopupWindowTest#testEnterExitInterruption Change-Id: I03bd297c4e7f7653dfff801ec0adfd7ab869abb5
* | Fixed check for null Anchor.Felipe Leme2017-03-271-3/+8
| | | | | | | | | | | | | | | | | | | | | | It was checking if the weak reference pointee was null, but not for a null weak reference per se. Fixes: 36643768 Test: manual verification Test: CtsAutoFillServiceTestCases pass Change-Id: I106dfd4a91ff1d45f8cb3141a992b06cbe460367
* | Make auto-fill UI robustFelipe Leme2017-03-241-30/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now the autofill UI tracks the movement of the anchor view, both real and virtual and while still preventing the filled app from accessing the chooser UI. This was achieved by using a popup window in the app process to determine the window location and adding a window presenter interface to popup window that controls the actual window addition, removal, and update which is implemented by the system server. Test: all autofill CTS tests pass bug: 36392498 bug: 35708258 bug: 34943932 fixes: 36039182 fixes: 36493078 Change-Id: I0321913b2e2e759f4b17003bf85cb873e63a467c
* | Anchor a cascading submenu to its parent menu itemVladislav Kaznacheev2017-03-141-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of cascading menus is anchoring a submenu to the top-level anchor view using a carefully computed offset. This offset is only correct for the case when the submenu is being shown normally, but not when it is flipped due to insufficient space below. More over, when the window containing the anchor is scrolled, the pre-computed might become completely irrelevant, as parent menus might change their above/below state. This CL allows a PopupWindow to be anchored to a view in another popup window (previously it was only possible to anchor to a view in the main app window). Cascading submenu is now tracking its parent item position correctly. Bug: 35768002 Test: android.cts.widget.PopupWindowTest.testAnchorInPopup Change-Id: Id163d739de05729a9fa7e5fedebc9ec0037ed80e
* | Respect PopupWindow.setOverlapAnchor when above anchorVladislav Kaznacheev2017-03-061-5/+20
|/ | | | | | | | | | | | | Currently if a popup menu is shown above the anchor, it is anchored to the anchor's top edge regardless of the value of mOverlapAnchor. Fixing the vertical offset correction and the computation of the vertical space available above the anchor. Bug: 36000552 Test: android.widget.cts.PopupWindowTest#testOverlapAnchor Change-Id: Ifb71ff1fc0aa0df58e4919fd229c2623a2bcbe3d
* Merge "Do not move PopupWindow when its anchor is detached"TreeHugger Robot2017-02-131-14/+30
|\
| * Do not move PopupWindow when its anchor is detachedVladislav Kaznacheev2017-02-091-14/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current PopupWindow implementation might call the anchor view's getLocationInWindow even if the anchor is currently detached from the window (and the location is a meaningless (0,0)). This results in the popup jumping to the top of the screen. This patch is adding tracking of the anchor's attachment state. The position is never updated while the anchor is detached. When the anchor is re-attached, the popup position is updated. Bug: 34853580 Test: manual (see bug) Change-Id: Icca1b9b558a70ee3edbe6236e076d2d08a1f8f11
* | Introduce @SoftInputModeFlags annotationYohei Yukawa2017-02-121-1/+4
|/ | | | | | | | | | | | Doing this allows us to annotate integer values that should corresponds to WindowManager.LayoutParams#softInputMode. Test: There should be no behavior change. RetentionPolicy.SOURCE annotation should change nothing in production code. Test: checkbuild Bug: 32784563 Bug: 35079353 Change-Id: I96300b090edce327d0515c740183abe91ded6bac
* Merge "Extract and unhide TransitionListenerAdapter"Ben Weiss2017-02-061-1/+1
|\
| * Extract and unhide TransitionListenerAdapterBen Weiss2016-11-171-1/+1
| | | | | | | | | | | | Test: CTS tested Change-Id: I8db99d5f212b15db70ee5a6d6debf25d7ad7922d
* | Don't scroll popup parent in response to parent scrollingAlan Viverette2017-01-251-9/+15
| | | | | | | | | | | | Change-Id: I18c2a53f05341f3fd1dc870a6645b583f742b7ec Fixes: 34096043 Test: PopupWindowTest#testPositionAfterParentScroll()
* | Merge "Implement requestKeyboardShortcuts for PopupDecorView"TreeHugger Robot2016-12-201-0/+20
|\ \
| * | Implement requestKeyboardShortcuts for PopupDecorViewPeeyush Agarwal2016-12-141-0/+20
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A call to requestKeyboardShortcuts from popup menu might be dispatched to PopupDecorView or DecorView depending on WindowManagerService's focusedWindow at that moment. In case it gets dispatched to PopupDecorView, we would like to resend it to parent activity's decor view (which can then handle it appropriately). The change adds a notion of mParentRootView which keeps track of popup's parent's decor view. The request is then routed appropriately so as to display the corresponding shortcuts. mAnchor cannot be used as it gets nulled (by dismiss) by the time requestKeyboardShortcuts gets called. Bug: 31850671 Change-Id: I0ee3a1c7801c6d3fce8748bc7513382f250c5c63 Fixes: 31850671 Test: cts-tradefed run cts-dev -m CtsAppTestCases -t android.app.cts.ActivityKeyboardShortcutsTest#testRequestShowKeyboardShortcuts
* / Show popup transitions when there is no anchor setAlan Viverette2016-12-071-17/+25
|/ | | | | | | | | | Allow anchorRoot to be null when starting exit transition. Pushes epicenter callback creation into startExitTransition. Adds nullability annotations. Bug: 33035511 Test: PopupWindowTest#testEnterExitTransition Change-Id: Ie752a0d6b29d5eb11c160771d8a78fa6234de5bb
* Fix import statements in android.widget package.Aurimas Liutikas2016-10-111-6/+7
| | | | | | | Additionally this CL removes spaces at the end of the line. Test: code still compiles. Change-Id: I1ce98b4e70aa3ae614f87966c3bc6181fa4389a4
* PopupWindow: Don't ignore top decorations in getMaxAvailableHeight. am: ↵Robert Carr2016-09-141-2/+13
|\ | | | | | | | | | | | | | | 701d73084d am: 5712f5474a am: 5f09d331f3 Change-Id: I24e2d71371de96fd95b6905258f950ea2fb06145
| * PopupWindow: Don't ignore top decorations in getMaxAvailableHeight.Robert Carr2016-09-091-2/+13
| | | | | | | | | | | | | | | | | | | | getMaxAvailableHeight is ignoring the top insets, while findDropDownPosition is not. This is causing getMaxAvailableHeight to return a fits above position that findDropDownPosition will think is too large. Bug: 31048766 Change-Id: Ifa57cb4ebe0944c701a6f38b58d4f144d8b9199c
* | PopupWindow: Gravity fixes. am: 085160612d am: a732ea6c1fRobert Carr2016-09-011-7/+5
|\| | | | | | | | | | | am: 0ceb3cd785 Change-Id: I9e8dbd01cc0dfa0e115a5f0270912cbb67e9213d
| * PopupWindow: Gravity fixes.Robert Carr2016-08-231-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | First we restore the M semantics with respect to DISPLAY_CLIP_VERTICAL, which we only applied for drop downs, and omitted in the case of showAtLocation. Further, we fix an error where user specified gravity from showAtLocation is erased when calling update() by storing the gravity and including it in computeGravity(). Bug: 30445010 Bug: 30965176 Change-Id: I28a081e1237a8b41f2444717e0db21ef4181507b