本文整理汇总了Python中mozdevice.DeviceManagerADB.default_timeout方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManagerADB.default_timeout方法的具体用法?Python DeviceManagerADB.default_timeout怎么用?Python DeviceManagerADB.default_timeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozdevice.DeviceManagerADB
的用法示例。
在下文中一共展示了DeviceManagerADB.default_timeout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: grant_runtime_permissions
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import default_timeout [as 别名]
def grant_runtime_permissions(build_obj, app):
"""
Grant required runtime permissions to the specified app (typically org.mozilla.fennec_$USER).
"""
adb_path = _find_sdk_exe(build_obj.substs, 'adb', False)
if not adb_path:
adb_path = 'adb'
dm = DeviceManagerADB(autoconnect=False, adbPath=adb_path, retryLimit=1)
dm.default_timeout = 10
try:
sdk_level = dm.shellCheckOutput(['getprop', 'ro.build.version.sdk'])
if sdk_level and int(sdk_level) >= 23:
_log_info("Granting important runtime permissions to %s" % app)
dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.WRITE_EXTERNAL_STORAGE'])
dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.ACCESS_FINE_LOCATION'])
dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.CAMERA'])
dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.WRITE_CONTACTS'])
except DMError:
_log_warning("Unable to grant runtime permissions to %s" % app)
示例2: grant_runtime_permissions
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import default_timeout [as 别名]
def grant_runtime_permissions(build_obj):
"""
Grant required runtime permissions to the specified app (typically org.mozilla.fennec_$USER).
"""
app = build_obj.substs["ANDROID_PACKAGE_NAME"]
adb_path = _find_sdk_exe(build_obj.substs, "adb", False)
if not adb_path:
adb_path = "adb"
dm = DeviceManagerADB(autoconnect=False, adbPath=adb_path, retryLimit=1)
dm.default_timeout = 10
try:
sdk_level = dm.shellCheckOutput(["getprop", "ro.build.version.sdk"])
if sdk_level and int(sdk_level) >= 23:
_log_info("Granting important runtime permissions to %s" % app)
dm.shellCheckOutput(["pm", "grant", app, "android.permission.WRITE_EXTERNAL_STORAGE"])
dm.shellCheckOutput(["pm", "grant", app, "android.permission.READ_EXTERNAL_STORAGE"])
dm.shellCheckOutput(["pm", "grant", app, "android.permission.ACCESS_FINE_LOCATION"])
dm.shellCheckOutput(["pm", "grant", app, "android.permission.CAMERA"])
dm.shellCheckOutput(["pm", "grant", app, "android.permission.WRITE_CONTACTS"])
except DMError:
_log_warning("Unable to grant runtime permissions to %s" % app)