Commit 6a52988
committed
Fix: Add RECEIVER_NOT_EXPORTED flag for BroadcastReceiver registration
Addresses a SecurityException crash on Android 13 (API 33) and higher when programmatically registering a BroadcastReceiver in PhotoReasoningViewModel.
The init block in PhotoReasoningViewModel, which registers `aiResultReceiver` to listen for AI call results from ScreenCaptureService, now checks the Android version:
- If running on Android 13 (API 33) or above, `Context.RECEIVER_NOT_EXPORTED` flag is included in the `registerReceiver` call.
- For older versions, the previous registration method is used.
This ensures compliance with Android 13's requirement for specifying receiver export behavior, resolving the crash.1 parent 22e2738 commit 6a52988
1 file changed
Lines changed: 17 additions & 4 deletions
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
152 | 165 | | |
153 | 166 | | |
154 | 167 | | |
| |||
0 commit comments