summaryrefslogtreecommitdiff
path: root/core/java/android/app/Dialog.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix Dialog default callback registering at the wrong priority.Shan Huang2022-12-101-2/+1
| | | | | | | | Bug:259602785 Test: In a standalone app, register a callback in Dialog#onCreate() with default priority. Make sure the dialog callback can be invoked. Test: BackNavigationTests#registerCallback_dialog (run on master) Change-Id: I9cfd596611fb341389cda44e3605c1e99ddc3791
* Prevent callback registration when back flag is disabledVadim Caen2022-06-201-2/+0
| | | | | | | | | | | | | | | | When the enableOnBackInvokedCallback is set to false (or not set), registering an OnBackInvokedCallback should be a no-op to avoid overriding the default compat callback. Test: Manual testing registering a callback on an app with the flag disabled and doing a back gesture. Currently we don't have test executing a back gesture so automated tests are not possible Bug: 235206960 Change-Id: I54d843f11130a78ed5a68cbe4722e601a2086ee1 Merged-In: I54d843f11130a78ed5a68cbe4722e601a2086ee1 (cherry picked from commit aa48dc3c2db92189055804878b88a51f0cf8e955)
* Update deprecation documentation for onBackPressedVadim Caen2022-05-031-0/+19
| | | | | | | | | Add some detail about migrating to OnBackInvokedDispatcher and the reason behing the deprecation of onBackPressed methods. Fixes: 227563202 Test: Documentation change only Change-Id: Ifc2dd88cb9600efae84cd353549811e7b07ae4bc
* Remove OnBackInvokedDispatcherOwner interface.Shan Huang2022-04-011-5/+2
| | | | | | | | Test: m -j update-api. Build and flash and test back behavior throughout the system. Bug: 227500290 Change-Id: Ibdb13d02e044741d05d99f1cad96e43dc0129fe4
* Split animation methods out of OnBackInvokedCallbackVadim Caen2022-04-011-6/+1
| | | | | | | | | | | | | | This makes OnBackInvokedCallback SAM compatible Bug: 227789359 Test: atest \ CtsWindowManagerDeviceTestCases:android.server.wm.BackNavigationLegacyTest \ CtsWindowManagerDeviceTestCases:android.server.wm.BackNavigationTests \ WmTests:com.android.server.wm.BackNavigationControllerTests \ FrameworksCoreTests:android.window.BackNavigationTest \ FrameworksCoreTests:android.window.WindowOnBackInvokedDispatcherTest \ CtsViewTestCases:android.view.cts.OnBackInvokedDispatcherTest Change-Id: Iab86b0488f1b3048eb02042191acaeb6a645a0bc
* Deprecate Activity#onBackPressed and Dialog#onBackPressed.Shan Huang2022-03-281-0/+4
| | | | | | Test: m -j update-api Bug: 195946584 Change-Id: I680884520074751e1c5fd0c7bd906a5f11f30236
* Change parameter order to make it SAM compatibleVadim Caen2022-03-171-1/+1
| | | | | | | | Move the callback as the last paramter to registerOnBackInvokedCallback Test: Existing Bug: 224562951 Change-Id: I8608a03b53baa04bedee81d2e86b2339abd6c594
* Fix a problem that Dialog does not close in new dispatch.Shan Huang2022-03-171-1/+2
| | | | | | | | | | We can treat Dialog as a standard widget that handles back. Its dedicated back nav type is not in use and can eventually be removed. Test: try dismiss dialog in BackTest app. Change-Id: If89856ccfac8b1fd968aa674628476de02fbf489 (cherry picked from commit 6cb6399008712cf6d4e26de47fc54200cc2d6371)
* Move OnBackInvokedCallback to window package.Vadim Caen2022-03-021-3/+3
| | | | | | | | | | | | | Originally, View was implementing onBackInvokedDisptacherOwner, but now only Activity and Dialog and since back event are related to the window, it makes sense to move them into the android.window package This follow up comment at: ag/c/platform/frameworks/base/+/16764116/comments/e131f3ef_e3e1d2e0 Test: atest BackNavigationTests Bug: 221401221 Change-Id: Ia2f26162beb6a41b6e162b31e599e882f8bf7320
* Add enableOnBackInvokedCallaback manifest attributeVadim Caen2022-02-141-2/+3
| | | | | | | | | | Add a manifest flag for applications to opt-out of the new back navigation system. Test: atest CtsWindowManagerDeviceTestCases: android.server.wm.BackNavigationLegacyTest Bug: 217709328 Change-Id: I43d09a37b126e59bdb8f20bb83cf6d99e53a1e91
* Avoid leaking Activity from OnBackInvokedCallback.Shan Huang2022-02-101-0/+1
| | | | | | | | | | | - Remove mTopCallback field - Cleanup compat and default callbacks - Remove the callback held by WindowState when the window is removed. Bug: 218328707 Test: atest packages/apps/Launcher3/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java Test: atest frameworks/base/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java Change-Id: I38fd760a617500c874aef10bc8de165880837008
* Add compatibility back callbacks.Shan Huang2022-02-051-1/+18
| | | | | | | | | | | For pre-T apps, the default back callback dispatches KEYCODE_BACK to the application's root view. For T+ apps, the default KEYCODE_BACK listener invokes the registered OnBackInvokedCallback. Test: m -j Bug: 195946584 Change-Id: I62342b249e6cd6f8b036f7e950cc3f9754418ee4
* Save the OnBackInvokedCallback in WindowStateVadim Caen2022-02-021-8/+2
| | | | | | | | | | | | | This CL enable OnBackInvokedCallback to be saved in a WindowState and queried by the BackNavigationController to be returned when ATM.startBackNavigation() is called. The DecorView provides a PendingOnBackInvokedDispatcher that can receive callback registration before being added to a ViewRootImpl. Test: atest FrameworksCoreTests:BackNavigationTest Bug: 131727607 Change-Id: I01528a22ea4a6583a56ade4eab69136d727855d0
* Provide OnBackInvokedDispatcher from Activity, View and DialogShan Huang2022-01-201-1/+22
| | | | | | | Test: mp core sysuig services Bug: 195946584 Change-Id: Ia882ec621154ea1daa780c8976b900e4c8f44a7d
* Refactor DialogLaunchAnimator and remove host dialog (1/2)Jordan Demeulenaere2021-12-011-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL is a refactoring of the DialogLaunchAnimator and a major change in how it works internally. Before this CL, when DialogLaunchAnimator.show(originalDialog, ...) was called, it would create a fullscreen dialog (called hostDialog) to which we would add the content view stolen from the originalDialog (that would then be hidden). We would then run the launch animation in the host dialog and listen for show(), hide() or dismiss() calls to the originalDialog to know when we should show(), hide() or dismiss() the hostDialog. The main reason we did that was because there was no way to override the dismiss() behavior of the originalDialog, which we need to do given that we want to animate the dialog into the view that showed the dialog before actually dismissing it. This approach had multiple downsides: - We were showing the dialog content view inside a different window than the one in which it was created, therefore any change made to or any listener added to the originalDialog window was lost. - Code calling DialogLaunchAnimator.showFromView needed to know that their dialog content will be moved to another window, which is unexpected and can lead to subtle bugs. - We were waiting for 2 dialogs to be shown instead of 1 before being able to start the animation. This CL does what we should have done since the beginning: it adds a hidden API to Dialog so that we can override what happens when Dialog.dismiss() is called. This allows the DialogLaunchAnimator to run the exit animation into the view that triggered the dialog before actually dismissing it. The only modification that DialogLaunchAnimator.show(originalDialog, ...) now does to the originalDialog is making its window fullscreen and inserting two views between the originalDialog DecorView and its children. The first inserted view is a fullscreen transparent background used to dismiss the dialog when the user taps outside the dialog content. The second inserted view is a View that we size and position the same way that the DecorView was before we made it fullscreen, and to which we set the originalDialog background. This view now serves as a "fake window" with the same size, background and position as the original window (DecorView). This CL improves the time to start the launch animation by 20-25% (measured in a totally unrigorous logcat way). Bug: 193634619 Test: atest DialogLaunchAnimatorTest Change-Id: If09eda7b06e83b3ed7714cec97afef08b3d9fd3e
* Annotating context in framework baseCharles Chen2020-08-031-5/+10
| | | | | | Bug: 151414704 Test: build & run Change-Id: I42c8ab699433c51158a1af201da0521413d74dcd
* 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: I8789f8499d4dca08580672e9e45ed9a7026dd686
* Remove FEATURE_SWIPE_TO_DISMISS functionalityJorim Jaggi2019-11-051-8/+0
| | | | | | | | Not used anymore by any product. Bug: 143346248 Test: Boots Change-Id: I21286e62f73ec34f7d5ca040cd614838c9cd4276
* Remove old private constant from ResourceId.Aurimas Liutikas2019-01-171-2/+2
| | | | | | Bug: 122967079 Test: make -j builds Change-Id: I3e999044df02549e84208d38bb77d2ce1d1bd73b
* Limit access to suspected false positives.Mathew Inwood2018-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Merge "Annotate Window.Callback menu methods with nullability"Ian Lake2018-09-141-5/+5
|\
| * Annotate Window.Callback menu methods with nullabilityIan Lake2018-09-131-5/+5
| | | | | | | | | | | | | | | | | | Also update the two common implementations using these: Activity and Dialog. BUG: 78245676 Test: make Change-Id: If7b95b73df7dedb12210819d831ba7102344facf
* | Move some members to the "Q blacklist".Mathew Inwood2018-09-141-1/+2
|/ | | | | | | | | | | | | | Based on some analysis, these fields/methods are likely false positives. Set maxTargetSdk=P so that any apps using them are required to migrate off them in future. See the bug for more details. 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: I719b5c94e5b1f4fa562dd5d655953422958ad37e
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-141-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | For packages: android.app.usage android.app.trust android.app.timezonedetector android.app.timezone android.app.timedetector android.app.job android.app.backup android.app.assist android.app.admin android.app 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: I618c5dc4462ae990d9df45c3e9ed3f092cc5138c
* Merge "Revert "Let sendShowMessage called from hide to show"" into pi-devAdam Powell2018-06-071-4/+1
|\ | | | | | | | | | | am: eaf3590eda Change-Id: I569a2caf105c4b6cf60b81026567ef4af7ca31c9
| * Revert "Let sendShowMessage called from hide to show"Adam Powell2018-06-041-4/+1
| | | | | | | | | | | | | | | | | | This reverts commit 690b36903ce89e692ca73ff75621ad15077fabbb. Original patch created an inconsistency in show/dismiss dialog callbacks. Bug: 80268176
* | Merge "Modify isShowing method in Dialog" am: 46be1f15aftiansiming [田思明]2018-04-041-1/+1
|\ \ | |/ |/| | | | | | | am: 4b38e9587d Change-Id: Icbd590ffa9a8d0c744bac8a97780857c18595100
| * Modify isShowing method in Dialogtiansiming [田思明]2018-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The method isShowing in Dialog.java is to judge whether the dialog is currently showing, but it will return true when the dialog is hidden. Bug: 74416088 Test: modify testShow in DialogTest.java (see 639879) run cts -m CtsAppTestCases -t android.app.cts.DialogTest#testShow Change-Id: Ibf15e080678f414f8a66ff0841be17a2f9d2d652 Signed-off-by: tiansiming [田思明] <tiansiming@xiaomi.com>
* | Don't use a copy of window params when showing a dialog.Felipe Leme2018-04-021-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a Dialog's show() method is called, it makes a copy (l) of its window param and change the copy's softInputMode before calling wm.addView(). This call ends up calling WindowManagerGlobal.addView(view, l, display, parentWindow), which in turn sets the application token from the parentWindow into l and stores l on its mParams map. Later, when the dialog layout is changed (for example, if it's resized), the original params ends up passed to WindowManagerGlobal.updateViewLayout(), which in turn updates it's internal mParams with it, hence losing the application token (as the token was set in the copy). Then, when Autofill (and possibly Assist) is triggered to that activity, the Dialog's view hierarchy is ignored because WindowManagerGlobal.getRootViews() ignores views whose params do not have an application token. This CL fixes this issue by passing the original dialog's param to the wm method and resetting the softInputMode that was changed, rather than making a copy. Test: atest DialogLauncherActivityTest Test: manual verification with Twitch Fixes: 68816440 Change-Id: I55f510ab7a44030bc368221b7db1a221bc2e09c8
* | Merge "Let sendShowMessage called from hide to show" am: e7d04d728c am: ↵tiansiming [田思明]2018-02-241-1/+4
|\| | | | | | | | | | | | | | | f91fddddd1 am: ef2ac4066b Change-Id: Ic2dc363d4a26b9c3a10e0b7d1072765501eec383
| * Let sendShowMessage called from hide to showtiansiming [田思明]2018-02-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | Dialog's onShow callback is not called from hide to show. Detailed information is written in the bug link. Bug: 73147112 Test: Manual test with the demo Change-Id: I1d32d9695c18a206b661a1bd7c0dba25dbfbf28b Signed-off-by: tiansiming [田思明] <tiansiming@xiaomi.com>
* | Close Dialog when ESC PressedEmilie Roberts2018-02-061-11/+14
| | | | | | | | | | | | | | | | | | | | Listens for ESC key and calls onBackPressed() to close the dialog. Bug: 71907807 Test: atest cts.DialogTest Test: Manual testing on Marlin, P (master) Change-Id: I850cc9889869fa3b7d83bfab55e1f4d63035e162
* | Add requireViewByIdChris Craik2018-01-231-5/+30
|/ | | | | | | | | | | Bug:69461327 Test: atest android.view.cts.ViewTest android.view.cts.WindowTest android.app.cts.DialogTest Test: make offline-sdk-docs Didn't add require versions of #onFindViewById in FragmentContainer/FragmentHostCallback since they're deprecated Change-Id: I4231e318c92a39cfb82ab1ef8769ade2775d5e3e
* Add ResourceId validation helper methodAdam Lesinski2017-05-241-1/+2
| | | | | | | | | | | | | An invalid, 'null' resource ID is defined as 0. Apps often use -1. Add a helper method that makes checking valid IDs easy and more centralized. Eventually make it public API. Bug: 38393777 Test: manual Change-Id: I969ec4a45e86bdab3d7f57d357d475b77c7f8a78
* Automatic casts for more findViewById implementationsAlan Viverette2017-04-041-6/+14
| | | | | | Bug: 24137209 Test: make -j32 Change-Id: I423297a78e63d74eb44fd14747fc3890a9c42937
* Fix OnCancelListener for Dialogs on swipe to dismiss.Michael Kwan2016-12-161-0/+5
| | | | | | | | | | Swipe to dismiss on dialogs did not dispatch onCancel events to OnCancelListeners. Resolve by adding listener to monitor swipe to dismiss events and dispatch onCancel events when that occurs. Bug: 33663411 Change-Id: I64ff29e008d485a4559eb3d1ff7f0e74dccff404
* Modify SwipeDismissLayout to perform its own exit animationNed Burns2016-12-051-1/+1
| | | | | | | | | | | | Instead of relying on the window animation system, in the special case of a swipe-dismiss, disable any default window exit animation and perform a custom animation. This bypasses some bugs in the window animator codebase and allows us to have a nice "rebound" animation if the user doesn't swipe far/fast enough to trigger a dismiss. Bug: 33041168 Change-Id: Ied45700d35a59950bacef1ba0650eaa5bc60fadb
* Disable swipe-to-dismiss for not cancelable dialogs.Michael Kwan2016-12-021-0/+8
| | | | | Bug: 33249829 Change-Id: Ib3d2c9982ece22d1b080b821eaf306f6b686d099
* When adding dialog window but not creating update the configuration.Robert Carr2016-10-051-1/+7
| | | | | | | | | | | | When we dismiss the dialog as opposed to hide it, it is removed from the local WindowManagerGlobal's list of ViewRoots. Thus it stops receiving configuration changes. When first adding a ViewRoot it will pull the configuration from the context, but in this case we are reusing one which has already been added and removed and no such action will occur. Bug: 31004614 Change-Id: Ie247bcf1a14caf4a42413c6813e337aa4c88e3e4
* Clean up Dialog annotations, lint warnings, and declarationsAlan Viverette2016-04-011-88/+102
| | | | | | No functional changes. Change-Id: If38c9d829d83e762f8c2d05c2fe060c56804b38f
* Remove unused import for KeyboardShortcutGroupClara Bayarri2016-04-011-1/+0
| | | | | | Left it in accidentally when removing default method. Change-Id: I6af0712624ffaefff4cb4ad2a9e5a86d7104d2e7
* Keyboard Shortcuts: plumb deviceId throughClara Bayarri2016-03-241-7/+0
| | | | | Bug: 27673736 Change-Id: Ie72807aa8c2bfd142b081a6a915e101c16d31473
* Request Keyboard Shortcuts for SysUI Dialog via WindowClara Bayarri2016-01-131-3/+11
| | | | | | | | | Keyboard shortcuts are requested via WindowManager, and the request pipes through to the view root and the window callback. Bug: 22405482 Change-Id: Ic0071e91c7b554be3ac9df71e9539ee8a60e822e
* Support finishing a task with any finishing activity in the task.Wale Ogunwale2015-08-061-8/+8
| | | | Change-Id: I8c6bb864de6dc135e0fedb16ee424d7816ee3cfa
* Move PhoneWindow and friends back into internal packageAdam Powell2015-05-061-1/+1
| | | | | | | | | | | | PhoneWindow, PhoneLayoutInflater and PhoneFallbackEventHandler decided to @hide out over in the android.view package after the policy jar was disbanded. Give them a more appropriate home over in framework that doesn't imply that they should be accessed from other internal layers of abstraction. Bug 19606548 Change-Id: Id07b791d178fa447010b49b24726b52208838e88
* Save search context when dispatching onSearchRequested.Tim Kilbourn2015-04-131-0/+22
| | | | | | | | | The InputDevice used to trigger the search is saved in a SearchEvent so an application implementing onSearchRequested determine the device triggering the search. Bug: 15374820 Change-Id: If2cd14f77ce572a5ee131697cd63145fbea63f27
* Fix application of default dialog themeAlan Viverette2015-04-101-12/+14
| | | | | | | Cleans up lint annotations. Bug: 20149703 Change-Id: I2ed4eb002b6679a55ea4d5fcc1ea958a4dcb08df
* Avoid double-apply of dialog themeAlan Viverette2015-04-081-19/+27
| | | | | | | Some cleanup of comments and code. Bug: 19924382 Change-Id: I7b1a339259cbaa66fea2ffec38d7dde2b1a9612e
* Add a type parameter to startActionMode() calls.Clara Bayarri2015-03-131-3/+22
| | | | | | | | | | This requires adding a new method to View and Window.Callback to pass down the type as a parameter. For compatibility purposes, the new method implementations keep the type and call the old method, in case clients have subclassed it. Change-Id: If5d857f131e33be8cc6a8814f2e9c4e85ad2da25
* Annotate methods to be called from overrides with @CallSuperTor Norbye2015-03-071-0/+3
| | | | Change-Id: Ibc587c2aaee9f3e7f448079f72a75459fe4e15e7