Loading
Do not allow custom animation of untrusted Toast
Since target API level 30 (Android 11), regular text toast is shown
by SystemUI (See Toast#CHANGE_TEXT_TOASTS_IN_THE_SYSTEM). While
legacy apps and deprecated custom view show the toast in its own
processes, so force the default animation style for these usages to
avoid unexpected animation duration.
Such when setForceHideNonSystemOverlayWindowIfNeeded is triggered,
the regular Toast displayed by SystemUI won't be affected (because
SystemUI has internal permission), and the untrusted Toast can be
hidden in a short time (config_longAnimTime=500ms) instead of a
customized duration.
Bug: 408215749
Flag: EXEMPT bugfix
Test: atest DisplayPolicyTests#testNonSystemToastAnimation
Test: Show a Toast with modified
WindowManager.LayoutParams#windowAnimations
Change-Id: Ib2844dedebfa3ec9fc8333af3f66bb07cd4d3d7f