Ignore to show splash screen if the decorView is not opaque

When the user chooses dark theme, UiModeManager will clear the cache of
task snapshot for this configuration change, which means the system will
reset to use splash screen as the starting window when launching the

However, when the user tries to bring the app to the top, some apps like
Twitter MainActivity uses transparent drawable as the splash window background,
which looks weird that only see the blanked status bar with transparent background
when bring the app task back to top.

To fix that, add a check in PhoneWindowManager#addSplashScreen, when the
view background is not opaque, will ignore this splash screen creation.

Fix: 146080233
Test: manual as below step:
     1. Open Twitter, swipe home.
     2. Quick settings => turn dark theme on. Close shade.
     3. Launch Twitter from home screen
     4. Expect no blanked status bar with transparent background during

Change-Id: I9d9713af7285c8c63b86faa90b72690471a202ea
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 3c42e93..c2a6d54 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -2410,6 +2410,15 @@
             wm = (WindowManager) context.getSystemService(WINDOW_SERVICE);
             view = win.getDecorView();
+            // Ignore to show splash screen if the decorView is not opaque.
+            if (!view.isOpaque()) {
+                if (DEBUG_SPLASH_SCREEN) {
+                    Slog.d(TAG, "addSplashScreen: the view of " + packageName
+                            + " is not opaque, cancel it");
+                }
+                return null;
+            }
             if (DEBUG_SPLASH_SCREEN) Slog.d(TAG, "Adding splash screen window for "
                 + packageName + " / " + appToken + ": " + (view.getParent() != null ? view : null));