Add WindowParams privateflag to Toast so it appears on SysUI Notifications. am: ba6a1be122 am: 4b9b0379ef
am: 5aa70331f1

Change-Id: I87d9ebed58d09f29f6705da7d9e4a486d07f582a
diff --git a/src/com/android/car/notification/NotificationClickHandlerFactory.java b/src/com/android/car/notification/NotificationClickHandlerFactory.java
index c231fc0..428ff00 100644
--- a/src/com/android/car/notification/NotificationClickHandlerFactory.java
+++ b/src/com/android/car/notification/NotificationClickHandlerFactory.java
@@ -29,6 +29,7 @@
 import android.service.notification.StatusBarNotification;
 import android.util.Log;
 import android.view.View;
+import android.view.WindowManager;
 import android.widget.Button;
 import android.widget.Toast;
 
@@ -263,7 +264,13 @@
     }
 
     private void showToast(Context context, int resourceId) {
-        Toast.makeText(context, context.getString(resourceId), Toast.LENGTH_LONG).show();
+        Toast toast = Toast.makeText(context, context.getString(resourceId), Toast.LENGTH_LONG);
+        // This flag is needed for the Toast to show up on the active user's screen since
+        // Notifications is part of SystemUI. SystemUI is owned by a system process, which runs in
+        // the background, so without this, the toast will never appear in the foreground.
+        toast.getWindowParams().privateFlags |=
+                WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
+        toast.show();
     }
 
     private boolean shouldAutoCancel(StatusBarNotification sbn) {