Android 记录锁屏的上层相关源码以及debug WindowManager

SettingsProvider

  • frameworks/base/packages/SettingsProvider/res/values/defaults.xml

  • device/rockchip/rk356x/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml

    //device的overlay会覆盖frameworks的SettingsProvider
    // 关于锁屏配置
    <integer name="def_screen_off_timeout">0x60000</integer>
    <bool name="def_lockscreen_disabled">false</bool>

KeyGuard

  • frameworks/base/services/core/java/com/android/server/wm/RootWindowContainer.java

    final int type = attrs.type;
    // This function assumes that the contents of the default display are processed first
    // before secondary displays.
    final DisplayContent displayContent = w.getDisplayContent();
    if (displayContent != null && displayContent.isDefaultDisplay) {
    // While a dream or keyguard is showing, obscure ordinary application content on
    // secondary displays (by forcibly enabling mirroring unless there is other content
    // we want to show) but still allow opaque keyguard dialogs to be shown.
    if (w.isDreamWindow() || mWmService.mPolicy.isKeyguardShowing()) {
    mObscureApplicationContentOnSecondaryDisplays = true;
    }
    displayHasContent = true;
    } else if (displayContent != null &&
    (!mObscureApplicationContentOnSecondaryDisplays
    || (obscured && type == TYPE_KEYGUARD_DIALOG))) {
    // Allow full screen keyguard presentation dialogs to be seen.
    displayHasContent = true;
    }
    if ((privateflags & PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE) != 0) {
    mSustainedPerformanceModeCurrent = true;
    }

FallbackHome

  • frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java

    //box:skip FallbackHome to fix 2-3s black screen before launcher.
    if (!"box".equals(SystemProperties.get("ro.target.product"))) {
    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;
    }

              if (!mForceDisplayEnabled && !checkBootAnimationCompleteLocked()) {
                  ProtoLog.i(WM_DEBUG_BOOT, "performEnableScreen: Waiting for anim complete");
                  return;
              }
    
              try {
                  IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlinger");
                  if (surfaceFlinger != null) {
                      ProtoLog.i(WM_ERROR, "******* 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) {
                  ProtoLog.e(WM_ERROR, "Boot completed: SurfaceFlinger is dead!");
              }
          }
    

调试

  • frameworks/base/services/core/java/com/android/server/wm/WindowManagerDebugConfig.java
    打开对应日志打印,来debug WindowManager

      static final String TAG_WM = "WindowManager";
    
      static final boolean DEBUG = false;
      static final boolean DEBUG_ANIM = false;
      static final boolean DEBUG_LAYOUT = false;
      static final boolean DEBUG_LAYERS = false;
      static final boolean DEBUG_INPUT = false;
      static final boolean DEBUG_INPUT_METHOD = false;
      static final boolean DEBUG_VISIBILITY = false;
      static final boolean DEBUG_CONFIGURATION = false;
      static final boolean DEBUG_STARTING_WINDOW_VERBOSE = false;
      static final boolean DEBUG_WALLPAPER = false;
      static final boolean DEBUG_WALLPAPER_LIGHT = false || DEBUG_WALLPAPER;
      static final boolean DEBUG_DRAG = false;
      static final boolean DEBUG_SCREENSHOT = false;
      static final boolean DEBUG_LAYOUT_REPEATS = false;
      static final boolean DEBUG_WINDOW_TRACE = false;
    
相关推荐
秋月霜风42 分钟前
mariadb主从配置步骤
android·adb·mariadb
Python私教2 小时前
Python ORM 框架 SQLModel 快速入门教程
android·java·python
编程乐学3 小时前
基于Android Studio 蜜雪冰城(奶茶饮品点餐)—原创
android·gitee·android studio·大作业·安卓课设·奶茶点餐
problc4 小时前
Android中的引用类型:Weak Reference, Soft Reference, Phantom Reference 和 WeakHashMap
android
IH_LZH4 小时前
Broadcast:Android中实现组件及进程间通信
android·java·android studio·broadcast
去看全世界的云4 小时前
【Android】Handler用法及原理解析
android·java
机器之心4 小时前
o1 带火的 CoT 到底行不行?新论文引发了论战
android·人工智能
机器之心4 小时前
从架构、工艺到能效表现,全面了解 LLM 硬件加速,这篇综述就够了
android·人工智能
AntDreamer5 小时前
在实际开发中,如何根据项目需求调整 RecyclerView 的缓存策略?
android·java·缓存·面试·性能优化·kotlin
运维Z叔6 小时前
云安全 | AWS S3存储桶安全设计缺陷分析
android·网络·网络协议·tcp/ip·安全·云计算·aws