summaryrefslogtreecommitdiff
path: root/core/java/android/widget/ToastPresenter.java
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'android-13.0.0_r16' into t13.0George Zacharia2022-12-151-0/+21
|\ | | | | | | | | | | | | | | | | | | | | Android 13.0.0 Release 16 (TQ1A.221205.011) Also included the following reverts: 1. Revert "fw/b: Import Wi-Fi standard icon [1/2]" 2. Revert "Add preference for toggling the wallpaper zooming animation" Co-authored-by: Semavi Ulusoy <doc.divxm@gmail.com> Change-Id: I9a6b51e452c28d10411712c59778bb54da5783e9
| * Add PbA branding to clipboardYi-an Chen2022-07-191-0/+21
| | | | | | | | | | | | | | Bug: 213357911 Test: Manually on Raven Change-Id: If9944393fe64c7f94a5be139a538833d91ae98fe
* | Fixup legacy toast icon visibilitySagarMakhar2022-10-261-2/+4
| | | | | | | | | | Signed-off-by: SagarMakhar <sagarmakhar@gmail.com> Change-Id: Ia1eba687d5bedee8e3057b84e242f19beaef1546
* | fw_base: Toast icon switch [1/2]LorDClockaN2022-10-261-8/+11
| | | | | | | | | | | | | | | | ** AICP Edit: added back backup validators Signed-off-by: Arghya Chanda <arghyac35@gmail.com> Signed-off-by: SagarMakhar <sagarmakhar@gmail.com> Change-Id: I59ffd10f20a2ae9491f76380ec9af641e0844928
* | Show icon of package associated with Toastd34d2022-10-261-0/+15
|/ | | | | | | | For all those times you have some random app or background service that posts a Toast and you have no idea who's posting it. This adds an icon badge to the top left corner of the Toast to show the app's icon the Toast belongs to Change-Id: I82bf23664eea134f3b1f89ad5a99f6be73906ba8
* Unregister IA11yManagerClient in ToastPresenterSally2021-06-041-13/+17
| | | | | | | | | | | | AccessibilityManager is used to send an a11y event when the Toast is shown, so unregister the client after it's shown Test: Track clients in A11yManagerService before and after multiple toasts are shown with adb shell dumpsys accessibility, atest ToastUITest Bug: 189010828 Change-Id: Ie4759d2f67ab9e3149d44169b812d8ec2316c266
* Update toast parameters instead of re-addingBeverly2021-02-191-1/+1
| | | | | | | | To avoid a race condition Test: manual Fixes: 180615914 Change-Id: I9b39fd2f495605065c1a90ae3ffd5e59a1463fda
* Update Toast visuals + motionBeverly2021-02-101-12/+32
| | | | | | | | | | | | | | | | | | Puts Toast style/animation changes behind a FeatureFlag Toasts can be added via Toast APIs OR legacy apps can add the window directly. Because toast windows can be added directly by legacy apps, DisplayPolicy.java requires that toast windows are removed after TOAST_WINDOW_TIMEOUT. This also means Toast windows added via the Toast APIs are subject to this timeout. Therefore, this CL also increases the timeout by 600ms to account for SystemUI's in/out toast animations. Bug: 169587378 Test: atest ToastUITest Test: manual, rotate device while toast is showing Change-Id: Ib17655c253f4ec4f7018cc5f7939b88a50ea5014 Merged-In: Ib17655c253f4ec4f7018cc5f7939b88a50ea5014
* Add Plugin interface for ToastsBeverly2020-09-301-3/+22
| | | | | | | | | | | | | | | | | | Allows Toasts that route through SystemUI to be implemented by a ToastPlugin. This CL also adds the ability for plugins to create a custom animation for when the toast shows and hides. Also adds logging for Toasts that get routed through SystemUI. By default, these logs aren't logged to logcat but can be enabled via adb (see LogBuffer.kt). To dump ToastLog: adb shell dumpsys activity service com.android.systemui/.SystemUIService ToastLog Bug: 169587378 Test: manually add CustomToastPlugin Test: atest ToastUITest Change-Id: I0a0b16fdc2a5ba1908054197f6dc6728f10a0d2e
* Gets the userId from Context for AccessibilityManager in ToastPresenter.Yuncheol Heo2020-06-171-2/+1
| | | | | | | | | | | - In Android Auto, android.widget.cts.ToastTest#testShow_whenTextToast_sendsAccessibilityEvent failed is failed, since AccessibilityManager in ToastPresenter is initialized with the wrong userId. - ToastUI creates the Context from the uid of the received message, so we can get the correct userId from the Context. Bug: 154644563 Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest android.server.wm.ToastWindowTest ToastUITest NotificationManagerServiceTest LegacyToastTest Change-Id: I138620a0a52e65429157719f588c4be56b075368
* Wire user info and use user context for text toastsBernardo Rufino2020-04-061-6/+19
| | | | | | | | | | | | | | | | | Text toasts don't currently support multi-user. This CL prepares toasts for multi-user by wiring the user information from who requested the toast (in the form of uid) to ToastUI, where text toasts are actually rendered. We go only as far as obtaining a new user-specific context for that user and using that to construct the view. Actual support will come in future CLs. Bug: 151414297 Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest ToastWindowTest ToastUITest NotificationManagerServiceTest LegacyToastTest Change-Id: I8c92453c6a2b73c31f9a41ca9ff463d194d4f44f
* Refactor ToastPresenter to perform show()/hide()Bernardo Rufino2020-04-031-14/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support multi-user, we need to create a new context based on the user id and retrieve the services from it (http://b/151414297#comment9). This meant retrieving the services in ToastUI.showToast() instead of on its constructor, which would make the code diverge from Toast$TN.handleShow(). In order to avoid that, now seemed a good time to refactor ToastPresenter to perform show() and hide(). This means ToastPresenter will now be instantiated in every request for a new toast in ToastUI, but fortunately with the refactor we were able to get rid of ToastEntry (which was also beign instantiated in every request). Also found out a bug with this where window tokens were being used to locate the toasts instead of the (non-window) tokens. This is a bit confusing because the method NM.finishToken(package, token) receives a non-window token to locate the ToastRecord and then finish its window token. This didn't have any side-effects because NM itself finishes the tokens after a time-out. Added a test for this. Bug: 152973950 Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest ToastWindowTest ToastUITest NotificationManagerServiceTest LegacyToastTest Change-Id: I13cf18890ca22022adb7576c8ecf3285a9b82299
* Show toasts from system/sysUI to all usersBernardo Rufino2020-02-281-2/+33
| | | | | | | | | | | | | | | | | | | | The package name test is safe: * If it's used by Toast class in an app, apps have access to layout params anyway via getWindowParams() and applied flag is already protected by INTERNAL_SYSTEM_WINDOW permission. * If it's used by ToastUI class in sys UI on behalf of another app, sys UI is trusted domain and can't be messed up by another app. It also has INTERNAL_SYSTEM_WINDOW permission. Bug: 149408635 Test: atest ToastUITest android.widget.cts.ToastTest android.widget.cts29.ToastTest android.server.wm.ToastTest Test: Change phone to vibration/silent in secondary user and observe toast is displayed. Change-Id: I227e9f74166300fcb3ba8f3871b464afe6ec6a28 Merged-In: I227e9f74166300fcb3ba8f3871b464afe6ec6a28 (cherry picked from commit caef507aa935b3724bd19096b31d557aa0fc787a)
* Unify toast presentation codeBernardo Rufino2020-02-281-0/+117
Extract window layout construction and view inflation from Toast and ToastUI into common @hide class ToastPresenter. This is desirable by itself but also in preparation for making system toasts visible to all users. Bug: 149408635 Test: atest ToastUITest android.widget.cts.ToastTest android.widget.cts29.ToastTest android.server.wm.ToastTest Change-Id: Ifdd7ee37687da2e4c7abed61569cf342f95b2611 Merged-In: Ifdd7ee37687da2e4c7abed61569cf342f95b2611 (cherry picked from commit aea2c50cd81ebb4665380aa6ddc76e2d9b2a6f09)