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;
    
相关推荐
拭心5 小时前
Google 提供的 Android 端上大模型组件:MediaPipe LLM 介绍
android
带电的小王7 小时前
WhisperKit: Android 端测试 Whisper -- Android手机(Qualcomm GPU)部署音频大模型
android·智能手机·whisper·qualcomm
梦想平凡8 小时前
PHP 微信棋牌开发全解析:高级教程
android·数据库·oracle
元争栈道8 小时前
webview和H5来实现的android短视频(短剧)音视频播放依赖控件
android·音视频
阿甘知识库9 小时前
宝塔面板跨服务器数据同步教程:双机备份零停机
android·运维·服务器·备份·同步·宝塔面板·建站
元争栈道10 小时前
webview+H5来实现的android短视频(短剧)音视频播放依赖控件资源
android·音视频
MuYe10 小时前
Android Hook - 动态加载so库
android
居居飒10 小时前
Android学习(四)-Kotlin编程语言-for循环
android·学习·kotlin
Henry_He13 小时前
桌面列表小部件不能点击的问题分析
android
工程师老罗14 小时前
Android笔试面试题AI答之Android基础(1)
android