Example #1
0
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)
Example #2
0
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)
Example #3
0
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)