android 7.1.1 开始 Prevent apps to overlay other apps via toast windows

来源:互联网 发布:易推营销软件 编辑:程序博客网 时间:2024/05/22 03:20

细节参考:https://android.googlesource.com
内容如下:

Prevent apps to overlay other apps via toast windowsIt was possible for apps to put toast type windowsthat overlay other apps which toast winodws aren'tremoved after a timeout.Now for apps targeting SDK greater than N MR1 to add atoast window one needs to have a special token. The tokenis added by the notificatoion manager service only forthe lifetime of the shown toast and is then removedincluding all windows associated with this token. Thisprevents apps to add arbitrary toast windows.Since legacy apps may rely on the ability to directlyadd toasts we mitigate by allowing these apps to stilladd such windows for unlimited duration if this app isthe currently focused one, i.e. the user interacts withit then it can overlay itself, otherwise we make surethese toast windows are removed after a timeout likea toast would be.We don't allow more that one toast window per UID beingadded at a time which prevents 1) legacy apps to put thesame toast after a timeout to go around our new policyof hiding toasts after a while; 2) modern apps to reusethe passed token to add more than one window; Note thatthe notification manager shows toasts one at a time.bug:30150688Change-Id: Icc8f8dbd060762ae1a7b1720e96c5afdb8aff3fd