https://blog.csdn.net/dpppppp/article/details/81941550
https://blog.csdn.net/kongbaidepao/article/details/81412926
描述:开机进入到keyguard的时候会有2s的黑屏。
调试,在关键地方加入log:
01-01 14:05:15.535 2612 2612 I WindowManager: Tim_Boot systemReady bindKeyguardNow=false
01-01 14:05:17.388 4282 4282 D FallbackHome: Tim_Boot FallBackHome onCreate mProvisioned=true
01-01 14:05:17.413 4282 4282 D FallbackHome: Tim_Boot FallBackHome maybeFinish isUserUnlocked=false
01-01 14:05:17.421 4282 4282 D FallbackHome: Tim_Boot FallBackHome onResume=true
01-01 14:05:17.635 2612 2797 I WindowManager: Tim_Boot systemBooted bindKeyguardNow=true
01-01 14:05:19.152 2612 3011 I WindowManager: Tim_Boot performEnableScreen: Waiting for anim complete not return
01-01 14:05:19.157 2612 3011 I WindowManager: Tim_Boot performEnableScreen: Waiting for anim complete not return
01-01 14:05:19.158 2612 3011 I WindowManager: Tim_Boot performEnableScreen: Waiting for anim complete not return
01-01 14:05:19.167 2612 3011 I WindowManager: Tim_Boot performEnableScreen: Waiting for anim complete not return
01-01 14:05:19.369 2612 3011 I WindowManager: Tim_Boot performEnableScreen: mDisplayEnabled=true mForceDisplayEnabled=false mShowingBootMessages=false mSystemBooted=true mOnlyCore=false mBootAnimationStopped=true
01-01 14:05:19.468 2612 3011 D ActivityManager: Tim_Boot Finishing user boot 0
01-01 14:05:19.471 2612 3011 W ActivityManager: Tim_Boot finishUserUnlocking userId=0
01-01 14:05:21.262 2612 2797 W ActivityManager: Tim_Boot ACTION_USER_UNLOCKED was sent
01-01 14:05:21.264 2612 2797 W ActivityManager: Tim_Boot service.bootanim.exit set 1,exit bootanimation
01-01 14:05:21.323 4282 4282 D FallbackHome: Tim_Boot FallBackHome BroadcastReceiver received
01-01 14:05:21.411 4282 4282 D FallbackHome: Tim_Boot FallBackHome maybeFinish isUserUnlocked=true
01-01 14:05:21.426 4282 4282 D FallbackHome: Tim_Boot User unlocked and real home found; let's go!
01-01 14:05:21.507 4282 4282 D FallbackHome: Tim_Boot FallBackHome onPause=true
01-01 14:05:23.072 4282 4282 D FallbackHome: Tim_Boot FallBackHome onDestroy=true
开机的时候有一个解锁的过程,只有解锁完后手机才能正常使用。
X:\msm8976-LA.BR.1.3.6.c2-01420\frameworks\native\services\surfaceflinger\SurfaceFlinger_hwc1.cpp
void SurfaceFlinger::bootFinished()
{
const nsecs_t now = systemTime();
const nsecs_t duration = now - mBootTime;
ALOGI("Tim_Boot Boot is finished (%ld ms)", long(ns2ms(duration)) );
mBootFinished = true;
// wait patiently for the window manager death
const String16 name("window");
sp
if (window != 0) {
window->linkToDeath(static_cast
}
// 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.
//property_set("service.bootanim.exitfake", "1");
property_set("service.bootanim.exit", "1");
const int LOGTAG_SF_STOP_BOOTANIM = 60110;
LOG_EVENT_LONG(LOGTAG_SF_STOP_BOOTANIM,
ns2ms(systemTime(SYSTEM_TIME_MONOTONIC)));
}
frameworks\base\cmds\bootanimation\BootAnimation.cpp
void BootAnimation::checkExit() {
// Allow surface flinger to gracefully request shutdown
char value[PROPERTY_VALUE_MAX];
property_get(EXIT_PROP_NAME, value, "0");
int exitnow = atoi(value);
if (exitnow) {
requestExit();
}
}
解决方案一,增加适当的延迟关闭动画,此方法没有找到问题根源。
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 149d1dc..fb38c1f
--- a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -75,6 +75,7 @@ import android.os.SystemService;
import android.os.Trace;
import android.os.UserHandle;
import android.os.WorkSource;
+import android.os.UserManager;
import android.provider.Settings;
import android.util.ArraySet;
import android.util.DisplayMetrics;
@@ -6063,12 +6064,6 @@ public class WindowManagerService extends IWindowManager.Stub
public void performEnableScreen() {
synchronized(mWindowMap) {
if (mDisplayEnabled) {
return;
}
@@ -6081,28 +6076,33 @@ public class WindowManagerService extends IWindowManager.Stub
return;
}
- if (!mBootAnimationStopped) {
- // Do this one time.
- Trace.asyncTraceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "Stop bootanim", 0);
- 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();
- }
- } catch (RemoteException ex) {
- Slog.e(TAG_WM, "Boot completed: SurfaceFlinger is dead!");
- }
- mBootAnimationStopped = true;
- }
+ if (!mBootAnimationStopped) {
+ // Do this one time.
+ Trace.asyncTraceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "Stop bootanim", 0);
+ mH.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ 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();
+ }
+ } catch (RemoteException ex) {
+ Slog.e(TAG_WM, "Boot completed: SurfaceFlinger is dead!");
+ }
+ }
+ },5000);
+ mBootAnimationStopped = true;
+ }
if (!mForceDisplayEnabled && !checkBootAnimationCompleteLocked()) {
- if (DEBUG_BOOT) Slog.i(TAG_WM, "performEnableScreen: Waiting for anim complete");
- return;
+ if (DEBUG_BOOT) Slog.i(TAG_WM, "Tim_Boot performEnableScreen: Waiting for anim complete not return");
+ //return;
}
EventLog.writeEvent(EventLogTags.WM_BOOT_ANIMATION_DONE, SystemClock.uptimeMillis());