Skip to content
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

java -jar screenShotTaker.jar times out for large screens #69

Closed
peritus opened this issue Aug 2, 2012 · 5 comments
Closed

java -jar screenShotTaker.jar times out for large screens #69

peritus opened this issue Aug 2, 2012 · 5 comments

Comments

@peritus
Copy link

peritus commented Aug 2, 2012

Hey,

i'm automating a tablet app (that is it has a large screen) using calabash server and all I get from taking screenshots is a timeout (i've destilled it to this):

$> time java -jar screenShotTaker.jar my_funky_screenshot.png
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.android.ddmlib.TimeoutException
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:648)
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:616)
    at com.android.ddmlib.AdbHelper.getFrameBuffer(AdbHelper.java:326)
    at com.android.ddmlib.Device.getScreenshot(Device.java:270)
    at com.android.screenshot.ScreenShotTaker.getDeviceImage(ScreenShotTaker.java:34)
    at com.android.screenshot.Screenshot.takeScreenshot(Screenshot.java:122)
    at com.android.screenshot.Screenshot.main(Screenshot.java:39)
    ... 5 more
  • is the sourcecode to that .jar somewhere available ?
  • what is the timeout's value ? can this be set by the user and/or extended to a failsafe (higher) value ?
  • why doesn't it terminate after it got the error ? Looks like it's implemented with catch (Exception e) { e.printStackTrace(); } .. i'd favor a System.exit(1) in the catch block.

so long,
Filip

@scompt
Copy link
Contributor

scompt commented Aug 8, 2012

The bits that actually do the screenshotting are in ddmlib, part of the AOSP. In particular, take a look here to see where the framebuffer is fetched. It looks like the default timeout is 5s as defined here. If you dig up the sourcecode for screenShotTaker.jar, you might be able to call DdmPreferences.setTimeout(int) before taking the screenshot to give yourself more breathing room on the tablet.

@jonasmaturana
Copy link
Contributor

I will make the screenShotTaker source available on GitHub. It is indeed using ddmlib.

We have thought about taking the screenshots directly on the device instead of using ddmlib.
It would then give you the screenshot directly on <device_ip>:7102/screenshot.

Do you guys have any opinion about that?

On Wednesday, August 8, 2012 at 11:06 , Edward Dale wrote:

The bits that actually do the screenshotting are in ddmlib, part of the AOSP. In particular, take a look here (http://grepcode.com/file/repo1.maven.org/maven2/com.google.android.tools/ddmlib/r13/com/android/ddmlib/AdbHelper.java?av=f#268) to see where the framebuffer is fetched. It looks like the default timeout is 5s as defined here (http://grepcode.com/file/repo1.maven.org/maven2/com.google.android.tools/ddmlib/r13/com/android/ddmlib/DdmPreferences.java#44). If you dig up the sourcecode for screenShotTaker.jar, you might be able to call DdmPreferences.setTimeout(int) before taking the screenshot to give yourself more breathing room on the tablet.


Reply to this email directly or view it on GitHub (#69 (comment)).

@scompt
Copy link
Contributor

scompt commented Aug 8, 2012

That sounds like a great idea.

On Wednesday, August 8, 2012 at 11:10 AM, Jonas Maturana Larsen wrote:

I will make the screenShotTaker source available on GitHub. It is indeed using ddmlib.

We have thought about taking the screenshots directly on the device instead of using ddmlib.
It would then give you the screenshot directly on <device_ip>:7102/screenshot.

Do you guys have any opinion about that?

On Wednesday, August 8, 2012 at 11:06 , Edward Dale wrote:

The bits that actually do the screenshotting are in ddmlib, part of the AOSP. In particular, take a look here (http://grepcode.com/file/repo1.maven.org/maven2/com.google.android.tools/ddmlib/r13/com/android/ddmlib/AdbHelper.java?av=f#268) to see where the framebuffer is fetched. It looks like the default timeout is 5s as defined here (http://grepcode.com/file/repo1.maven.org/maven2/com.google.android.tools/ddmlib/r13/com/android/ddmlib/DdmPreferences.java#44). If you dig up the sourcecode for screenShotTaker.jar, you might be able to call DdmPreferences.setTimeout(int) before taking the screenshot to give yourself more breathing room on the tablet.


Reply to this email directly or view it on GitHub (#69 (comment)).


Reply to this email directly or view it on GitHub (#69 (comment)).

@peritus
Copy link
Author

peritus commented Aug 8, 2012

Yes, I like GET /screenshot ;)

@jonasmaturana
Copy link
Contributor

They take a look at ab8601d.

Does that work for you on large displays?
I just tested it on a 720*1280 display with no issues. (curl localhost:34777/screenshot -o /dev/null took 0.7 second)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants