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

8343398: Add reducedData preference #1656

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

mstr2
Copy link
Collaborator

@mstr2 mstr2 commented Dec 3, 2024

The reducedData preference instructs applications to minimize internet traffic, as users might be on a metered network or a limited data plan.

This corresponds to the following OS settings:

Windows: Settings -> Network and Internet -> Ethernet/WiFi -> Metered connection
macOS: Settings -> Network -> Ethernet/WiFi -> Network Settings -> Low data mode
Ubuntu: Settings -> Network -> Wired/WiFi -> Metered connection

Change notifications work consistently on Windows and macOS. On my Ubuntu 24 system, the GIO network-changed signal is not sent when I only toggle the "metered connection" flag in network settings (and there's no signal specifically for low-data mode). The new value is only picked up when the connection changes by coming offline or going online.

/reviewers 2
/csr


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)
  • Change requires CSR request JDK-8345677 to be approved

Issues

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1656/head:pull/1656
$ git checkout pull/1656

Update a local copy of the PR:
$ git checkout pull/1656
$ git pull https://git.openjdk.org/jfx.git pull/1656/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1656

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1656.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 3, 2024

👋 Welcome back mstrauss! 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
Copy link

openjdk bot commented Dec 3, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Ready for review label Dec 3, 2024
@openjdk
Copy link

openjdk bot commented Dec 3, 2024

@mstr2
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@openjdk openjdk bot added the csr Need approved CSR to integrate pull request label Dec 3, 2024
@openjdk
Copy link

openjdk bot commented Dec 3, 2024

@mstr2 has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@mstr2 please create a CSR request for issue JDK-8343398 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@mlbridge
Copy link

mlbridge bot commented Dec 3, 2024

Webrevs

@mstr2
Copy link
Collaborator Author

mstr2 commented Dec 4, 2024

This PR also includes a small refactor of the GTK and macOS PlatformSupport classes.

The previous implementations had some parts of the change notification mechanism implemented outside of PlatformSupport in their respective GlassApplication class. The refactor moves this into PlatformSupport, which centralizes all aspects related to platform preference change detection.

@andy-goryachev-oracle
Copy link
Contributor

Does not seem to work on macOS 15.1.1 M1:

Screenshot 2024-12-11 at 08 00 31

@andy-goryachev-oracle
Copy link
Contributor

Screenshot 2024-12-11 at 08 04 13

@mstr2
Copy link
Collaborator Author

mstr2 commented Dec 11, 2024

Does not seem to work on macOS 15.1.1 M1:

It works on my 14.6 machine. Let me try upgrading and testing again...

@andy-goryachev-oracle
Copy link
Contributor

I might suggest adding the instructions on how to control the platform settings as comments somewhere in the implementation.

Windows: Settings -> Network and Internet -> Ethernet/WiFi -> Metered connection
macOS: Settings -> Network -> Ethernet/WiFi -> Network Settings -> Low data mode
Ubuntu: Settings -> Network -> Wired/WiFi -> Metered connection

@andy-goryachev-oracle
Copy link
Contributor

(I've merged the latest master prior to testing)

@mstr2
Copy link
Collaborator Author

mstr2 commented Dec 11, 2024

Does not seem to work on macOS 15.1.1 M1:

It also works on 15.1.1 on my machine. Just to check the obvious: did you close the WiFi Details window? The settings are only applied when you click OK.

@andy-goryachev-oracle
Copy link
Contributor

Update: I was getting interference from the VPN application. Getting off the VPN helped - I see the property and macOS.*.currentPathConstrained key being toggled.

(macOS.*.currentPathExpensive remains false).

@mstr2
Copy link
Collaborator Author

mstr2 commented Dec 11, 2024

Update: I was getting interference from the VPN application. Getting off the VPN helped - I see the property and macOS.*.currentPathConstrained key being toggled.

(macOS.*.currentPathExpensive remains false).

That's the expected result.

@mstr2
Copy link
Collaborator Author

mstr2 commented Dec 11, 2024

I might suggest adding the instructions on how to control the platform settings as comments somewhere in the implementation.

Windows: Settings -> Network and Internet -> Ethernet/WiFi -> Metered connection
macOS: Settings -> Network -> Ethernet/WiFi -> Network Settings -> Low data mode
Ubuntu: Settings -> Network -> Wired/WiFi -> Metered connection

I feel this wouldn't age well, considering that the particular UI used by the different operating systems has often changed over the years.

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

It looks like the scope of this change goes far beyond adding a few properties. It looks like a non-trivial refactoring that might also impact other platform preferences.

I did check that switching between light/dark modes on macOS results in proper updates, but the native code needs to be re-reviewed.

@@ -204,6 +187,7 @@ - (void)applicationWillFinishLaunching:(NSNotification *)aNotification
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
{
// unblock main thread. Glass is started at this point.
self->platformSupport = [[PlatformSupport alloc] initWithEnv:env application:jApplication];
Copy link
Contributor

Choose a reason for hiding this comment

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

should we check for failure here? (alloc)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We never do that in obj-c native code, so this probably wouldn't be the place to start. In any case, a failure at this point wouldn't lead to a crash, as the only access of platformSupport checks for nil.

@andy-goryachev-oracle
Copy link
Contributor

I feel this wouldn't age well, considering that the particular UI used by the different operating systems has often changed over the years.

I think it has merit. Now that we need to re-test the functionality, it would have helped. Even when something changes, it will be easier to look up a few missing pieces than dig through the PRs...

@kevinrushforth kevinrushforth self-requested a review December 11, 2024 20:25
@kevinrushforth
Copy link
Member

I feel this wouldn't age well, considering that the particular UI used by the different operating systems has often changed over the years.

I think it has merit. Now that we need to re-test the functionality, it would have helped. Even when something changes, it will be easier to look up a few missing pieces than dig through the PRs...

I think this sort of information is better suited for a Wiki.

Btw, I can review the native code changes. Just not for a couple days.

@andy-goryachev-oracle
Copy link
Contributor

tested macOS behavior, all is well.

BTW, I've updated the Monkey Tester to highlight changes in Tools -> Platform Preferences Monitor.

https://github.com/andy-goryachev-oracle/MonkeyTest

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

tested on macOS. needs testing on linux and windows.

@kevinrushforth
Copy link
Member

BTW, I've updated the Monkey Tester to highlight changes in Tools -> Platform Preferences Monitor.

https://github.com/andy-goryachev-oracle/MonkeyTest

That seems useful. Thanks.

tested on macOS. needs testing on linux and windows.

I can test Windows and Linux (I'll skip macOS since you've already done that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csr Need approved CSR to integrate pull request rfr Ready for review
Development

Successfully merging this pull request may close these issues.

3 participants