这个修改主要是在WindowManagerService.java
文件中修改了启动动画停止的逻辑,使得停止启动动画和通知SurfaceFlinger的操作被延迟了3秒。
修改的文件:
- frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
文件修改说明:
1. WindowManagerService.java
在这个文件中,修改了performEnableScreen
函数的逻辑。原先的逻辑是,一旦满足条件,就立即停止启动动画并通知SurfaceFlinger。现在的逻辑是,创建了一个延迟3秒的Runnable,当Runnable运行时,才会停止启动动画并通知SurfaceFlinger。
--- .../server/wm/WindowManagerService.java | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) mode change 100644 => 100755 frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java diff --git a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java old mode 100644 new mode 100755 index 1948eb2a73e..f730f53d5c1 --- a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java @@ -3566,37 +3566,45 @@ public class WindowManagerService extends IWindowManager.Stub return; } - if (!mBootAnimationStopped) { + if (mBootAnimationStopped) { Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, "Stop bootanim", 0); // stop boot animation // formerly we would just kill the process, but we now ask it to exit so it // can choose where to stop the animation. - SystemProperties.set("service.bootanim.exit", "1"); - mBootAnimationStopped = true; + return; } - if (!mForceDisplayEnabled && !checkBootAnimationCompleteLocked()) { + /*if (!mForceDisplayEnabled && !checkBootAnimationCompleteLocked()) { if (DEBUG_BOOT) Slog.i(TAG_WM, "performEnableScreen: Waiting for anim complete"); return; - } - - try { - IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlinger"); - if (surfaceFlinger != null) { - Slog.i(TAG_WM, "******* TELLING SURFACE FLINGER WE ARE BOOTED!"); - Parcel data = Parcel.obtain(); - data.writeInterfaceToken("android.ui.ISurfaceComposer"); - surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION, // BOOT_FINISHED - data, null, 0); - data.recycle(); - if (mWindowManagerDebugger.WMS_DEBUG_ENG) { - Slog.d(TAG, "Tell SurfaceFlinger finish boot animation"); + }*/ + + mH.postDelayed(new Runnable() { + @Override public void run() + { + if(!mBootAnimationStopped){ + SystemProperties.set("service.bootanim.exit", "1"); + mBootAnimationStopped = true; + } + + try { + IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlinger"); + if (surfaceFlinger != null) { + Slog.i(TAG_WM, "******* TELLING SURFACE FLINGER WE ARE BOOTED!"); + Parcel data = Parcel.obtain(); + data.writeInterfaceToken("android.ui.ISurfaceComposer"); + surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION, // BOOT_FINISHED + data, null, 0); + data.recycle(); + if (mWindowManagerDebugger.WMS_DEBUG_ENG) { + Slog.d(TAG, "Tell SurfaceFlinger finish boot animation"); + } + } + } catch (RemoteException ex) { + Slog.e(TAG_WM, "Boot completed: SurfaceFlinger is dead!"); } } - } catch (RemoteException ex) { - Slog.e(TAG_WM, "Boot completed: SurfaceFlinger is dead!"); - } - + }, 3000); EventLog.writeEvent(EventLogTags.WM_BOOT_ANIMATION_DONE, SystemClock.uptimeMillis()); Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, "Stop bootanim", 0); mDisplayEnabled = true; -- 2.29.0