-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[andr][sdk] Screenshot taking capabilities #122
Conversation
platform/jvm/replay/src/main/kotlin/io/bitdrift/capture/replay/ScreenshotCaptureEngine.kt
Outdated
Show resolved
Hide resolved
This reverts commit 66ec104.
import java.io.ByteArrayOutputStream | ||
import java.util.concurrent.ExecutorService | ||
|
||
internal class ScreenshotCaptureEngine( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ this is where all the main logic lives
|
||
private fun compressScreenshot(resultBitmap: Bitmap): ByteArray { | ||
return ByteArrayOutputStream().use { outStream -> | ||
resultBitmap.compress(Bitmap.CompressFormat.JPEG, 10, outStream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have we tried making this 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is using full size with device's pixel density I'd also consider resizing it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can see the result images in the linked sessions, the metadata also contains the used bytes and time spent on each operation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glue code looks fine
* Forwards an error message internally to the SDK | ||
*/ | ||
fun logErrorInternal(message: String, e: Throwable? = null, fields: Map<String, String>? = null) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
fun logDebugInternal(message: String, fields: Map<String, String>? = null) | ||
|
||
/** | ||
* Forwards an error message internally to the SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Forwards an error message internally to the SDK | |
* Forwards an error message internally to the SDK. |
fun logVerboseInternal(message: String, fields: Map<String, String>? = null) | ||
|
||
/** | ||
* Forwards a debug message internally to the SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Forwards a debug message internally to the SDK | |
* Forwards a debug message internally to the SDK. |
|
||
interface IInternalLogger { | ||
/** | ||
* Forwards a verbose message internally to the SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits in this file. Feel free to ignore.
* Forwards a verbose message internally to the SDK | |
* Forwards a verbose message internally to the SDK. |
} | ||
logger.logErrorInternal(message, e) | ||
// Log empty screenshot on unblock the rust engine caller | ||
logger.onScreenshotCaptured(ByteArray(0), metrics.data()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to make sure that it's intended: do we want to log this on old Android versions that we do not support screenshotting for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up deciding to do it and track it in internal sdk logs in case I need to surface it
Android screenshotting support. Uses PixelCopy API. Fixes BIT-4040
Example sessions: