Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcb4b0ce authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Limit toasts posted by system

Test: manual
Fixes: 151553170
Change-Id: Ica009d078c02eb9205c55ec8927e78e77c569dc0
parent 3544feed
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.UserIdInt;
import android.annotation.WorkerThread;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
@@ -2840,9 +2841,8 @@ public class NotificationManagerService extends SystemService {
                        record = mToastQueue.get(index);
                        record.update(duration);
                    } else {
                        // Limit the number of toasts that any given package except the android
                        // package can enqueue.  Prevents DOS attacks and deals with leaks.
                        if (!isSystemToast) {
                        // Limit the number of toasts that any given package can enqueue.
                        // Prevents DOS attacks and deals with leaks.
                        int count = 0;
                        final int N = mToastQueue.size();
                        for (int i = 0; i < N; i++) {
@@ -2856,7 +2856,6 @@ public class NotificationManagerService extends SystemService {
                                }
                            }
                        }
                        }

                        Binder windowToken = new Binder();
                        mWindowManagerInternal.addWindowToken(windowToken, TYPE_TOAST, displayId);