Closed Bug 1462018 Opened 2 years ago Closed 9 months ago

GeckoView: Add support for taking screenshot of web content viewport

Categories

(GeckoView :: General, enhancement, P1)

Unspecified
Android
enhancement

Tracking

(firefox-esr60 wontfix, firefox65 wontfix, firefox66 wontfix, firefox67 fixed)

RESOLVED FIXED
mozilla67
Tracking Status
firefox-esr60 --- wontfix
firefox65 --- wontfix
firefox66 --- wontfix
firefox67 --- fixed

People

(Reporter: sebastian, Assigned: fluffyemily)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [geckoview:fenix:m2])

Attachments

(3 files, 10 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
We would like to take screenshots of the web content to use them in our app. Currently we are only interested in a screenshot of the visible part of the web page. Eventually we might want to take screenshots of the whole page too.

Use cases:
* Focus/Klar: We added the webcompat reporter to the app and would like to append a screenshot to the report
* Fenix: We would like to use screenshots in our tabs tray UI.
Sebastian I'm marking this P3 but I'm curious if the urgency is higher given we probably want webcompat reporter working soon? Feel free to bump priority higher.
Flags: needinfo?(s.kaspari)
Priority: -- → P3
We added the webcompat repoter without screenshot support for now. This is good enough for reporting issues - although a screenshot may be helpful to understand the reported issue(s) better.

Related Focus issues:
* https://github.com/mozilla-mobile/focus-android/issues/2378
* https://github.com/mozilla-mobile/focus-android/issues/2607
Flags: needinfo?(s.kaspari)
Duplicate of this bug: 1462872
I duped bug 1501289 to this one. The only difference is that Bug 1501289 wants to capture the entire page. Looks like we'll need an API that allows either.
Ok I don't know why that link isn't working, but it's the getPixels() call in CompositorController.
An API that returns Bitmap will much nicer :)
Points: --- → 8
Summary: GeckoView: Add support for taking screenshot of web content → GeckoView: Add support for taking screenshot of web content (for tab thumbnail tray)
Whiteboard: [geckoview:fenix][geckoview:klar] → [geckoview:fenix:p1]
Product: Firefox for Android → GeckoView
P1 for Fenix
OS: Unspecified → Android
Priority: P3 → P1
Assignee: nobody → etoop

A-C issue for using the thumbnail screenshot API:
https://github.com/mozilla-mobile/reference-browser/issues/507

Removing "(for tab thumbnail tray)" because Fenix wants to be able to take viewport screenshots for thumbnails and full page screenshots for use cases like saving pages for offline viewing.

Perhaps the viewport and full page screenshot functionality should land in two separate bugs?

Summary: GeckoView: Add support for taking screenshot of web content (for tab thumbnail tray) → GeckoView: Add support for taking screenshot of web content (viewport and full page)

Rename to more suitable screenshotVisiblePage
Remove flag to determine whether to take full or visible screenshots.

Depends on D18718

Update RecvScreenPixels in nsWindow in order to invert the image before sending over JNI rather than requiring callers to invert the image themselves.

Depends on D18719

This is because casting from uint8 to int in C++ can have endian problems on different machines.

Depends on D18720

Construct a new Screenshot object to contain pixel information for return from call.
Add helper method to construct Bitmap from data to Screenshot.
Streamline screenshotVisiblePage to return only the result from getPixels or a null result if there is no controller.
Add doc comments to new methods and classes.
Update FennecNativeDriver to use GeckoResult.

Depends on D18721

Ensure that the screenshotted bitmap is the same as the expected one.
Doesn't currently work due to problems with rendering screenshot.

Depends on D18722

Depends on D18723

Adding [geckoview:fenix:m2] whiteboard tag because the Fenix team needs this API for the Fenix M2 milestone (now in progress) for their tab management UI.

https://github.com/mozilla-mobile/fenix/issues/98#issuecomment-456945088

Whiteboard: [geckoview:fenix:p1] → [geckoview:fenix:p1] [geckoview:fenix:m2]
Target Milestone: --- → mozilla67
Attachment #9041541 - Attachment is obsolete: true
Attachment #9041540 - Attachment is obsolete: true
Attachment #9041539 - Attachment is obsolete: true
Attachment #9041538 - Attachment is obsolete: true
Attachment #9041537 - Attachment is obsolete: true
Attachment #9041536 - Attachment is obsolete: true
Attachment #9041535 - Attachment is obsolete: true
Attachment #9041534 - Attachment is obsolete: true

Update RecvScreenPixels in nsWindow in order to invert the image before sending over JNI rather than requiring callers to invert the image themselves.

Return byte array from RecvScreenPixels.

This is because casting from uint8 to int in C++ can have endian problems on different machines.

Return GeckoResult from getPixels.
Construct a new Screenshot object to contain pixel information for return from call.
Add helper method to construct Bitmap from data to Screenshot.
Streamline screenshotVisiblePage to return only the result from getPixels or a null result if there is no controller.
Add doc comments to new methods and classes.
Update FennecNativeDriver to use GeckoResult.

Update API docs and Changelog

Depends on D18944

Attached file Bug 1462018 - Part 3 - Add tests (obsolete) —

Ensure that the screenshotted bitmap is the same as the expected one.
Doesn't currently work due to problems with rendering screenshot.

Update GeckoSessionTestRule to instantiate the compositor when setting @WithDisplay annotation on tests

Depends on D18945

Attachment #9042052 - Attachment description: Bug 1462018 - Part 1 - Add API for taking screenshot of visible page. This version uses existing unmodified `getPixels` function → Bug 1462018 - Add API for taking screenshot of visible page.
Attachment #9042053 - Attachment is obsolete: true
Attachment #9042055 - Attachment is obsolete: true
Summary: GeckoView: Add support for taking screenshot of web content (viewport and full page) → GeckoView: Add support for taking screenshot of web content viewport
Blocks: 1530967
Pushed by etoop@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b63cae045a63
Add API for taking screenshot of visible page. r=geckoview-reviewers,snorp

Backed out changeset b63cae045a63 (Bug 1462018) for geckoview failures

Backout: https://hg.mozilla.org/integration/autoland/rev/b63cae045a638021aa932f4b120735391fcdffe2

Push that started the failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=superseded%2Ctestfailed%2Cbusted%2Cexception%2Crunnable&revision=b63cae045a638021aa932f4b120735391fcdffe2

Failure log: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=superseded%2Ctestfailed%2Cbusted%2Cexception%2Crunnable&selectedJob=230739240&searchStr=android%2C4.3%2Capi16%2B%2Copt%2Ctest-android-em-4.3-arm7-api-16%2Fopt-geckoview-junit-e10s-2%2C%28gv-junit2%29

[task 2019-02-27T11:26:40.503Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
[task 2019-02-27T11:26:40.504Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: current=131
[task 2019-02-27T11:26:40.505Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: class=org.mozilla.geckoview.test.ScreenshotTest
[task 2019-02-27T11:26:40.505Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stream=
[task 2019-02-27T11:26:40.505Z] 11:26:40 INFO - org.mozilla.geckoview.test | Error in capturePixelsThrowsSessionClosed(org.mozilla.geckoview.test.ScreenshotTest):
[task 2019-02-27T11:26:40.505Z] 11:26:40 INFO - org.mozilla.geckoview.test | java.lang.AssertionError:
[task 2019-02-27T11:26:40.505Z] 11:26:40 INFO - org.mozilla.geckoview.test | Expected: (an instance of java.lang.IllegalStateException and exception with message a string containing "The compositor has detached from the session")
[task 2019-02-27T11:26:40.505Z] 11:26:40 INFO - org.mozilla.geckoview.test | but: an instance of java.lang.IllegalStateException <java.lang.AssertionError: IllegalStateException expected to be thrown> is a java.lang.AssertionError
[task 2019-02-27T11:26:40.506Z] 11:26:40 INFO - org.mozilla.geckoview.test | Stacktrace was: java.lang.AssertionError: IllegalStateException expected to be thrown
[task 2019-02-27T11:26:40.506Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.Assert.fail(Assert.java:88)
[task 2019-02-27T11:26:40.507Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.ScreenshotTest.capturePixelsThrowsSessionClosed(ScreenshotTest.kt:89)
[task 2019-02-27T11:26:40.510Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invokeNative(Native Method)
[task 2019-02-27T11:26:40.511Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invoke(Method.java:525)
[task 2019-02-27T11:26:40.514Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
[task 2019-02-27T11:26:40.515Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
[task 2019-02-27T11:26:40.516Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
[task 2019-02-27T11:26:40.518Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
[task 2019-02-27T11:26:40.519Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
[task 2019-02-27T11:26:40.521Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$3$1.run(GeckoSessionTestRule.java:1422)
[task 2019-02-27T11:26:40.522Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:1719)
[task 2019-02-27T11:26:40.523Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Handler.handleCallback(Handler.java:730)
[task 2019-02-27T11:26:40.524Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Handler.dispatchMessage(Handler.java:92)
[task 2019-02-27T11:26:40.525Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Looper.loop(Looper.java:137)
[task 2019-02-27T11:26:40.527Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.app.ActivityThread.main(ActivityThread.java:5103)
[task 2019-02-27T11:26:40.528Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invokeNative(Native Method)
[task 2019-02-27T11:26:40.530Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invoke(Method.java:525)
[task 2019-02-27T11:26:40.530Z] 11:26:40 INFO - org.mozilla.geckoview.test | at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
[task 2019-02-27T11:26:40.531Z] 11:26:40 INFO - org.mozilla.geckoview.test | at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
[task 2019-02-27T11:26:40.531Z] 11:26:40 INFO - org.mozilla.geckoview.test | at dalvik.system.NativeStart.main(Native Method)
[task 2019-02-27T11:26:40.532Z] 11:26:40 INFO - org.mozilla.geckoview.test |
[task 2019-02-27T11:26:40.532Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
[task 2019-02-27T11:26:40.533Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.Assert.assertThat(Assert.java:956)
[task 2019-02-27T11:26:40.533Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.Assert.assertThat(Assert.java:923)
[task 2019-02-27T11:26:40.533Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.rules.ExpectedException.handleException(ExpectedException.java:252)
[task 2019-02-27T11:26:40.534Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.rules.ExpectedException.access$000(ExpectedException.java:106)
[task 2019-02-27T11:26:40.534Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:241)
[task 2019-02-27T11:26:40.535Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$3$1.run(GeckoSessionTestRule.java:1422)
[task 2019-02-27T11:26:40.535Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:1719)
[task 2019-02-27T11:26:40.536Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Handler.handleCallback(Handler.java:730)
[task 2019-02-27T11:26:40.536Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Handler.dispatchMessage(Handler.java:92)
[task 2019-02-27T11:26:40.537Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Looper.loop(Looper.java:137)
[task 2019-02-27T11:26:40.537Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.app.ActivityThread.main(ActivityThread.java:5103)
[task 2019-02-27T11:26:40.537Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invokeNative(Native Method)
[task 2019-02-27T11:26:40.538Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invoke(Method.java:525)
[task 2019-02-27T11:26:40.538Z] 11:26:40 INFO - org.mozilla.geckoview.test | at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
[task 2019-02-27T11:26:40.539Z] 11:26:40 INFO - org.mozilla.geckoview.test | at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
[task 2019-02-27T11:26:40.539Z] 11:26:40 INFO - org.mozilla.geckoview.test | at dalvik.system.NativeStart.main(Native Method)
[task 2019-02-27T11:26:40.540Z] 11:26:40 INFO - org.mozilla.geckoview.test |
[task 2019-02-27T11:26:40.540Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: numtests=205
[task 2019-02-27T11:26:40.540Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stack=java.lang.AssertionError:
[task 2019-02-27T11:26:40.540Z] 11:26:40 INFO - org.mozilla.geckoview.test | Expected: (an instance of java.lang.IllegalStateException and exception with message a string containing "The compositor has detached from the session")
[task 2019-02-27T11:26:40.540Z] 11:26:40 INFO - org.mozilla.geckoview.test | but: an instance of java.lang.IllegalStateException <java.lang.AssertionError: IllegalStateException expected to be thrown> is a java.lang.AssertionError
[task 2019-02-27T11:26:40.540Z] 11:26:40 INFO - org.mozilla.geckoview.test | Stacktrace was: java.lang.AssertionError: IllegalStateException expected to be thrown
[task 2019-02-27T11:26:40.541Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.Assert.fail(Assert.java:88)
[task 2019-02-27T11:26:40.541Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.ScreenshotTest.capturePixelsThrowsSessionClosed(ScreenshotTest.kt:89)
[task 2019-02-27T11:26:40.541Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invokeNative(Native Method)
[task 2019-02-27T11:26:40.541Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invoke(Method.java:525)
[task 2019-02-27T11:26:40.541Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
[task 2019-02-27T11:26:40.542Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
[task 2019-02-27T11:26:40.542Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
[task 2019-02-27T11:26:40.542Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
[task 2019-02-27T11:26:40.542Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
[task 2019-02-27T11:26:40.543Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$3$1.run(GeckoSessionTestRule.java:1422)
[task 2019-02-27T11:26:40.543Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:1719)
[task 2019-02-27T11:26:40.543Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Handler.handleCallback(Handler.java:730)
[task 2019-02-27T11:26:40.544Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Handler.dispatchMessage(Handler.java:92)
[task 2019-02-27T11:26:40.544Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Looper.loop(Looper.java:137)
[task 2019-02-27T11:26:40.544Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.app.ActivityThread.main(ActivityThread.java:5103)
[task 2019-02-27T11:26:40.544Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invokeNative(Native Method)
[task 2019-02-27T11:26:40.545Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invoke(Method.java:525)
[task 2019-02-27T11:26:40.545Z] 11:26:40 INFO - org.mozilla.geckoview.test | at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
[task 2019-02-27T11:26:40.545Z] 11:26:40 INFO - org.mozilla.geckoview.test | at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
[task 2019-02-27T11:26:40.545Z] 11:26:40 INFO - org.mozilla.geckoview.test | at dalvik.system.NativeStart.main(Native Method)
[task 2019-02-27T11:26:40.546Z] 11:26:40 INFO - org.mozilla.geckoview.test |
[task 2019-02-27T11:26:40.546Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
[task 2019-02-27T11:26:40.546Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.Assert.assertThat(Assert.java:956)
[task 2019-02-27T11:26:40.546Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.Assert.assertThat(Assert.java:923)
[task 2019-02-27T11:26:40.546Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.rules.ExpectedException.handleException(ExpectedException.java:252)
[task 2019-02-27T11:26:40.547Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.rules.ExpectedException.access$000(ExpectedException.java:106)
[task 2019-02-27T11:26:40.547Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:241)
[task 2019-02-27T11:26:40.547Z] 11:26:40 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$3$1.run(GeckoSessionTestRule.java:1422)
[task 2019-02-27T11:26:40.547Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:1719)
[task 2019-02-27T11:26:40.548Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Handler.handleCallback(Handler.java:730)
[task 2019-02-27T11:26:40.548Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Handler.dispatchMessage(Handler.java:92)
[task 2019-02-27T11:26:40.548Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.os.Looper.loop(Looper.java:137)
[task 2019-02-27T11:26:40.548Z] 11:26:40 INFO - org.mozilla.geckoview.test | at android.app.ActivityThread.main(ActivityThread.java:5103)
[task 2019-02-27T11:26:40.548Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invokeNative(Native Method)
[task 2019-02-27T11:26:40.549Z] 11:26:40 INFO - org.mozilla.geckoview.test | at java.lang.reflect.Method.invoke(Method.java:525)
[task 2019-02-27T11:26:40.549Z] 11:26:40 INFO - org.mozilla.geckoview.test | at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
[task 2019-02-27T11:26:40.549Z] 11:26:40 INFO - org.mozilla.geckoview.test | at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
[task 2019-02-27T11:26:40.549Z] 11:26:40 INFO - org.mozilla.geckoview.test | at dalvik.system.NativeStart.main(Native Method)
[task 2019-02-27T11:26:40.550Z] 11:26:40 INFO - org.mozilla.geckoview.test |
[task 2019-02-27T11:26:40.550Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: test=capturePixelsThrowsSessionClosed
[task 2019-02-27T11:26:40.550Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS_CODE: -2
[task 2019-02-27T11:26:40.550Z] 11:26:40 WARNING - TEST-UNEXPECTED-FAIL | org.mozilla.geckoview.test.ScreenshotTest.capturePixelsThrowsSessionClosed | status -2
[task 2019-02-27T11:26:40.550Z] 11:26:40 INFO - TEST-INFO took 5835ms
[task 2019-02-27T11:26:40.550Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
[task 2019-02-27T11:26:40.550Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: current=132
[task 2019-02-27T11:26:40.551Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: class=org.mozilla.geckoview.test.ScreenshotTest
[task 2019-02-27T11:26:40.551Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stream=
[task 2019-02-27T11:26:40.551Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: numtests=205
[task 2019-02-27T11:26:40.551Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: test=capturePixelsCompletesCompositorPausedRestarted
[task 2019-02-27T11:26:40.551Z] 11:26:40 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS_CODE: 1

Flags: needinfo?(etoop)
Backout by opoprus@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9c42526c4442
Backed out changeset b63cae045a63 for geckoview failures

Invert screen pixels in nsWindow.

Update RequestScreenPixels in nsWindow to accept a GeckoResult as an argument and save as a GlobalRef.
Update RecvScreenPixels in nsWindow in order to invert the image before sending over JNI rather than requiring callers to invert the image themselves.
Complete the GeckoResult if there is one in RecvScreenPixels instead of making a callback to the compositor.

Remove RecvScreenPixels from GeckoSession and GeckoSession.Compositor.
Move RecvScreenPixels and getPixels to GeckoDisplay
Rename getPixels to capturePixels

Return Bitmap from RecvScreenPixels.

Return GeckoResult from capturePixels.

Add doc comments to new methods and classes.
Update FennecNativeDriver to use GeckoView and GeckoResult.

Update API docs and Changelog

Add tests

Fenix will implement screenshots in Fenix M4, so A-C needs to complete their A-C API in M3, so GV should provide the GV API in M2.

https://github.com/mozilla-mobile/android-components/issues/1826

[geckoview:fenix:m2] not [geckoview:fenix:p1]

Whiteboard: [geckoview:fenix:p1] [geckoview:fenix:m2] → [geckoview:fenix:m2]
Pushed by etoop@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c1f943e591c
Add API for taking screenshot of visible page. r=snorp,geckoview-reviewers

Backed out for failures on NoSuchMethodError: org.mozilla.geckoview.GeckoView.capturePixels

backout: https://hg.mozilla.org/integration/autoland/rev/6d5c965e0c8e63c2a2ca0cbbc33a08c463b1a5e3

push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=6c1f943e591c547b4c5c5ca642a449728e03b5ac&searchStr=Android%2C4.3%2CAPI16%2B%2Copt&group_state=expanded

failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=231210195&repo=autoland&lineNumber=1441

[task 2019-03-01T09:26:06.212Z] 09:26:06 INFO - GECKO | EventExpecter: no longer listening for Content:DOMContentLoaded
[task 2019-03-01T09:26:16.427Z] 09:26:16 INFO - GECKO | PaintExpecter: no longer listening for events
[task 2019-03-01T09:26:37.061Z] 09:26:37 INFO - wait for org.mozilla.fennec_aurora complete; top activity=com.android.launcher
[task 2019-03-01T09:26:37.265Z] 09:26:37 INFO - remoteautomation.py | Application ran for: 0:01:14.431058
[task 2019-03-01T09:26:37.785Z] 09:26:37 INFO - /data/tombstones does not exist; tombstone check skipped
[task 2019-03-01T09:26:38.092Z] 09:26:38 WARNING - PROCESS-CRASH | testAboutPage | java-exception java.lang.NoSuchMethodError: org.mozilla.geckoview.GeckoView.capturePixels at org.mozilla.gecko.FennecNativeDriver$1.run(FennecNativeDriver.java:259)
[task 2019-03-01T09:26:38.092Z] 09:26:38 INFO - 0 ERROR runApp() exited with code 1
[task 2019-03-01T09:26:38.505Z] 09:26:38 WARNING - PROCESS-CRASH | Automation Error: Missing end of test marker (process crashed?)
[task 2019-03-01T09:26:38.911Z] 09:26:38 INFO - 03-01 01:25:28.154 W/dalvikvm( 1090): VFY: unable to resolve virtual method 20095: Landroid/view/ViewStructure;.setEnabled (Z)V
[task 2019-03-01T09:26:38.912Z] 09:26:38 INFO - 03-01 01:25:28.233 I/dalvikvm( 1090): Could not find method android.view.inputmethod.BaseInputConnection.closeConnection, referenced from method org.mozilla.geckoview.GeckoInputConnection.closeConnection
[task 2019-03-01T09:26:38.912Z] 09:26:38 INFO - 03-01 01:25:28.233 W/dalvikvm( 1090): VFY: unable to resolve virtual method 20386: Landroid/view/inputmethod/BaseInputConnection;.closeConnection ()V
[task 2019-03-01T09:26:38.912Z] 09:26:38 INFO - 03-01 01:25:28.254 I/dalvikvm( 1090): Could not find method android.media.AudioManager.dispatchMediaKeyEvent, referenced from method org.mozilla.geckoview.GeckoInputConnection.performDefaultKeyAction
[task 2019-03-01T09:26:38.913Z] 09:26:38 INFO - 03-01 01:25:28.254 W/dalvikvm( 1090): VFY: unable to resolve virtual method 1789: Landroid/media/AudioManager;.dispatchMediaKeyEvent (Landroid/view/KeyEvent;)V
[task 2019-03-01T09:26:38.913Z] 09:26:38 INFO - 03-01 01:25:28.254 E/dalvikvm( 1090): Could not find class 'android.view.inputmethod.CursorAnchorInfo$Builder', referenced from method org.mozilla.geckoview.GeckoInputConnection.updateCompositionRectsOnUi
[task 2019-03-01T09:26:38.913Z] 09:26:38 INFO - 03-01 01:25:28.264 W/dalvikvm( 1090): VFY: unable to resolve new-instance 2929 (Landroid/view/inputmethod/CursorAnchorInfo$Builder;) in Lorg/mozilla/geckoview/GeckoInputConnection;
[task 2019-03-01T09:26:38.914Z] 09:26:38 INFO - 03-01 01:25:28.284 I/dalvikvm( 1090): Could not find method android.view.inputmethod.CursorAnchorInfo$Builder.reset, referenced from method org.mozilla.geckoview.GeckoInputConnection.updateCompositionRectsOnUi
[task 2019-03-01T09:26:38.914Z] 09:26:38 INFO - 03-01 01:25:28.284 W/dalvikvm( 1090): VFY: unable to resolve virtual method 20394: Landroid/view/inputmethod/CursorAnchorInfo$Builder;.reset ()V
[task 2019-03-01T09:26:38.914Z] 09:26:38 INFO - 03-01 01:25:28.293 I/dalvikvm( 1090): Failed resolving Lorg/mozilla/geckoview/SessionAccessibility$Settings$2; interface 2894 'Landroid/view/accessibility/AccessibilityManager$TouchExplorationStateChangeListener;'
[task 2019-03-01T09:26:38.915Z] 09:26:38 INFO - 03-01 01:25:28.293 W/dalvikvm( 1090): Link of class 'Lorg/mozilla/geckoview/SessionAccessibility$Settings$2;' failed
[task 2019-03-01T09:26:38.915Z] 09:26:38 INFO - 03-01 01:25:28.293 E/dalvikvm( 1090): Could not find class 'org.mozilla.geckoview.SessionAccessibility$Settings$2', referenced from method org.mozilla.geckoview.SessionAccessibility$Settings.<clinit>
[task 2019-03-01T09:26:38.915Z] 09:26:38 INFO - 03-01 01:25:28.293 W/dalvikvm( 1090): VFY: unable to resolve new-instance 9041 (Lorg/mozilla/geckoview/SessionAccessibility$Settings$2;) in Lorg/mozilla/geckoview/SessionAccessibility$Settings;
[task 2019-03-01T09:26:38.916Z] 09:26:38 INFO - 03-01 01:25:28.323 I/dalvikvm( 1090): Failed resolving Lorg/mozilla/geckoview/SessionAccessibility$Settings$2; interface 2894 'Landroid/view/accessibility/AccessibilityManager$TouchExplorationStateChangeListener;'
[task 2019-03-01T09:26:38.916Z] 09:26:38 INFO - 03-01 01:25:28.323 W/dalvikvm( 1090): Link of class 'Lorg/mozilla/geckoview/SessionAccessibility$Settings$2;' failed
[task 2019-03-01T09:26:38.918Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): An error occurred during restore, switching to backup file
[task 2019-03-01T09:26:38.918Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): org.mozilla.gecko.GeckoApp$SessionRestoreException: Could not read from session file
[task 2019-03-01T09:26:38.918Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): at org.mozilla.gecko.GeckoApp.restoreSessionTabs(GeckoApp.java:1683)
[task 2019-03-01T09:26:38.918Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): at org.mozilla.gecko.GeckoApp.access$200(GeckoApp.java:116)
[task 2019-03-01T09:26:38.918Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): at org.mozilla.gecko.GeckoApp$9.run(GeckoApp.java:1208)
[task 2019-03-01T09:26:38.918Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): at android.os.Handler.handleCallback(Handler.java:730)
[task 2019-03-01T09:26:38.919Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): at android.os.Handler.dispatchMessage(Handler.java:92)
[task 2019-03-01T09:26:38.919Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): at android.os.Looper.loop(Looper.java:137)
[task 2019-03-01T09:26:38.920Z] 09:26:38 INFO - 03-01 01:25:28.373 E/GeckoApp( 1090): at org.mozilla.gecko.util.GeckoBackgroundThread.run(GeckoBackgroundThread.java:43)
[task 2019-03-01T09:26:38.920Z] 09:26:38 INFO - 03-01 01:25:28.383 D/GeckoBrowserApp( 1090): Switchboard disabled - in automation

Invert screen pixels in nsWindow.

Update RequestScreenPixels in nsWindow to accept a GeckoResult as an argument and save as a GlobalRef.
Update RecvScreenPixels in nsWindow in order to invert the image before sending over JNI rather than requiring callers to invert the image themselves.
Complete the GeckoResult if there is one in RecvScreenPixels instead of making a callback to the compositor.

Remove RecvScreenPixels from GeckoSession and GeckoSession.Compositor.
Move RecvScreenPixels and getPixels to GeckoDisplay
Rename getPixels to capturePixels

Return Bitmap from RecvScreenPixels.

Return GeckoResult from capturePixels.

Add doc comments to new methods and classes.
Update FennecNativeDriver to use GeckoView and GeckoResult.

Update API docs and Changelog

Add tests

Pushed by etoop@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f900bfeeb59c
Add API for taking screenshot of visible page.
Status: NEW → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Depends on: 1532101
Flags: needinfo?(etoop)
Depends on: 1544390
See Also: → 1482500
You need to log in before you can comment on or make changes to this bug.