如何通过命令行从当前APK屏幕查询FLAG_SECURE? [英] How to query FLAG_SECURE from current APK screen via command line?
问题描述
如何查询Android应用程序的当前窗口/活动以检查窗口标记 FLAG_SECURE?
How can I query against the current window/activity of an android app to check window flag FLAG_SECURE? Is this possible using ADB or any other command line tool against an APK?
我的用例是:我想查询设备以查看是否在FLAG_SECURE上启用了FLAG_SECURE。当前屏幕。我无权访问源代码,我只是使用APK作为黑匣子验收测试仪。
My use case is: I would like to query the device to see if FLAG_SECURE is enabled on the current screen. I do not have access to source code, I am just working with an APK as a black box acceptance tester.
请注意,此其他问题类似且未得到回答: Android-窗口标志
Note that this other question is similar and unanswered: Android - Window Flags
推荐答案
您可以通过仅检查窗口中的 mAttr
行来确定某个特定窗口是否设置了 FLAG_SECURE
。 dumpsys窗口< window id>
输出:
You can find out if some specific window has the FLAG_SECURE
set by just checking mAttr
line in the dumpsys window <window id>
output:
~$ dumpsys window com.android.settings | grep ' mAttrs='
mAttrs=WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=1 fl=#85810100 pfl=0x20000 wanim=0x103046a vsysui=0x700 needsMenuKey=2}
fl =
的值是 WindowManager.LayoutParams()。flags
以十六进制表示。 FLAG_SECURE
是一个值为 0x2000
的位掩码。这是在 adb shell
中进行检查的方法:
The fl=
value is the WindowManager.LayoutParams().flags
of that window in hex. FLAG_SECURE
is a bitmask with the value of 0x2000
. This is how you can check it right in the adb shell
:
for f in $(dumpsys window com.android.settings | grep ' mAttrs=' | grep -o ' fl=#[^ ]*'); do [[ $((16#${f#*#}&8192)) -ne 0 ]] && echo 'FLAG_SECURE is set' || echo 'FLAG_SECURE is not set'; done
这篇关于如何通过命令行从当前APK屏幕查询FLAG_SECURE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!