{"record":{"id":"0c1c320d08ec9180","repo":"permissions-dispatcher/PermissionsDispatcher","slug":"method-e-simplestring-defines-permissio","errorCode":null,"errorMessage":"Method '${e.simpleString()}()' defines '$permissionName' with other permissions at the same time.","messagePattern":"Method '(.+?)\\(\\)' defines '\\$permissionName' with other permissions at the same time\\.","errorType":"validation","errorClass":"MixPermissionTypeException","httpStatus":null,"severity":"error","filePath":"processor/src/main/kotlin/permissions/dispatcher/processor/util/Validators.kt","lineNumber":117,"sourceCode":"        }\n        if (numParams < params.size) {\n            throw WrongParametersException(it, numParams, requiredType)\n        }\n        // maximum params size is 1\n        params.forEach { param ->\n            if (!TYPE_UTILS.isSameType(param.asType(), requiredType)) {\n                throw WrongParametersException(it, numParams, requiredType)\n            }\n        }\n    }\n}\n\nfun <A : Annotation> checkMixPermissionType(items: List<ExecutableElement>, annotationClass: Class<A>) {\n    items.forEach {\n        val permissionValue = it.getAnnotation(annotationClass).permissionValue()\n        if (permissionValue.size > 1) {\n            if (permissionValue.contains(WRITE_SETTINGS)) {\n                throw MixPermissionTypeException(it, WRITE_SETTINGS)\n            } else if (permissionValue.contains(SYSTEM_ALERT_WINDOW)) {\n                throw MixPermissionTypeException(it, SYSTEM_ALERT_WINDOW)\n            }\n        }\n    }\n}\n\nfun checkSpecialPermissionsWithNeverAskAgain(items: List<ExecutableElement>, annotationClass: Class<OnNeverAskAgain> = OnNeverAskAgain::class.java) {\n    items.forEach {\n        val permissionValue = it.getAnnotation(annotationClass).permissionValue()\n        if (permissionValue.contains(WRITE_SETTINGS) || permissionValue.contains(SYSTEM_ALERT_WINDOW)) {\n            throw SpecialPermissionsWithNeverAskAgainException()\n        }\n    }\n}\n\nfun checkDuplicatedMethodName(items: List<ExecutableElement>) {\n    items.forEach { item ->","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/permissions-dispatcher/PermissionsDispatcher/blob/74b532bf1fe430fb12ad8414b80399f2d7cfc954/processor/src/main/kotlin/permissions/dispatcher/processor/util/Validators.kt#L99-L135","documentation":"Thrown by checkMixPermissionType in Validators.kt:117 via MixPermissionTypeException. Special permissions WRITE_SETTINGS and SYSTEM_ALERT_WINDOW are granted through Settings screens, not the runtime permission dialog, so they cannot be combined with normal runtime permissions in one @NeedsPermission request; the generated flow cannot handle the mixed grant mechanism.","triggerScenarios":"Declaring @NeedsPermission(Manifest.permission.WRITE_SETTINGS, Manifest.permission.CAMERA) or @NeedsPermission(Manifest.permission.SYSTEM_ALERT_WINDOW, ...) together with any other permission while permissionValue.size > 1.","commonSituations":"Adding a special permission to an existing runtime permission request; misunderstanding that WRITE_SETTINGS/SYSTEM_ALERT_WINDOW need Settings.canDrawOverlays / isWriteSettingsGranted handling; migrating apps that previously requested everything at once.","solutions":["Split into separate methods: one annotated only with the special permission, another with the normal runtime permissions.","Request the special permission via its dedicated flow (ACTION_MANAGE_WRITE_SETTINGS / ACTION_MANAGE_OVERLAY_PERMISSION intents) instead of @NeedsPermission.","Remove the special permission from the combined list if it is not actually required."],"exampleFix":"// before\n@NeedsPermission(Manifest.permission.CAMERA, Manifest.permission.WRITE_SETTINGS)\nfun showCamera() { }\n\n// after\n@NeedsPermission(Manifest.permission.CAMERA)\nfun showCamera() { }\n// handle WRITE_SETTINGS separately via Settings intent flow","handlingStrategy":"validation","validationCode":"val special = setOf(WRITE_SETTINGS, SYSTEM_ALERT_WINDOW)\nrequire(!(requestedPermissions.size > 1 && requestedPermissions.any { it in special })) {\n    \"Special permissions cannot be combined with other permissions\"\n}","typeGuard":null,"tryCatchPattern":"try {\n    build()\n} catch (e: CompilationError) {\n    logger.error(\"Do not mix WRITE_SETTINGS/SYSTEM_ALERT_WINDOW with runtime permissions\", e)\n}","preventionTips":["Request special permissions through Settings-screen flows separately.","Never mix WRITE_SETTINGS or SYSTEM_ALERT_WINDOW into multi-permission lists.","Keep one concern per @NeedsPermission method."],"tags":["kotlin","annotation-processor","permissions"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"74b532bf1fe430fb12ad8414b80399f2d7cfc954","analyzedAt":"2026-09-08T21:44:58.380Z","contentChangedAt":"2026-09-08T21:44:58.380Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}