Android Q 刷机第一次开机黑屏

Android Q 刷机第一次开机黑屏

1、文件路径:
(1) framework/base/services/core/java/com/android/server/wm/RootActivityContainer.java
(2) framework/base/services/core/java/com/android/server/wm/WindowManagerService.java
(3) frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp

2、修改记录如下:

diff --git a/services/core/java/com/android/server/wm/RootActivityContainer.java b/services/core/java/com/android/server/wm/RootActivityContainer.java
index 1194c32..c903f0c 100644
--- a/services/core/java/com/android/server/wm/RootActivityContainer.java
+++ b/services/core/java/com/android/server/wm/RootActivityContainer.java
@@ -95,6 +95,7 @@ import android.os.SystemClock;
 import android.os.Trace;
 import android.os.UserHandle;
 import android.os.storage.StorageManager;
+import android.os.SystemProperties;
 import android.provider.Settings;
 import android.service.voice.IVoiceInteractionSession;
 import android.util.ArraySet;
@@ -401,6 +402,17 @@ public class RootActivityContainer extends ConfigurationContainer
                 aInfo.applicationInfo.uid) + ":" + displayId;
         mService.getActivityStartController().startHomeActivity(homeIntent, aInfo, myReason,
                 displayId);
+        //When the system is turned on for the first time, the boot animation will exit with a 15s delay  for ID1018127
+        Slog.d(TAG," reason " + reason + ", service.bootanim.exit " + SystemProperties.get("service.bootanim.exit"));
+        if(("0".equals(SystemProperties.get("service.bootanim.exit"))) && "noMoreActivities resumeHomeActivity".equals(reason)) {
    
    
+            mService.mUiHandler.postDelayed(new Runnable() {
    
    
+                @Override
+                public void run() {
    
    
+                    Slog.d(TAG," delay 15s bootanim.exit ");
+                    SystemProperties.set("service.bootanim.exit", "1");
+                }
+            }, 20000);
+        }
         return true;
     }


--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -133,6 +133,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManagerInternal;
 import android.content.res.Configuration;
@@ -393,6 +394,7 @@ public class WindowManagerService extends IWindowManager.Stub
 
     private BoostFramework mPerf = null;
 
+     private IPackageManager mPackageManagerService;
     final private KeyguardDisableHandler mKeyguardDisableHandler;
     // TODO: eventually unify all keyguard state in a common place instead of having it spread over
     // AM's KeyguardController and the policy's KeyguardServiceDelegate.
@@ -3313,17 +3315,19 @@ public class WindowManagerService extends IWindowManager.Stub
                     && getDefaultDisplayContentLocked().checkWaitingForWindows()) {
    
    
                 return;
             }
-
             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;
+                Slog.i(TAG,"***************WindowManagerService service.bootanim.exit isFirstBoot " + isFirstBoot());
+                if(!isFirstBoot()) {
    
    
+                    SystemProperties.set("service.bootanim.exit", "1");
+                }
+                    mBootAnimationStopped = true;
             }
 
-            if (!mForceDisplayEnabled && !checkBootAnimationCompleteLocked()) {
    
    
+            if (!isFirstBoot() && !mForceDisplayEnabled && !checkBootAnimationCompleteLocked()) {
    
    
                 if (DEBUG_BOOT) Slog.i(TAG_WM, "performEnableScreen: Waiting for anim complete");
                 return;
             }
@@ -3362,6 +3366,16 @@ public class WindowManagerService extends IWindowManager.Stub
         updateRotationUnchecked(false, false);
     }
 
+    boolean isFirstBoot() {
    
    
+        IPackageManager pm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
+        try {
    
    
+            return pm.isFirstBoot();
+        } catch (RemoteException e) {
    
    
+           e.printStackTrace();
+        }
+        return false;
+    }
+
    
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 139ed19..8c8f6a6 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -628,7 +628,8 @@ void SurfaceFlinger::bootFinished()
     // 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.exit", "1");
+    ALOGI("***************** surfaceflinger");
+    //property_set("service.bootanim.exit", "1");
 
     const int LOGTAG_SF_STOP_BOOTANIM = 60110;

暂做记录,后续增加描述

猜你喜欢

转载自blog.csdn.net/weixin_45080805/article/details/120737733