Cover touch permission checks with the overlay error boundary

This commit is contained in:
evgeny committed 2026-10-29 13:34:23 +01:00
1 parent 4de7d7ec9d
commit 0d9dabcd23
1 file changed
+8 -7
@@ -440,13 +440,13 @@ class RadioOverlayService : Service() {
override fun onTouch(view: View, event: MotionEvent): Boolean {
if (destroyed || currentService !== this@RadioOverlayService || overlayView !== v || !overlayReady || pendingStop) return false
if (!MicrophonePermission.granted() || !ChatApplication.instance.configProvider.getRadioOverlay() ||
!canDrawOverlays(this@RadioOverlayService)) {
removeOverlay()
sync(this@RadioOverlayService)
return false
}
try {
if (!MicrophonePermission.granted() || !ChatApplication.instance.configProvider.getRadioOverlay() ||
!canDrawOverlays(this@RadioOverlayService)) {
removeOverlay()
sync(this@RadioOverlayService)
return false
}
when (event.action) {
MotionEvent.ACTION_DOWN -> {
startX = params?.x ?: lp.x
@@ -554,7 +554,8 @@ class RadioOverlayService : Service() {
requireNotNull(windowManager) { "window manager unavailable" }.updateViewLayout(v, lp)
LogManager.addLog("DEBUG", "RadioOverlay", "default position center=${target.x},${target.y} x=${lp.x} y=${lp.y}")
} catch (e: Exception) {
LogManager.addLog("ERROR", "RadioOverlay", "default position failed: ${e.message}")
LogManager.addLog("ERROR", "RadioOverlay", "default position failed view=${System.identityHashCode(v)} " +
"target=${target.x},${target.y} params=${lp.x},${lp.y}: $e")
}
}
}