Skip to content
Agentmart
Submit a tool

android-permission-detection-bugs

Fix permission detection loops in Android monitoring apps.

Skill by harezadmm

IndexedMIT★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/harezadmm-android-permission-detection-bugs

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Fix permission detection loops in Android monitoring apps.

Use cases: security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/android-permission-detection-bugs

What's inside

Skill name
android-permission-detection-bugs
Description
Fix permission detection loops in Android monitoring apps.
License
MIT
Instructions
326 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Android Permission Detection Bugs

Common runtime bugs in Android apps that implement multi-step permission flows (RATs, spyware, monitoring apps, parental controls, accessibility tools). These bugs cause infinite permission request loops even when user has already granted the permission.

## When to Use This Skill

Trigger when:
- User reports "app stuck asking for permission even though it's enabled"
- Accessibility Service / Notification Listener / Device Admin permission loops
- Permission flow never advances to next step despite user enabling permission
- `checkSpecialPermissions()` keeps calling `startActivityForResult(Settings.ACTION_ACCESSIBILITY_SETTINGS)`
- Testing shows permission is ON but app detection returns false

## Bug #1: Accessibility Service Detection Loop

**Symptom:** App terus minta enable Accessibility Service padahal udah ON di Settings.

**Root Cause:** Simple `.contains()` check gagal handle Android's service name format variants.

### Broken Pattern (DO NOT USE)

```kotlin
private fun isAccessibilityServiceEnabled(): Boolean {
    val service = "${packageName}/.AppBlockerService"
    val enabledServices = Settings.Secure.getString(
        contentResolver,
        Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES
    )
    return enabledServices?.contains(service) == true
}
```

**Why it fails:**
- Android returns enabled services as **colon-separated string**: `com.app1/.Service:com.app2/.Service`
- Format bisa `com.sync.xxx/.AppBlockerService` (short form)
- OR `com.sync.xxx/com.sync.xxx.AppBlockerService` (full package path)
- `.contains()` only matches EXACT substring → fails on format variation
- User enables service → function still returns false → infinite loop

### Working Pattern (ALWAYS USE THIS)

```kotlin
private fun isAccessibilityServiceEnabled(): Boolean {
    val enabledServices = Settings.Secure.getString(
        contentResolver,
        Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES
    ) ?: return false
    
    val component = "${packageName}/.AppBlockerService"
    val componentFull = "${packageName}/${packageName}.AppBlockerService"
    
    return enabledServices.split(":").any { svc ->
        svc.equals(component, ignoreCase = true) ||
        svc.equals(componentFull, ignoreCase = true)
    }
}
```

**Why it works:**
- **Split by colon** → properly parse multiple services
- **Check both formats** → handle short AND full package path
- **Case-insensitive** → handle Android system case variations
- **Null-safe** → return false immediately if no services enabled
- **Exact match per service** → avoids false positives from substring overlap

### Debugging

Add logging to see raw Android system values:

```kotlin
val enabled = Settings.Secure.getString(
    contentResolver,
    Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES
)
Log.d("PermissionDebug", "Raw enabled services: $enabled")
Log.d("PermissionDebug", "Detection result: ${isAccessibilityServiceEnabled()}")
Log.d("PermissionDebug", "Expected short: ${packageName}/.AppBlockerService")
Log.d("PermissionDebug", "Expected full: ${packageName}/${packageName}.AppBlockerService")
```

Expected log after user enables service:
```
Raw enabled services: com.sync.xxx/.AppBlockerService
Detection result: true
```

OR:
```
Raw enabled services: com.sync.xxx/com.sync.xxx.AppBlockerService
Detection result: true
```

If detection still returns false → logic error in split/comparison.

## Bug #2: Notification Listener Detection

**Same root cause** — simple `.contains()` fails on ComponentName format.

### Broken Pattern

```kotlin
private fun isNotificationListenerEnabled(): Boolean {
    val listeners = Settings.Secure.getString(
        contentResolver,
        "enabled_notification_listeners"
    )
    return listeners?.contains(packageName) == true
}
```

**Problem:** `packageName` might match SUBSTRING of other app's package. False positive risk.

### Working Pattern

```kotlin
private fun isNotificationListenerEnabled(): Boolean {
    val listeners = Settings.Secure.getString(
        contentResolver,
        "enabled_notification_listeners"

From harezadmm/omp-enhanced, MIT.

Signals

Stars
2
Forks
4
Open issues
0
Last commit (this folder)
Sep 21, 2026 (1 month ago)
Last release
Sep 6, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from harezadmm

Cite this page

android-permission-detection-bugs skill. Agent Mart. https://agentmart.dev/skills/harezadmm-android-permission-detection-bugs (last updated 2026-10-24)