Skip to content

Commit

Permalink
fix: 无障碍截屏资源关闭
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Nov 17, 2023
1 parent e350ada commit 594e303
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/src/main/java/li/songe/gkd/service/GkdAbService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,15 @@ class GkdAbService : CompositionAbService({
application.mainExecutor,
object : TakeScreenshotCallback {
override fun onSuccess(screenshot: ScreenshotResult) {
it.resume(
Bitmap.wrapHardwareBuffer(
screenshot.hardwareBuffer, screenshot.colorSpace
try {
it.resume(
Bitmap.wrapHardwareBuffer(
screenshot.hardwareBuffer, screenshot.colorSpace
)
)
)
} finally {
screenshot.hardwareBuffer.close()
}
}

override fun onFailure(errorCode: Int) = it.resume(null)
Expand Down

0 comments on commit 594e303

Please sign in to comment.