Repository navigation
Android 9〜11でもJobInfo Builderがno constraints例外を投げるためexpo-task-managerのパッチをAPI 28〜30分岐にも拡張 - #5984
Conversation
…のパッチをAPI 28〜30分岐にも拡張
📝 WalkthroughウォークスルーTaskManagerUtils のジョブ構築メソッドにおいて、Android API レベル別の条件分岐で JobInfo 制約検証による crash を回避するために、setImportantWhileForeground() および setExpedited() の単独使用から minimumLatency(0) と overrideDeadline(DEFAULT_OVERRIDE_DEADLINE) を組み合わせたフォールバック設定へ変更しました。 変更内容Android TaskManager ジョブ制約フォールバック修正
コード レビュー見積もり🎯 3 (Moderate) | ⏱️ ~20 分 関連するプルリクエスト
ウサギの詩
🚥 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.
🧹 Nitpick comments (1)
patches/expo-task-manager+55.0.14.patch (1)
5-38: 💤 Low value全分岐で同一のフォールバックを適用: 簡略化の余地あり
現在、3つの分岐(< API 28、API 28-30、API 31+)がすべて同じ
setMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE)を適用しています。条件分岐を削除して統一することも可能ですが、以下の理由から現状のままでも問題ありません:
- 各 API レベルの背景・理由がコメントとして残っており、ドキュメントとしての価値がある
- 将来の Android バージョンで異なる対応が必要になった場合に分岐を追加しやすい
- パッチファイルとして最小限の差分を維持したい場合がある
チームの判断で、必要に応じて将来的にリファクタリングを検討してください。
🤖 Prompt for 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. In `@patches/expo-task-manager`+55.0.14.patch around lines 5 - 38, The three branches in TaskManagerUtils that currently call jobBuilder.setMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE) (the < API 28, the Build.VERSION.SDK_INT < 31 branch where setImportantWhileForeground(true) used to be, and the API 31+ branch where setExpedited(true) used to be) are redundant; collapse the duplicate fallback by applying jobBuilder.setMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE) once (after the version checks) or move it into a shared path so you no longer repeat the same calls in each branch while keeping the version-specific comments and any version-specific calls (setImportantWhileForeground, setExpedited) intact.
🤖 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.
Nitpick comments:
In `@patches/expo-task-manager`+55.0.14.patch:
- Around line 5-38: The three branches in TaskManagerUtils that currently call
jobBuilder.setMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE)
(the < API 28, the Build.VERSION.SDK_INT < 31 branch where
setImportantWhileForeground(true) used to be, and the API 31+ branch where
setExpedited(true) used to be) are redundant; collapse the duplicate fallback by
applying
jobBuilder.setMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE)
once (after the version checks) or move it into a shared path so you no longer
repeat the same calls in each branch while keeping the version-specific comments
and any version-specific calls (setImportantWhileForeground, setExpedited)
intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d73a892c-6eb0-4607-a64b-4918becce94a
📒 Files selected for processing (1)
patches/expo-task-manager+55.0.14.patch
概要
Android 9〜11 (API 28〜30) で
expo-task-managerの JobScheduler 経由のバックグラウンドジョブがJobInfo.Builder.build()でIllegalArgumentException("You're trying to build a job with no constraints, this is not allowed.")を投げてクラッシュする問題を、patches/expo-task-manager+55.0.14.patch の修正範囲を API 28〜30 分岐にも拡張することで回避する。変更の種類
変更内容
patches/expo-task-manager+55.0.14.patchの Android 9〜11 (Build.VERSION.SDK_INT < 31) 分岐に、< API 28分岐と同じsetMinimumLatency(0).setOverrideDeadline(DEFAULT_OVERRIDE_DEADLINE)のフォールバックを追加。setImportantWhileForeground(true)だけではJobInfo.Builderのバリデータが「制約あり」と認識せず例外を投げるため、最低限の制約を必ず1つ付与するようにした。テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Summary by CodeRabbit
リリースノート