ADFA-3826 Whitelist some StrictMode errors for Mediatek, Xiaomi and MIUI devices#1259
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
app/src/androidTest/kotlin/com/itsaky/androidide/app/strictmode/WhitelistRulesTest.ktapp/src/main/java/com/itsaky/androidide/app/strictmode/WhitelistEngine.kt
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
app/src/androidTest/kotlin/com/itsaky/androidide/app/strictmode/WhitelistRulesTest.ktapp/src/main/java/com/itsaky/androidide/app/strictmode/WhitelistEngine.kt
MTK BoostFwk Util.isGameApp (DiskRead)
MTK AsyncDrawableCache (DiskRead)
MTK AsyncDrawableCache (DiskWrite)