diff options
| author | 2021-05-05 12:45:40 +0000 | |
|---|---|---|
| committer | 2021-05-05 12:45:40 +0000 | |
| commit | b5881bd59ffdad75d8c9360b419c9a68069f16d2 (patch) | |
| tree | ec34ca6d87c655cad9b689d69073ae1e906901b6 | |
| parent | 2a0573bb9d174c0d0a9590445b185b6cafa405bd (diff) | |
| parent | c784a70726932bba7cb3f82062fdc1f200581766 (diff) | |
Merge "Remove uses of deprecated splashscreenContent attribute" into sc-dev
2 files changed, 9 insertions, 42 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 1d3a60b8193d..7a33f50bab1d 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 @@ -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; @@ -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); - } + 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); @@ -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; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java index 6d3eeae43a96..4273f8926bd1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java @@ -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; } @@ -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(); |