Merge "Remove trampoline toast" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-07-02 17:49:54 +00:00
committed by Android (Google) Code Review

View File

@@ -11073,8 +11073,6 @@ public class NotificationManagerService extends SystemService {
String logcatMessage =
"Indirect notification activity start (trampoline) from " + packageName;
if (blockTrampoline(uid)) {
// 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 {
@@ -11098,19 +11096,5 @@ public class NotificationManagerService extends SystemService {
return tokens.contains(ALLOWLIST_TOKEN)
&& !CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK, uid);
}
private void toast(String packageName, int uid) {
final CharSequence label;
try {
label = mPackageManagerClient.getApplicationLabel(
mPackageManager.getApplicationInfo(packageName, 0,
UserHandle.getUserId(uid)));
} catch (RemoteException e) {
Slog.e(TAG, "Unexpected exception obtaining app label from PackageManager", e);
return;
}
mUiHandler.post(() -> Toast.makeText(getUiContext(),
label + " launch blocked\ng.co/dev/trampolines", Toast.LENGTH_LONG).show());
}
}
}