簡體   English   中英

具有root用戶的Android屏幕捕獲(服務或后台線程)

[英]Android screen capture with root (service or background thread )

鯊魚安卓手機時有一個應用程序捕獲屏幕。

1)當應用程序處於活動狀態時,捕獲屏幕而沒有root。

2)當應用返回堆棧時,例如返回HOME,需要root權限才能捕獲屏幕。

我想知道以root權限實現功能2)。

在我看來,root權限意味着獲得root shell,刷新一些命令和exec。 所以我混淆了如何在shell命令中捕獲屏幕。

如果您具有root或什至shell權限,則可以使用screenshot或screencap命令作為參考:

root@android:/system/bin # screenshot -h                                   
unknown option -- husage: screenshot [-s soundfile] filename.png
   -s: play a sound effect to signal success
   -i: autoincrement to avoid overwriting filename.png

root@android:/system/bin # screencap -h                                      
    usage: screencap [-hp] [-d display-id] [FILENAME]
       -h: this message
       -p: save the file as a png.
       -d: specify the display id to capture, default 0.
    If FILENAME ends with .png it will be saved as a png.
    If FILENAME is not given, the results will be printed to stdout.

如果您的設備沒有本機上的這些程序,則只需自己編寫一個即可。 源代碼在這里: https : //android.googlesource.com/platform/frameworks/base/+/master/cmds/screencap/screencap.cpp

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM