背景:
vip学员群经常会有学员遇到一些常见的android framework开发问题,近期收集整理一些疑问,主要有以下3个:
1、android studio对源码进行导入时候,老是无法跳转到系统source code
2、学员在群里询问dumpOtherProcessesInfoLSP中末尾的LSP含义是啥
3、学员询问分屏过程中请问到底有没有Splash Screen的画面展示,看到有图层,但是没有看到有Icon
下面针对上面3个学员的疑问进行分别解答记录。
问题1:
android studio对源码进行导入时候,老是无法跳转到系统source code
这个问题学员已经按照我之前分享的blog
aosp源码导入android studio常见问题汇总-学员答疑
对相关的android.iml进行了相关的修改,把sourceFolder放到最顶部了
但是发现
最后原因发现是
问题2:
有学员提问ams代码中的dumpOtherProcessesInfoLSP方法尾部的LSP是啥含义
正确解答其实在ActivityManagerService类中本身有对这个LSP等进行解释,其实指的是锁的范围。
frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
/*** The lock for process management.** <p>* This lock is widely used in conjunction with the {@link #mGlobalLock} at present,* where it'll require any of the locks to read from a data class, and both of the locks* to write into that data class.** For the naming convention of function suffixes:* <ul>* <li>-LOSP: Locked with any Of global am Service or Process lock</li>* <li>-LSP: Locked with both of global am Service and Process lock</li>* <li>-Locked: Locked with global am service lock alone</li>* <li>-LPr: Locked with Process lock alone</li>* </ul>* For the simplicity, the getters/setters of the fields in data classes usually don't end with* the above suffixes even if they're guarded by the locks here.* </p>** <p>* In terms of locking order, it should be right below to the {@link #mGlobalLock},* and above everything else which used to be underneath the {@link #mGlobalLock}.* As of today, the core components(services/providers/broadcasts) are still guarded by* the {@link #mGlobalLock} alone, so be cautious, avoid from acquiring the {@link #mGlobalLock}* while holding this lock.* </p>**/final ActivityManagerGlobalLock mProcLock = ENABLE_PROC_LOCK? new ActivityManagerProcLock() : mGlobalLock;
问题3:
学员在学习新版本aosp15的分屏功能时候,使用Winscope分析分屏启动发现有如下不理解的画面:
学员疑问在正常情况下Splash窗口都是有Icon的,这里明显没有看到有Icon,只看到一个背景图,这个是为啥?
这里其实可以通过SplashScreenView相关日志对比看出相关的线索:
正常打开App时候,展示的SplashScreenView的相关打印
01-15 13:43:58.920 816 947 D SplashScreenView: Icon: view: android.widget.ImageView{90f9ece V.ED..... ......I. 0,0-0,0 #1020504 android:id/splashscreen_icon_view} drawable: com.android.wm.shell.startingsurface.SplashscreenIconDrawableFactory$ImmobileIconDrawable@f5d91ef size: 560
可以看出这里有相关的Icon信息,大小是560
分屏情况下的打印:
可以看到size大小是0
01-15 13:44:25.555 816 947 D SplashScreenView: Icon: view: null drawable: null size: 0
调试发现其实在SplashScreenView创建时候会根据mSuggestType来设置icon相关的情况:
调试发现分屏情况下mSuggestType是STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN类型。
/*** Prefer solid color splash screen starting window.* @hide*/public static final int STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN = 3;
更多framework干货学习,请关注下面“千里马学框架”