今天再来水两篇文章:来说说如何去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 .