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;
    
相关推荐
长亭外的少年3 小时前
Kotlin 编译失败问题及解决方案:从守护进程到 Gradle 配置
android·开发语言·kotlin
建群新人小猿5 小时前
会员等级经验问题
android·开发语言·前端·javascript·php
1024小神7 小时前
tauri2.0版本开发苹果ios和安卓android应用,环境搭建和最后编译为apk
android·ios·tauri
兰琛7 小时前
20241121 android中树结构列表(使用recyclerView实现)
android·gitee
Y多了个想法7 小时前
RK3568 android11 适配敦泰触摸屏 FocalTech-ft5526
android·rk3568·触摸屏·tp·敦泰·focaltech·ft5526
NotesChapter9 小时前
Android吸顶效果,并有着ViewPager左右切换
android
_祝你今天愉快10 小时前
分析android :The binary version of its metadata is 1.8.0, expected version is 1.5.
android
暮志未晚Webgl10 小时前
109. UE5 GAS RPG 实现检查点的存档功能
android·java·ue5
麦田里的守望者江10 小时前
KMP 中的 expect 和 actual 声明
android·ios·kotlin
Dnelic-10 小时前
解决 Android 单元测试 No tests found for given includes:
android·junit·单元测试·问题记录·自学笔记