Signed-off-by: Tavi <tavi@divested.dev>
This commit is contained in:
Tavi 2024-05-12 11:44:47 -04:00
parent 055af41678
commit 89ab1d69ef
No known key found for this signature in database
GPG key ID: E599F62ECBAEAF2E
3 changed files with 15 additions and 15 deletions

View file

@ -1,7 +1,7 @@
From 29f60871d3789e757b012b5d433bf9d9508b274a Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Valentin Iftime <valiiftime@google.com>
Date: Mon, 16 Oct 2023 09:29:17 +0200
Subject: [PATCH] [BACKPORT] Prioritize system toasts
Subject: [PATCH] Prioritize system toasts
Insert toasts from system packages at the front of the queue
to ensure that apps can't spam with toast to delay system toasts from showing.
@ -17,10 +17,10 @@ Change-Id: I13547f853476bc88d12026c545aba9f857ce8724
2 files changed, 99 insertions(+), 2 deletions(-)
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 11c89bbdf4d94..dfc9c135c7da7 100755
index 11c89bbdf4d9..dfc9c135c7da 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -3042,8 +3042,19 @@ record = mToastQueue.get(index);
@@ -3042,8 +3042,19 @@ public class NotificationManagerService extends SystemService {
mWindowManagerInternal.addWindowToken(windowToken, TYPE_TOAST, displayId);
record = getToastRecord(callingUid, callingPid, pkg, token, text, callback,
duration, windowToken, displayId, textCallback);
@ -42,7 +42,7 @@ index 11c89bbdf4d94..dfc9c135c7da7 100755
keepProcessAliveForToastIfNeededLocked(callingPid);
}
// If it's at index 0, it's the current toast. It doesn't matter if it's
@@ -3059,6 +3070,24 @@ record = getToastRecord(callingUid, callingPid, pkg, token, text, callback,
@@ -3059,6 +3070,24 @@ public class NotificationManagerService extends SystemService {
}
}
@ -68,10 +68,10 @@ index 11c89bbdf4d94..dfc9c135c7da7 100755
* Implementation note: Our definition of foreground for toasts is an implementation matter
* and should strike a balance between functionality and anti-abuse effectiveness. We
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
index 3a108144ad66a..011c408492fa3 100755
index 3a108144ad66..011c408492fa 100755
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -5510,6 +5510,74 @@ public void testAlwaysAllowSystemToasts() throws Exception {
@@ -5510,6 +5510,74 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
assertEquals(1, mService.mToastQueue.size());
}