Repository navigation
Android 16でTaskBroadcastReceiverが落ちる問題を回避するためexpo-task-managerにJobInfo制約を強制するパッチを追加 - #5976
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough(ウォークスルー)
Changes(変更内容)Androidジョブ設定パッチの統合
Estimated code review effort(推定レビュー作業量)🎯 3 (Moderate) | ⏱️ ~25 minutes Poem(詩)
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Line 14: package.json の依存で範囲指定されている expo-task-manager を厳密なバージョン 55.0.14
に固定し("expo-task-manager": "55.0.14" に変更)、postinstall の patch-package
実行時に生成されるパッチ名(expo-task-manager+55.0.14.patch)と一致させてください;将来バージョンを上げる際はパッチを更新して依存も明示的に差し替える運用ルールを守ること(postinstall
のままでも可、ただし依存の範囲指定は使わないこと)。
In `@patches/expo-task-manager`+55.0.14.patch:
- Around line 11-20: The code currently replaces setExpedited(true) with
jobBuilder.setMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE)
for all API 31+ which is overly broad; change the guard so the fallback to
minimum-latency+override-deadline only runs for SDK_INT >= 36 (i.e., limit to
Android 14+/16 specific case) or alternatively invoke setExpedited(true) and
catch IllegalArgumentException from JobInfo.Builder.build() and only then apply
jobBuilder.setMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE);
keep references to setExpedited, jobBuilder, DEFAULT_OVERRIDE_DEADLINE and
Build.VERSION.SDK_INT when making the conditional or exception-based fallback.
🪄 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: 29aebb03-60f0-4f7e-bb7b-f658176c6ec1
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
package.jsonpatches/expo-task-manager+55.0.14.patch
概要
Android 16 (API 36) でフォアグラウンド復帰時に
expo.modules.taskManager.TaskBroadcastReceiverがIllegalArgumentException: You're trying to build a job with no constraints, this is not allowed.で落ち、アプリプロセスが強制終了される問題を回避するため、[email protected]のTaskManagerUtils.createJobInfoに patch-package で JobScheduler の制約を必ず付与するパッチを当てる。upstream(
expo/expomain /sdk-55)の最新ソースおよび CHANGELOG を確認したが、本症状を解消する修正は入っていないため、当面は patch-package で対応する。変更の種類
変更内容
patches/expo-task-manager+55.0.14.patchを新規追加。TaskManagerUtils.createJobInfoの API 31+ 分岐をsetExpedited(true)単独からsetMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE)に置換し、JobScheduler の build-time バリデーション(早期/遅延/機能制約のいずれかが必須)を満たすようにしたpackage.jsonの devDependencies にpatch-package@^8.0.1を追加し、postinstall: patch-packageスクリプトを追記してnpm install時にパッチが自動適用されるようにしたpackage-lock.jsonをpatch-package追加に伴って更新なぜ expedited を捨てるのか
setOverrideDeadline) は expedited 属性と排他のため両立不可NEEDS_JOBSCHEDULER_BYPASSでLocation.watchPositionAsyncの直接コールバックを併用しており (src/hooks/useStartBackgroundLocationUpdates.ts)、JobScheduler 経路の優先度が落ちても位置更新の即時性は維持されるテスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ることnpm installを実行するとpostinstallフックで[email protected] ✔のパッチ適用ログが出ることをローカルで確認済み。Jest は 154 suites / 1541 tests がすべて pass。実機 Android 16 端末でフォアグラウンド復帰時のクラッシュが再発しないことの確認は手元では実施できていないため、レビュー後にデバイス検証が必要。
関連Issue
スクリーンショット(任意)
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
Chores
メンテナンス