Add BluetoothManagerServiceDiskRead violation rules#7013
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new StrictMode ignore rule to suppress a known OEM/system Bluetooth service disk-read violation that propagates back to the app via Binder.
Changes:
- Register a new thread-policy ignore rule for
BluetoothManagerServicedisk reads on affected OEM ROMs. - Implement stack-trace matching logic for the Bluetooth service violation.
| /** | ||
| * Ignore a [DiskReadViolation] in the system Bluetooth service (`BluetoothManagerService`). | ||
| * | ||
| * On some OEM ROMs (observed on Samsung, methods `isSpeg`/`isSpegInWorking`), registering a Bluetooth adapter | ||
| * performs an internal `File.exists()` check while handling the `registerAdapter` binder transaction. The | ||
| * StrictMode thread policy propagates across the binder call, so the disk read is reported back to the app even | ||
| * though it happens inside the system service and is beyond application control. | ||
| */ | ||
| private data object IgnoreSamsungBluetoothManagerServiceDiskRead : IgnoreViolationRule { | ||
| @RequiresApi(Build.VERSION_CODES.P) | ||
| override fun shouldIgnore(violation: Violation): Boolean { | ||
| if (violation !is DiskReadViolation) return false | ||
|
|
||
| return violation.stackTrace.any { | ||
| it.className == "com.android.server.bluetooth.BluetoothManagerService" && | ||
| it.methodName == "isSpeg" | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Hi @oungsi2000
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Head branch was pushed to by a user without write access
9f6273f to
ca4474c
Compare
|
@TimoPtr There was a timing conflict. I pushed to my branch around the same time you did, so things got a bit tangled up. I removed my commit and force-pushed to fix it. Could you check and re-enable auto-merge? I'm sorry about that |
|
@TimoPtr this commit ended up with two Pull Request workflow runs. The deferred pr-emulator-wtf.yml posts these checks via the API, which absorbed them into the older suite (74140666250), while the merge box keys off the newer suite (74144090394) Could you admin-merge or bypass, since a re-push would just force another ui-test environment approval for a cosmetic matching issue? |
Summary
This PR fixes #7012.
On some OEM ROMs (observed on Samsung via obfuscated isSpeg/isSpegInWorking methods), the registerAdapter binder call internally performs a File.exists() disk read. Since this path was not on the StrictMode ignore list, it triggered a FailFast violation, crashing the app on startup.
Checklist