Loading libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +5 −34 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.graphics.drawable.AdaptiveIconDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.os.Build; import android.os.Handler; import android.os.HandlerThread; import android.os.Trace; Loading Loading @@ -112,18 +111,14 @@ public class SplashscreenContentDrawer { * @param consumer Receiving the SplashScreenView object, which will also be executed * on splash screen thread. Note that the view can be null if failed. */ void createContentView(Context context, boolean emptyView, int splashScreenResId, ActivityInfo info, int taskId, Consumer<SplashScreenView> consumer) { void createContentView(Context context, boolean emptyView, ActivityInfo info, int taskId, Consumer<SplashScreenView> consumer) { mSplashscreenWorkerHandler.post(() -> { SplashScreenView contentView; try { contentView = SplashscreenContentDrawer.makeSplashscreenContent( context, splashScreenResId); if (contentView == null) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "makeSplashScreenContentView"); contentView = makeSplashScreenContentView(context, info, emptyView); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } catch (RuntimeException e) { Slog.w(TAG, "failed creating starting window content at taskId: " + taskId, e); Loading Loading @@ -478,30 +473,6 @@ public class SplashscreenContentDrawer { return root < 0.1; } private static SplashScreenView makeSplashscreenContent(Context ctx, int splashscreenContentResId) { // doesn't support windowSplashscreenContent after S // TODO add an allowlist to skip some packages if needed final int targetSdkVersion = ctx.getApplicationInfo().targetSdkVersion; if (DEBUG) { Slog.d(TAG, "target sdk for package: " + targetSdkVersion); } if (targetSdkVersion >= Build.VERSION_CODES.S) { return null; } if (splashscreenContentResId == 0) { return null; } final Drawable drawable = ctx.getDrawable(splashscreenContentResId); if (drawable == null) { return null; } SplashScreenView view = new SplashScreenView(ctx); view.setNotCopyable(); view.setBackground(drawable); return view; } private static class DrawableColorTester { private final ColorTester mColorChecker; Loading libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +4 −8 Original line number Diff line number Diff line Loading @@ -233,12 +233,8 @@ public class StartingSurfaceDrawer { windowFlags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; final boolean[] showWallpaper = new boolean[1]; final int[] splashscreenContentResId = new int[1]; getWindowResFromContext(context, a -> { splashscreenContentResId[0] = a.getResourceId(R.styleable.Window_windowSplashscreenContent, 0); showWallpaper[0] = a.getBoolean(R.styleable.Window_windowShowWallpaper, false); }); getWindowResFromContext(context, a -> showWallpaper[0] = a.getBoolean(R.styleable.Window_windowShowWallpaper, false)); if (showWallpaper[0]) { windowFlags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; } Loading Loading @@ -339,8 +335,8 @@ public class StartingSurfaceDrawer { record.setSplashScreenView(contentView); } }; mSplashscreenContentDrawer.createContentView(context, emptyView, splashscreenContentResId[0], activityInfo, taskId, viewSupplier::setView); mSplashscreenContentDrawer.createContentView(context, emptyView, activityInfo, taskId, viewSupplier::setView); try { final View view = win.getDecorView(); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +5 −34 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.graphics.drawable.AdaptiveIconDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.os.Build; import android.os.Handler; import android.os.HandlerThread; import android.os.Trace; Loading Loading @@ -112,18 +111,14 @@ public class SplashscreenContentDrawer { * @param consumer Receiving the SplashScreenView object, which will also be executed * on splash screen thread. Note that the view can be null if failed. */ void createContentView(Context context, boolean emptyView, int splashScreenResId, ActivityInfo info, int taskId, Consumer<SplashScreenView> consumer) { void createContentView(Context context, boolean emptyView, ActivityInfo info, int taskId, Consumer<SplashScreenView> consumer) { mSplashscreenWorkerHandler.post(() -> { SplashScreenView contentView; try { contentView = SplashscreenContentDrawer.makeSplashscreenContent( context, splashScreenResId); if (contentView == null) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "makeSplashScreenContentView"); contentView = makeSplashScreenContentView(context, info, emptyView); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } catch (RuntimeException e) { Slog.w(TAG, "failed creating starting window content at taskId: " + taskId, e); Loading Loading @@ -478,30 +473,6 @@ public class SplashscreenContentDrawer { return root < 0.1; } private static SplashScreenView makeSplashscreenContent(Context ctx, int splashscreenContentResId) { // doesn't support windowSplashscreenContent after S // TODO add an allowlist to skip some packages if needed final int targetSdkVersion = ctx.getApplicationInfo().targetSdkVersion; if (DEBUG) { Slog.d(TAG, "target sdk for package: " + targetSdkVersion); } if (targetSdkVersion >= Build.VERSION_CODES.S) { return null; } if (splashscreenContentResId == 0) { return null; } final Drawable drawable = ctx.getDrawable(splashscreenContentResId); if (drawable == null) { return null; } SplashScreenView view = new SplashScreenView(ctx); view.setNotCopyable(); view.setBackground(drawable); return view; } private static class DrawableColorTester { private final ColorTester mColorChecker; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +4 −8 Original line number Diff line number Diff line Loading @@ -233,12 +233,8 @@ public class StartingSurfaceDrawer { windowFlags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; final boolean[] showWallpaper = new boolean[1]; final int[] splashscreenContentResId = new int[1]; getWindowResFromContext(context, a -> { splashscreenContentResId[0] = a.getResourceId(R.styleable.Window_windowSplashscreenContent, 0); showWallpaper[0] = a.getBoolean(R.styleable.Window_windowShowWallpaper, false); }); getWindowResFromContext(context, a -> showWallpaper[0] = a.getBoolean(R.styleable.Window_windowShowWallpaper, false)); if (showWallpaper[0]) { windowFlags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; } Loading Loading @@ -339,8 +335,8 @@ public class StartingSurfaceDrawer { record.setSplashScreenView(contentView); } }; mSplashscreenContentDrawer.createContentView(context, emptyView, splashscreenContentResId[0], activityInfo, taskId, viewSupplier::setView); mSplashscreenContentDrawer.createContentView(context, emptyView, activityInfo, taskId, viewSupplier::setView); try { final View view = win.getDecorView(); Loading