Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent apps to overlay other apps via toast windows
It was possible for apps to put toast type windows that overlay other apps which toast winodws aren't removed after a timeout. Now for apps targeting SDK greater than N MR1 to add a toast window one needs to have a special token. The token is added by the notificatoion manager service only for the lifetime of the shown toast and is then removed including all windows associated with this token. This prevents apps to add arbitrary toast windows. Since legacy apps may rely on the ability to directly add toasts we mitigate by allowing these apps to still add such windows for unlimited duration if this app is the currently focused one, i.e. the user interacts with it then it can overlay itself, otherwise we make sure these toast windows are removed after a timeout like a toast would be. We don't allow more that one toast window per UID being added at a time which prevents 1) legacy apps to put the same toast after a timeout to go around our new policy of hiding toasts after a while; 2) modern apps to reuse the passed token to add more than one window; Note that the notification manager shows toasts one at a time. bug:30150688 Change-Id: Ia1dae626bd9e22541be46edb072aa288eb1ae414
- Loading branch information
Showing with 211 additions and 40 deletions.
- +1 −1 core/java/android/app/ITransientNotification.aidl
- +1 −0 core/java/android/view/SurfaceView.java
- +10 −6 core/java/android/view/WindowManager.java
- +14 −12 core/java/android/widget/Toast.java
- +23 −12 services/core/java/com/android/server/notification/NotificationManagerService.java
- +16 −0 services/core/java/com/android/server/policy/PhoneWindowManager.java
- +40 −0 services/core/java/com/android/server/wm/DisplayContent.java
- +91 −8 services/core/java/com/android/server/wm/WindowManagerService.java
- +15 −1 services/core/java/com/android/server/wm/WindowState.java
Oops, something went wrong.