Loading libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +20 −3 Original line number Diff line number Diff line Loading @@ -109,11 +109,12 @@ public class SplashscreenContentDrawer { * view on background thread so the view and the drawable can be create and pre-draw in * parallel. * * @param emptyView Create a splash screen view without icon on it. * @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, int splashScreenResId, ActivityInfo info, int taskId, Consumer<SplashScreenView> consumer) { void createContentView(Context context, boolean emptyView, int splashScreenResId, ActivityInfo info, int taskId, Consumer<SplashScreenView> consumer) { mSplashscreenWorkerHandler.post(() -> { SplashScreenView contentView; try { Loading @@ -121,7 +122,11 @@ public class SplashscreenContentDrawer { context, splashScreenResId); if (contentView == null) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "makeSplashScreenContentView"); if (emptyView) { contentView = makeEmptySplashScreenContentView(context); } else { contentView = makeSplashScreenContentView(context, info); } Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } catch (RuntimeException e) { Loading Loading @@ -190,6 +195,18 @@ public class SplashscreenContentDrawer { } } private SplashScreenView makeEmptySplashScreenContentView(Context context) { getWindowAttrs(context, mTmpAttrs); final StartingWindowViewBuilder builder = new StartingWindowViewBuilder(); final int themeBGColor = peekWindowBGColor(context); final SplashScreenView view = builder .setContext(context) .setWindowBGColor(themeBGColor) .build(); view.setNotCopyable(); return view; } private SplashScreenView makeSplashScreenContentView(Context context, ActivityInfo ai) { updateDensity(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +24 −32 Original line number Diff line number Diff line Loading @@ -317,12 +317,11 @@ public class StartingSurfaceDrawer { // 3. Pre-draw the BitmapShader if the icon is immobile on splash screen worker thread, at // the same time the splash screen thread should be executing Session#relayout. Blocking the // traversal -> draw on splash screen thread until the BitmapShader of the icon is ready. final Runnable setViewSynchronized; if (!emptyView) { // Record whether create splash screen view success, notify to current thread after // create splash screen view finished. final SplashScreenViewSupplier viewSupplier = new SplashScreenViewSupplier(); setViewSynchronized = () -> { final Runnable setViewSynchronized = () -> { // waiting for setContentView before relayoutWindow SplashScreenView contentView = viewSupplier.get(); final StartingWindowRecord record = mStartingWindowRecords.get(taskId); Loading @@ -342,21 +341,14 @@ public class StartingSurfaceDrawer { record.setSplashScreenView(contentView); } }; mSplashscreenContentDrawer.createContentView(context, mSplashscreenContentDrawer.createContentView(context, emptyView, splashscreenContentResId[0], activityInfo, taskId, viewSupplier::setView); } else { setViewSynchronized = null; } try { final View view = win.getDecorView(); final WindowManager wm = mContext.getSystemService(WindowManager.class); postAddWindow(taskId, appToken, view, wm, params); // all done if (emptyView) { return; } // We use the splash screen worker thread to create SplashScreenView while adding the // window, as otherwise Choreographer#doFrame might be delayed on this thread. // And since Choreographer#doFrame won't happen immediately after adding the window, if Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +20 −3 Original line number Diff line number Diff line Loading @@ -109,11 +109,12 @@ public class SplashscreenContentDrawer { * view on background thread so the view and the drawable can be create and pre-draw in * parallel. * * @param emptyView Create a splash screen view without icon on it. * @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, int splashScreenResId, ActivityInfo info, int taskId, Consumer<SplashScreenView> consumer) { void createContentView(Context context, boolean emptyView, int splashScreenResId, ActivityInfo info, int taskId, Consumer<SplashScreenView> consumer) { mSplashscreenWorkerHandler.post(() -> { SplashScreenView contentView; try { Loading @@ -121,7 +122,11 @@ public class SplashscreenContentDrawer { context, splashScreenResId); if (contentView == null) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "makeSplashScreenContentView"); if (emptyView) { contentView = makeEmptySplashScreenContentView(context); } else { contentView = makeSplashScreenContentView(context, info); } Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } catch (RuntimeException e) { Loading Loading @@ -190,6 +195,18 @@ public class SplashscreenContentDrawer { } } private SplashScreenView makeEmptySplashScreenContentView(Context context) { getWindowAttrs(context, mTmpAttrs); final StartingWindowViewBuilder builder = new StartingWindowViewBuilder(); final int themeBGColor = peekWindowBGColor(context); final SplashScreenView view = builder .setContext(context) .setWindowBGColor(themeBGColor) .build(); view.setNotCopyable(); return view; } private SplashScreenView makeSplashScreenContentView(Context context, ActivityInfo ai) { updateDensity(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +24 −32 Original line number Diff line number Diff line Loading @@ -317,12 +317,11 @@ public class StartingSurfaceDrawer { // 3. Pre-draw the BitmapShader if the icon is immobile on splash screen worker thread, at // the same time the splash screen thread should be executing Session#relayout. Blocking the // traversal -> draw on splash screen thread until the BitmapShader of the icon is ready. final Runnable setViewSynchronized; if (!emptyView) { // Record whether create splash screen view success, notify to current thread after // create splash screen view finished. final SplashScreenViewSupplier viewSupplier = new SplashScreenViewSupplier(); setViewSynchronized = () -> { final Runnable setViewSynchronized = () -> { // waiting for setContentView before relayoutWindow SplashScreenView contentView = viewSupplier.get(); final StartingWindowRecord record = mStartingWindowRecords.get(taskId); Loading @@ -342,21 +341,14 @@ public class StartingSurfaceDrawer { record.setSplashScreenView(contentView); } }; mSplashscreenContentDrawer.createContentView(context, mSplashscreenContentDrawer.createContentView(context, emptyView, splashscreenContentResId[0], activityInfo, taskId, viewSupplier::setView); } else { setViewSynchronized = null; } try { final View view = win.getDecorView(); final WindowManager wm = mContext.getSystemService(WindowManager.class); postAddWindow(taskId, appToken, view, wm, params); // all done if (emptyView) { return; } // We use the splash screen worker thread to create SplashScreenView while adding the // window, as otherwise Choreographer#doFrame might be delayed on this thread. // And since Choreographer#doFrame won't happen immediately after adding the window, if Loading