def _grant_requested_permissions(self):
        dumpsys_output = self.device.execute(command="dumpsys package {}".format(self.package))
        permissions = []
        lines = iter(dumpsys_output.splitlines())
        for line in lines:
            if "requested permissions:" in line:
                break

        for line in lines:
            if "android.permission." in line:
                permissions.append(line.split(":")[0].strip())
            else:
                break

        for permission in permissions:
            # "Normal" Permisions are automatically granted and cannot be changed
            permission_name = permission.rsplit('.', 1)[1]
            if permission_name not in ANDROID_NORMAL_PERMISSIONS:
                self.device.execute("pm grant {} {}".format(self.package, permission))
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/common/android/workload.py/ApkWorkload._grant_requested_permissions/original