How To Query Flag_secure From Current Apk Screen Via Command Line?
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? My
Solution 1:
Whether or not any secure layers are currently visible regardless of the specific window can be found by running this command:
adb shell "dumpsys SurfaceFlinger | grep -o secureVis=. | cut -d= -f2"
which will return the value of 0
for no secure layers visible, or 1
for some secure layers are visible.
isSecure
may seem like the more appropriate value, but it is not. It always shows 1
for some reason, possibly just saying that the device supports secure pages in general.
Solution 2:
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}
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
Post a Comment for "How To Query Flag_secure From Current Apk Screen Via Command Line?"