diff --git a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt index b2a827e12..8ea67fe0b 100644 --- a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt +++ b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt @@ -294,14 +294,31 @@ class InputService : AccessibilityService() { } try { if (stroke == null) { - stroke = GestureDescription.StrokeDescription( - touchPath, - 0, - duration, - willContinue - ) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + stroke = GestureDescription.StrokeDescription( + touchPath, + 0, + duration, + willContinue + ) + } else { + stroke = GestureDescription.StrokeDescription( + touchPath, + 0, + duration + ) + } } else { - stroke = stroke?.continueStroke(touchPath, 0, duration, willContinue) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + stroke = stroke?.continueStroke(touchPath, 0, duration, willContinue) + } else { + stroke = null + stroke = GestureDescription.StrokeDescription( + touchPath, + 0, + duration + ) + } } stroke?.let { val builder = GestureDescription.Builder()