android 系统如何优雅的debug调试overlay

今天再来水两篇文章:来说说如何去debug overlay,什么是overlay 就不用我说了。命令很简单,adb shell 下执行cmd overlay.

:/ # cmd overlay
Overlay manager (overlay) commands:
  help
    Print this help text.
  dump [--verbose] [--user USER_ID] [[FIELD] PACKAGE]  (打出所有overlay 的包和被overlay的包以及状态)
    Print debugging information about the overlay manager.
    With optional parameter PACKAGE, limit output to the specified
    package. With optional parameter FIELD, limit output to
    the value of that SettingsItem field. Field names are
    case insensitive and out.println the m prefix can be omitted,
    so the following are equivalent: mState, mstate, State, state.
  list [--user USER_ID] [PACKAGE]
    Print information about target and overlay packages.
    Overlay packages are printed in priority order. With optional
    parameter PACKAGE, limit output to the specified package.
  enable [--user USER_ID] PACKAGE   (设置overlay生效)
    Enable overlay package PACKAGE.
  disable [--user USER_ID] PACKAGE(设置overlay不生效)
    Disable overlay package PACKAGE.
  enable-exclusive [--user USER_ID] [--category] PACKAGE(设置overlay生效)
    Enable overlay package PACKAGE and disable all other overlays for
    its target package. If the --category option is given, only disables
    other overlays in the same category.
  set-priority [--user USER_ID] PACKAGE PARENT|lowest|highest(设置overlay优先级,一个apk可以有多个overlay)
    Change the priority of the overlay PACKAGE to be just higher than
    the priority of PACKAGE_PARENT If PARENT is the special keyword
    'lowest', change priority of PACKAGE to the lowest priority.
    If PARENT is the special keyword 'highest', change priority of
    PACKAGE to the highest priority.
  lookup [--verbose] PACKAGE-TO-LOAD PACKAGE:TYPE/NAME (打印具体某个包下面overlay 的值。)
    Load a package and print the value of a given resource
    applying the current configuration and enabled overlays.
    For a more fine-grained alernative, use 'idmap2 lookup'.

对了,上面说的overlay 都是运行时overlay .

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Android overlay是一种在Android应用程序中实现界面定制化的技术。通过使用overlay,开发者可以在不修改原始应用程序代码的情况下,添加、修改或替换应用程序的布局、样式和资源。在Android中,overlay通常是通过创建一个新的AndroidManifest.xml文件来实现的。\[1\] 在创建AndroidManifest.xml文件时,需要指定overlay的优先级、是否静态以及目标包名。优先级决定了overlay的显示顺序,静态表示overlay在运行时不会被修改,目标包名指定了要进行定制化的应用程序。\[1\] 除了创建AndroidManifest.xml文件,还可以参考一些相关的资料来了解更多关于Android overlay的信息。例如,可以参考http://mmmyddd.github.io/wiki/android/overlay.html和https://developer.sonymobile.com/2014/04/22/sony-contributes-runtime-resource-overlay-framework-to-android-code-example/。\[2\] 在编译后生成的apk中,overlay的路径可以根据不同的方案进行调整。一种常见的路径是vendor/overlay/TestOverlay/TestOverlay.apk,可以通过设置LOCAL_MODULE_PATH来指定路径。\[3\] #### 引用[.reference_title] - *1* *3* [Android Overlay机制](https://blog.csdn.net/weixin_44021334/article/details/130421043)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Android overlay简单总结](https://blog.csdn.net/Dylan_Sen/article/details/78878641)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

假装多好123

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值