Skip to content

Commit

Permalink
refactor SDK_VERSION_NEW to SDK_VERSION_ANDROID7
Browse files Browse the repository at this point in the history
(cherry picked from commit 414305a)
  • Loading branch information
yimelia committed Dec 26, 2019
1 parent bc3219d commit f86e478
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions airtest/core/android/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from six.moves import reduce

from airtest.core.android.constant import (DEFAULT_ADB_PATH, IP_PATTERN,
SDK_VERISON_NEW)
SDK_VERISON_ANDROID7)
from airtest.core.error import (AdbError, AdbShellError, AirtestError,
DeviceConnectionError)
from airtest.utils.compat import decode_path
Expand Down Expand Up @@ -349,7 +349,7 @@ def shell(self, cmd):
command output
"""
if self.sdk_version < SDK_VERISON_NEW:
if self.sdk_version < SDK_VERISON_ANDROID7:
# for sdk_version < 25, adb shell do not raise error
# https://stackoverflow.com/questions/9379400/adb-error-codes
cmd = split_cmd(cmd) + [";", "echo", "---$?---"]
Expand Down Expand Up @@ -823,7 +823,7 @@ def line_breaker(self):
"""
if not self._line_breaker:
if self.sdk_version >= SDK_VERISON_NEW:
if self.sdk_version >= SDK_VERISON_ANDROID7:
line_breaker = os.linesep
else:
line_breaker = '\r' + os.linesep
Expand Down
4 changes: 2 additions & 2 deletions airtest/core/android/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from airtest.core.device import Device
from airtest.core.android.ime import YosemiteIme
from airtest.core.android.constant import CAP_METHOD, TOUCH_METHOD, IME_METHOD, ORI_METHOD,\
SDK_VERISON_NEW, SDK_VERISON_ANDROID10
SDK_VERISON_ANDROID7, SDK_VERISON_ANDROID10
from airtest.core.android.adb import ADB
from airtest.core.android.minicap import Minicap
from airtest.core.android.minitouch import Minitouch
Expand Down Expand Up @@ -253,7 +253,7 @@ def snapshot(self, filename=None, ensure_orientation=True, quality=10):
if w < h: # 当前是横屏,但是图片是竖的,则旋转,针对sdk<=16的机器
screen = aircv.rotate(screen, self.display_info["orientation"] * 90, clockwise=False)
# adb 截图总是要根据orientation旋转,但是SDK版本大于等于25(Android7.1以后)无需额外旋转
elif self.cap_method == CAP_METHOD.ADBCAP and self.sdk_version <= SDK_VERISON_NEW:
elif self.cap_method == CAP_METHOD.ADBCAP and self.sdk_version <= SDK_VERISON_ANDROID7:
screen = aircv.rotate(screen, self.display_info["orientation"] * 90, clockwise=False)
if filename:
aircv.imwrite(filename, screen, quality)
Expand Down
2 changes: 1 addition & 1 deletion airtest/core/android/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"Linux-armv7l": os.path.join(STATICPATH, "adb", "linux_arm", "adb"),
}
DEFAULT_ADB_SERVER = ('127.0.0.1', 5037)
SDK_VERISON_NEW = 24
SDK_VERISON_ANDROID7 = 24
# Android 10 SDK version
SDK_VERISON_ANDROID10 = 29
DEBUG = True
Expand Down

0 comments on commit f86e478

Please sign in to comment.