Skip to content

Conversation

@d4rken
Copy link
Member

@d4rken d4rken commented Sep 3, 2025

When checking if the Security Center app has PACKAGE_USAGE_STATS permission,
MODE_DEFAULT was incorrectly treated as "permission denied". MODE_DEFAULT actually
means "use default security check" and requires falling back to traditional
permission checking via PackageManager.checkPermission().

For system apps like Security Center on HyperOS/MIUI, the permission might be
granted through manifest declarations even when AppOps returns MODE_DEFAULT.

Changes:

  • Add fallback permission check when MODE_DEFAULT is returned
  • Enhance logging with descriptive mode names for easier debugging
  • Add comprehensive documentation explaining MODE_DEFAULT behavior
  • Only treat MODE_IGNORED and MODE_ERRORED as explicit denials

This should resolve automation failures where users got incorrect "Security Center
missing permission" errors when the permission was actually available.

Closes #1827

When checking if the Security Center app has PACKAGE_USAGE_STATS permission,
MODE_DEFAULT was incorrectly treated as "permission denied". MODE_DEFAULT actually
means "use default security check" and requires falling back to traditional
permission checking via PackageManager.checkPermission().

For system apps like Security Center on HyperOS/MIUI, the permission might be
granted through manifest declarations even when AppOps returns MODE_DEFAULT.

Changes:
- Add fallback permission check when MODE_DEFAULT is returned
- Enhance logging with descriptive mode names for easier debugging
- Add comprehensive documentation explaining MODE_DEFAULT behavior
- Only treat MODE_IGNORED and MODE_ERRORED as explicit denials

This should resolve automation failures where users got incorrect "Security Center
missing permission" errors when the permission was actually available.

Closes #1827
Added comprehensive commit message guidelines to help write better commits:
- Clear format structure with module prefixes
- User-friendly title guidelines for changelog visibility
- Module prefixes for all SD Maid SE cleaning tools
- Examples of good vs bad commit messages
- Technical details best practices

This will ensure future commits have user-friendly titles for changelogs while
keeping technical implementation details in the commit body.
@d4rken d4rken added bug Something isn't working as expected c: AppCleaner Automation Accessibility service related (ACS) ROM: MIUI Xiaomi, Redmi etc. (pre 12-13) ROM: HyperOS Xiaomi, Redmi etc. labels Sep 3, 2025
@d4rken d4rken merged commit cdff54b into main Sep 3, 2025
16 checks passed
@d4rken d4rken deleted the miui-security-appops-usagestats branch September 3, 2025 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Automation Accessibility service related (ACS) bug Something isn't working as expected c: AppCleaner ROM: HyperOS Xiaomi, Redmi etc. ROM: MIUI Xiaomi, Redmi etc. (pre 12-13)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HyperOS/MIUI SecurityCenter app missing GET_USAGE_STATS permission

2 participants