Skip to content

ADFA-3826 Whitelist some StrictMode errors for Mediatek, Xiaomi and MIUI devices#1259

Merged
hal-eisen-adfa merged 4 commits intostagefrom
ADFA-3826-StrictMode-violations-pre-permissions
Apr 28, 2026
Merged

ADFA-3826 Whitelist some StrictMode errors for Mediatek, Xiaomi and MIUI devices#1259
hal-eisen-adfa merged 4 commits intostagefrom
ADFA-3826-StrictMode-violations-pre-permissions

Conversation

@hal-eisen-adfa
Copy link
Copy Markdown
Collaborator

MTK BoostFwk Util.isGameApp (DiskRead)
MTK AsyncDrawableCache (DiskRead)
MTK AsyncDrawableCache (DiskWrite)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

Warning

Rate limit exceeded

@hal-eisen-adfa has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 32 minutes and 13 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 26aace92-c414-4b1f-8e3c-e8f67eabe481

📥 Commits

Reviewing files that changed from the base of the PR and between d6231d4 and 1eb825a.

📒 Files selected for processing (2)
  • app/src/androidTest/kotlin/com/itsaky/androidide/app/strictmode/WhitelistRulesTest.kt
  • app/src/main/java/com/itsaky/androidide/app/strictmode/WhitelistEngine.kt
📝 Walkthrough

Walkthrough

Adds three MediaTek-focused StrictMode whitelist rules (two DiskRead, one DiskWrite) and four corresponding Android instrumentation tests extending WhitelistRulesTest to cover DiskRead/DiskWrite stack-frame patterns for BoostFwk and AsyncDrawableCache scenarios.

Changes

Cohort / File(s) Summary
Whitelist rules (engine)
app/src/main/java/com/itsaky/androidide/app/strictmode/WhitelistEngine.kt
Added three new whitelist rules: two DiskReadViolation patterns (MediaTek BoostFwk is-game-app check; AsyncDrawableCache cache-list population including an Os.stat variant) and one DiskWriteViolation pattern for AsyncDrawableCache preference-file writes.
Whitelist tests
app/src/androidTest/kotlin/com/itsaky/androidide/app/strictmode/WhitelistRulesTest.kt
Added four test methods and import: allow_DiskRead_on_MtkBoostFwkIsGameApp(), allow_DiskRead_on_MtkAsyncDrawableCachePutCacheList(), allow_DiskRead_on_MtkAsyncDrawableCachePutCacheList_OsStatVariant(), and allow_DiskWrite_on_MtkAsyncDrawableCachePutCacheList(); imported android.os.strictmode.DiskWriteViolation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • itsaky-adfa
  • jomen-adfa
  • Daniel-ADFA

Poem

🐰 I nibble stack traces late at night,
Adding hops where disk reads take flight,
BoostFwk and AsyncDrawable now cheer,
Reads and writes get a carrot-ear,
A tiny rabbit guards the whitelist bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: whitelisting StrictMode errors for Mediatek devices, which matches the file modifications adding whitelist rules.
Description check ✅ Passed The description lists the three specific StrictMode violations being whitelisted (MTK BoostFwk, MTK AsyncDrawableCache DiskRead, MTK AsyncDrawableCache DiskWrite), which directly relate to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ADFA-3826-StrictMode-violations-pre-permissions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/main/java/com/itsaky/androidide/app/strictmode/WhitelistEngine.kt`:
- Around line 245-279: The DiskReadViolation whitelist for AsyncDrawableCache is
too loose because it only matches the vendor frames; tighten it by anchoring the
rule to the actual disk-access stack frame. Update the DiskReadViolation rule
(the block with ofType<DiskReadViolation>() and matchAdjacentFrames(..) for
com.mediatek.res.AsyncDrawableCache.storeDrawableId / putCacheList /
ResOptExtImpl.putCacheList) to also require the real filesystem access frame,
e.g., add an adjacent frame like classAndMethod("java.io.FileInputStream",
"<init>") or classAndMethod("java.io.RandomAccessFile", "<init>") (or
java.io.FileInputStream/FileOutputStream constructors) so the whitelist only
matches when the vendor frames are immediately adjacent to the disk-access
frame.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 789ac15e-2f4f-4e24-847b-7aa9ada13514

📥 Commits

Reviewing files that changed from the base of the PR and between cc9270a and eb63891.

📒 Files selected for processing (2)
  • app/src/androidTest/kotlin/com/itsaky/androidide/app/strictmode/WhitelistRulesTest.kt
  • app/src/main/java/com/itsaky/androidide/app/strictmode/WhitelistEngine.kt

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/main/java/com/itsaky/androidide/app/strictmode/WhitelistEngine.kt`:
- Around line 280-296: The DiskWriteViolation whitelist rule is too broad
because matchAdjacentFrames only matches vendor methods; tighten it by requiring
concrete write-path frames adjacent to the vendor chain. Update the rule that
references DiskWriteViolation / matchAdjacentFrames to include additional frame
matchers for the actual write APIs (e.g.,
classAndMethod("java.io.FileOutputStream", "<init>" or "write"),
classAndMethod("android.app.SharedPreferencesImpl", "writeToFile"), and
classAndMethod("android.app.SharedPreferences$EditorImpl" or "EditorImpl",
"commit")) alongside the existing com.mediatek.* entries so the rule only allows
the vendor chain when a concrete write-frame appears adjacent. Ensure these new
classAndMethod entries are included in the same matchAdjacentFrames call for the
rule.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 53e51e22-14cc-40cf-ab5c-455efdaca786

📥 Commits

Reviewing files that changed from the base of the PR and between eb63891 and d6231d4.

📒 Files selected for processing (2)
  • app/src/androidTest/kotlin/com/itsaky/androidide/app/strictmode/WhitelistRulesTest.kt
  • app/src/main/java/com/itsaky/androidide/app/strictmode/WhitelistEngine.kt

@hal-eisen-adfa hal-eisen-adfa merged commit 49121e4 into stage Apr 28, 2026
2 checks passed
@hal-eisen-adfa hal-eisen-adfa deleted the ADFA-3826-StrictMode-violations-pre-permissions branch April 28, 2026 19:24
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.

2 participants