Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ public boolean handleActivityResult(int requestCode, int resultCode, Intent data
}
}

private final MediaProjection.Callback mediaProjectionCallback = new MediaProjection.Callback() {
@Override
public void onStop() {
stopCapture();
}
};

private void startCapture(int resultCode, Intent data) {
mediaProjection = projectionManager.getMediaProjection(resultCode, data);
// Register callback to manage resources
mediaProjection.registerCallback(mediaProjectionCallback, new Handler());

imageReader = ImageReader.newInstance(
screenWidth, screenHeight,
Expand Down