Skip to content

fix(android): correct legacy mock detection and avoid redundant lookups - #366

Open
OskarEichler wants to merge 1 commit into
GantMan:masterfrom
OskarEichler:codex/android-check-efficiency
Open

fix(android): correct legacy mock detection and avoid redundant lookups#366
OskarEichler wants to merge 1 commit into
GantMan:masterfrom
OskarEichler:codex/android-check-efficiency

Conversation

@OskarEichler

Copy link
Copy Markdown

Fixes and reductions

  • Correct pre-Android-6 mock-location detection: setting "1" means enabled; "0" and absent settings are false. The previous comparison inverted enabled/disabled.
  • Reuse one immutable hash set for hook-package membership instead of rebuilding the array and list wrappers for every installed application. Keep every detection identifier unchanged.
  • Do not request application metadata that neither scanner consumes.
  • Skip our own/calendar ignore-list packages before requesting their permissions.
  • Read the authoritative ADB setting once and return the comparison directly; remove the duplicate deprecated settings read and per-call log.

Compatibility

No permission, visibility scope, public signature, or detection list is added/removed. Pre-23 mock-location results intentionally change to the correct enabled/disabled meaning. ADB diagnostic logging is removed; the return value is unchanged.

Verification

An inline JavaCompiler harness compiles and executes the actual source with instrumented Android stubs: null/0/1 changes from false/true/false to false/false/true; ADB settings reads drop from two to one; the representative four-app scan performs one permission lookup instead of four. Positive/negative mock and hook cases pass, and all 23 unique suspicious package names remain detectable. No app-wide latency benchmark or device-detection guarantee is claimed.

Type declarations and whitespace checks pass. Combined consumer fixes on RN 0.87.1: both Android Debug flavors, both iOS simulator Debug schemes, and four release-mode Metro bundles pass. No test files changed. The upstream test command is only a placeholder; no old Android physical-device run was performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant