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

8285217: [Android] Window's screen is not updated after native screen was disposed #778

Closed
wants to merge 4 commits into from

Conversation

jperedadnr
Copy link
Collaborator

@jperedadnr jperedadnr commented Apr 20, 2022

This PR updates the screen for each window even for the case where the old screen has been disposed but there is a new screen instance found for such window.

This is the case of Android, where the lifecycle of the application allows destroying the native screen when the app goes to the background, and providing a new native screen, in case it comes back to the foreground. Before this PR, the screen for the window wasn't updated after returning from the background, and if orientation changes happened, the dimensions were wrong.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 reviewer)

Issue

  • JDK-8285217: [Android] Window's screen is not updated after native screen was disposed

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/778/head:pull/778
$ git checkout pull/778

Update a local copy of the PR:
$ git checkout pull/778
$ git pull https://git.openjdk.java.net/jfx pull/778/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 778

View PR using the GUI difftool:
$ git pr show -t 778

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/778.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 20, 2022

👋 Welcome back jpereda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label Apr 20, 2022
@mlbridge
Copy link

mlbridge bot commented Apr 20, 2022

Webrevs

@kevinrushforth
Copy link
Member

Since this fix is in shared code, have you tested this using multiple screens on all platforms? Are there new tests that could be written for this?

@kevinrushforth kevinrushforth self-requested a review May 3, 2022 22:48
@jperedadnr
Copy link
Collaborator Author

You are right, the proposed change was intended only for Android but was touching shared code for all platforms.

Based on the comment "Note that if a window has moved to another screen...", and considering that this could apply to the Android case (the initial screen gets destroyed and a new screen is created when app resumes), I have now another solution that does the same but that is mostly on the Android side (MonocleWindowManager::repaintFromNative was only called from Android native anyway), with a small change in MonocleWindow though, as Window::notifyMoveToAnotherScreen has protected access.

@kevinrushforth
Copy link
Member

I like this approach better. Since it just touches Monocle, and most changes are in the android port, perhaps @johanvos can review it?

@kevinrushforth kevinrushforth requested review from johanvos and removed request for kevinrushforth May 6, 2022 21:43
0, 0, (jint) width, (jint) height,
0, 0, (jint) width, (jint) height,
0, 0, (jint) width, (jint) height,
100, 100, (jfloat) 1, (jfloat) 1, androidDensity, androidDensity);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be good to replace the 100 with e.g. dpi and assign a constant value (100) at the top of this file to it, in case we later want to retrieve that in a more dynamic way.

@johanvos
Copy link
Collaborator

This looks now more in line with what the other platforms are doing. We expect the native layer to deal with low-level window/screen handling, and they should notify the java layer in case of relevant events.

@openjdk
Copy link

openjdk bot commented May 10, 2022

@jperedadnr This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8285217: [Android] Window's screen is not updated after native screen was disposed

Reviewed-by: jvos

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 9 new commits pushed to the master branch:

  • e24eece: 8285534: Update the 3D lighting test sample
  • ee7f23d: 8283318: Videos with unusual sizes cannot be played on windows
  • d69a498: 8285725: Wrong link to JBS in README.md
  • 318204b: 8285360: [TestBug] Cleanup a few ignored javafx.controls unit tests
  • 3bb2db1: 8193442: Removing TreeItem from a TreeTableView sometime changes selectedItem
  • 166d5c2: 8278430: Several tests use terminally deprecated System.runFinalization method
  • 5a023bd: 8285034: Skip ServiceTest.testManyServicesRunConcurrently on Windows
  • 7ddcb8b: 8282449: Intermittent OOM error in PredefinedMeshManagerTest
  • c4b1a72: 8283218: Update GStreamer to 1.20.1

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label May 10, 2022
@jperedadnr
Copy link
Collaborator Author

/integrate

@openjdk
Copy link

openjdk bot commented May 10, 2022

Going to push as commit 6c6545f.
Since your change was applied there have been 10 commits pushed to the master branch:

  • 7bb4819: 8283869: Update attribution in webkit.md file
  • e24eece: 8285534: Update the 3D lighting test sample
  • ee7f23d: 8283318: Videos with unusual sizes cannot be played on windows
  • d69a498: 8285725: Wrong link to JBS in README.md
  • 318204b: 8285360: [TestBug] Cleanup a few ignored javafx.controls unit tests
  • 3bb2db1: 8193442: Removing TreeItem from a TreeTableView sometime changes selectedItem
  • 166d5c2: 8278430: Several tests use terminally deprecated System.runFinalization method
  • 5a023bd: 8285034: Skip ServiceTest.testManyServicesRunConcurrently on Windows
  • 7ddcb8b: 8282449: Intermittent OOM error in PredefinedMeshManagerTest
  • c4b1a72: 8283218: Update GStreamer to 1.20.1

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 10, 2022
@openjdk openjdk bot closed this May 10, 2022
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels May 10, 2022
@openjdk
Copy link

openjdk bot commented May 10, 2022

@jperedadnr Pushed as commit 6c6545f.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
3 participants