当前位置: 首页>>代码示例>>Python>>正文


Python DeviceManagerADB.default_timeout方法代码示例

本文整理汇总了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)
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:21,代码来源:android_device.py

示例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)
开发者ID:nwgh,项目名称:gecko-dev,代码行数:23,代码来源:android_device.py


注:本文中的mozdevice.DeviceManagerADB.default_timeout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。