From b6c89806ee94ba2ca9a0cd3b346ea4fea9212176 Mon Sep 17 00:00:00 2001 From: Bernardo Rufino Date: Thu, 25 Mar 2021 15:53:43 +0000 Subject: [PATCH] Remove warning trampoline toast for beta Remove the toast when the activity start is not actually blocked. Leave the toast for when it's blocked for now, will be removed in later beta releases. Bug: 161957908 Test: Trigger trampoline in app w/ targetSdk < S, verify no toast Test: Trigger trampoline in app w/ targetSdk S+, verify toast Change-Id: I0d49634e7840c0e22b7882087fcfbf9a5ad70ea6 --- .../notification/NotificationManagerService.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 68fc14c131439..e3f679abf534e 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -10661,8 +10661,6 @@ public class NotificationManagerService extends SystemService { * TODO(b/161957908): Remove dogfooder toast. */ private class NotificationTrampolineCallback implements BackgroundActivityStartCallback { - private final Set mPackagesShown = new ArraySet<>(); - @Override public boolean isActivityStartAllowed(Collection tokens, int uid, String packageName) { @@ -10675,16 +10673,12 @@ public class NotificationManagerService extends SystemService { } String logcatMessage = "Indirect notification activity start (trampoline) from " + packageName; - // Call to toast() method is posted to mHandler below to offload PM lookup from the - // activity start path if (CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK, uid)) { - mHandler.post(() -> toast(packageName, uid, /* blocked */ true)); + // Post toast() call to mHandler to offload PM lookup from the activity start path + mHandler.post(() -> toast(packageName, uid)); Slog.e(TAG, logcatMessage + " blocked"); return false; } else { - if (mPackagesShown.add(packageName)) { - mHandler.post(() -> toast(packageName, uid, /* blocked */ false)); - } Slog.w(TAG, logcatMessage + ", this should be avoided for performance reasons"); return true; } @@ -10699,7 +10693,7 @@ public class NotificationManagerService extends SystemService { && !CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK, uid); } - private void toast(String packageName, int uid, boolean blocked) { + private void toast(String packageName, int uid) { final CharSequence label; try { label = mPackageManagerClient.getApplicationLabel( @@ -10710,8 +10704,7 @@ public class NotificationManagerService extends SystemService { return; } mUiHandler.post(() -> Toast.makeText(getUiContext(), - label + " launch " + (blocked ? "blocked" : "will be blocked") - + "\ng.co/dev/trampolines", Toast.LENGTH_LONG).show()); + label + " launch blocked\ng.co/dev/trampolines", Toast.LENGTH_LONG).show()); } } }