Loading core/java/android/accessibilityservice/AccessibilityService.java +4 −0 Original line number Diff line number Diff line Loading @@ -2400,6 +2400,10 @@ public abstract class AccessibilityService extends Service { /** * Gets the {@link HardwareBuffer} representing a memory buffer of the screenshot. * <p> * <strong>Note:</strong> The application should call {@link HardwareBuffer#close()} when * the buffer is no longer needed to free the underlying resources. * </p> * * @return the hardware buffer */ Loading services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java +15 −12 Original line number Diff line number Diff line Loading @@ -1023,8 +1023,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ displaySize.x, displaySize.y, false, rotation); final GraphicBuffer graphicBuffer = screenshotBuffer.getGraphicBuffer(); final HardwareBuffer hardwareBuffer = HardwareBuffer.createFromGraphicBuffer(graphicBuffer); try (HardwareBuffer hardwareBuffer = HardwareBuffer.createFromGraphicBuffer(graphicBuffer)) { final ParcelableColorSpace colorSpace = new ParcelableColorSpace(screenshotBuffer.getColorSpace()); Loading @@ -1033,8 +1033,11 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ payload.putParcelable(KEY_ACCESSIBILITY_SCREENSHOT_HARDWAREBUFFER, hardwareBuffer); payload.putParcelable(KEY_ACCESSIBILITY_SCREENSHOT_COLORSPACE, colorSpace); payload.putLong(KEY_ACCESSIBILITY_SCREENSHOT_TIMESTAMP, SystemClock.uptimeMillis()); payload.putLong(KEY_ACCESSIBILITY_SCREENSHOT_TIMESTAMP, SystemClock.uptimeMillis()); callback.sendResult(payload); hardwareBuffer.close(); } }, null).recycleOnUse()); } finally { Binder.restoreCallingIdentity(identity); Loading Loading
core/java/android/accessibilityservice/AccessibilityService.java +4 −0 Original line number Diff line number Diff line Loading @@ -2400,6 +2400,10 @@ public abstract class AccessibilityService extends Service { /** * Gets the {@link HardwareBuffer} representing a memory buffer of the screenshot. * <p> * <strong>Note:</strong> The application should call {@link HardwareBuffer#close()} when * the buffer is no longer needed to free the underlying resources. * </p> * * @return the hardware buffer */ Loading
services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java +15 −12 Original line number Diff line number Diff line Loading @@ -1023,8 +1023,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ displaySize.x, displaySize.y, false, rotation); final GraphicBuffer graphicBuffer = screenshotBuffer.getGraphicBuffer(); final HardwareBuffer hardwareBuffer = HardwareBuffer.createFromGraphicBuffer(graphicBuffer); try (HardwareBuffer hardwareBuffer = HardwareBuffer.createFromGraphicBuffer(graphicBuffer)) { final ParcelableColorSpace colorSpace = new ParcelableColorSpace(screenshotBuffer.getColorSpace()); Loading @@ -1033,8 +1033,11 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ payload.putParcelable(KEY_ACCESSIBILITY_SCREENSHOT_HARDWAREBUFFER, hardwareBuffer); payload.putParcelable(KEY_ACCESSIBILITY_SCREENSHOT_COLORSPACE, colorSpace); payload.putLong(KEY_ACCESSIBILITY_SCREENSHOT_TIMESTAMP, SystemClock.uptimeMillis()); payload.putLong(KEY_ACCESSIBILITY_SCREENSHOT_TIMESTAMP, SystemClock.uptimeMillis()); callback.sendResult(payload); hardwareBuffer.close(); } }, null).recycleOnUse()); } finally { Binder.restoreCallingIdentity(identity); Loading