Skip to content

Commit

Permalink
Merge pull request #30 from zhangyiming07/feature/modify_screenshot
Browse files Browse the repository at this point in the history
支持sdk版本>=29的截图方式
  • Loading branch information
drunkdream authored Apr 16, 2021
2 parents fe94c82 + 74dc65d commit ece3f3c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/mainframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def _take_screen_shot(self, tmp_path, path, use_cmd=True):
if use_cmd:
self._device.adb.run_shell_cmd('screencap %s' % tmp_path, True)
self._device.adb.run_shell_cmd('chmod 444 %s' % tmp_path, True)
self._device.pull_file(tmp_path, path)
self._device.adb.pull_file(tmp_path, path)
else:
self._device.take_screen_shot(path, 10)

Expand All @@ -462,7 +462,9 @@ def _refresh_device_screenshot(self, use_cmd=False):
path = os.path.join(os.path.abspath(os.curdir), 'screen.png')
# Log.d('Screenshot', path)
tmp_path = '/data/local/tmp/screen.png'


if self._device.adb.get_sdk_version() >= 29:
use_cmd = True
try:
self._take_screen_shot(tmp_path, path, use_cmd)
except:
Expand Down

0 comments on commit ece3f3c

Please sign in to comment.