From 877a2da3eb7b3d4902a942503e668a38bfaad4b5 Mon Sep 17 00:00:00 2001 From: Ming-Shin Lu Date: Wed, 28 Oct 2020 09:55:30 +0800 Subject: 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 app. 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 launching. Change-Id: I9d9713af7285c8c63b86faa90b72690471a202ea --- .../core/java/com/android/server/policy/PhoneWindowManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 3c42e930389b..c2a6d5419a88 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 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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)); -- cgit v1.2.3-59-g8ed1b