getsentry / getsentry/sentry-java
ANRWatchDog reports ANRs from another app when used in the system app
- Linguagem predominante
- Kotlin
- Estrelas
- 1.4k
- Forks
- 478
- Merge médio
- 3d 4h
- PRs com merge (30d)
- 72
Descrição
### Integration
sentry-android
### Build System
Gradle
### AGP Version
8.6.1
### Proguard
Enabled
### Version
8.11.1
### Steps to Reproduce
Other environment details: Android 6
1. Make the main app (when sentry installed) a system app. To achieve that, add `android:sharedUserId="android.uid.system"` to the android manifest
2. Trigger an ANR in another app - can be just an example app that simply uses Thread.sleep in the main thread
3. In the main app, we use Workmanager and some periodic workers, so the application eventually wakes up, then sleeps.
To simplify testing, I did something like in the main app:
```
viewModelScope.launch {
while (true) {
Timber.tag("ANR").i("isAnr=${ANRWatchDog.isProcessNotResponding}")
delay(5000)
}
}
```
Then, I opened another app which simply sleeps forever in onCreate.
This is happening because ANRWatchDog.isProcessNotResponding may return false positives for __system__ apps. That's happening because for system app `am.getProcessesInErrorState()` may return processes that do not belong to the current app because of wider permissions. I was able to validate this by checking `ActivityManager.ProcessErrorStateInfo.processName`.
### Expected Result
Main app doesn't report ANR from other apps
### Actual Result
Main app does report ANR from other apps
Guia de contribuição
Direção de pesquisa
Comece com ANRWatchDog.isProcessNotResponding e com o valor de ActivityManager.ProcessErrorStateInfo.processName descrito no relatório. Reproduza no Android 6 usando um app do sistema com android:sharedUserId="android.uid.system" e outro app que provoque um ANR; considera-se concluído quando o app principal não relatar mais o ANR do outro app.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- android, kotlin
- Domínio
- mobile, observability
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100