From 7609de365e04e7d28e249433f2dc53f8fc4523f3 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Wed, 9 Aug 2023 18:39:56 +0800 Subject: Loose the translucent condition when estimate splash screen bg color. Only use the System background color if more than half of pixels in the window background drawable are translucent. Increase the tolerance of gradient drawable object. Bug: 294505626 Test: cold launch sample app, verify splash screen draw with dominate color. Change-Id: I46c88a1bf2c5fb7d5152d147f035bb172b3f9f78 --- .../android/wm/shell/startingsurface/SplashscreenContentDrawer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java index dc91a11dc64f..29be34347b22 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java @@ -385,8 +385,8 @@ public class SplashscreenContentDrawer { private static int estimateWindowBGColor(Drawable themeBGDrawable) { final DrawableColorTester themeBGTester = new DrawableColorTester( themeBGDrawable, DrawableColorTester.TRANSLUCENT_FILTER /* filterType */); - if (themeBGTester.passFilterRatio() != 1) { - // the window background is translucent, unable to draw + if (themeBGTester.passFilterRatio() < 0.5f) { + // more than half pixels of the window background is translucent, unable to draw Slog.w(TAG, "Window background is translucent, fill background with black color"); return getSystemBGColor(); } else { -- cgit v1.2.3-59-g8ed1b