Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345677

Add reducedData preference

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • jfx24
    • javafx
    • None
    • behavioral
    • minimal
    • The `Platform.Preferences` interface is sealed, and cannot be implemented by applications.
    • Java API
    • JDK

      Summary

      Add the reducedData platform preference.

      Problem

      Users on a limited-data network will often request applications to minimize internet traffic. The reducedData preference allows JavaFX applications to detect this user request.

      Solution

      The reducedData preference 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

      Specification

      --- a/modules/javafx.graphics/src/main/java/javafx/application/Platform.java
      +++ b/modules/javafx.graphics/src/main/java/javafx/application/Platform.java
      @@ -498,6 +498,7 @@
            *         <tr><td>{@code Windows.UIColor.AccentLight3}</td><td>{@link Color}</td></tr>
            *         <tr><td>{@code Windows.UISettings.AdvancedEffectsEnabled}</td><td>{@link Boolean}</td></tr>
            *         <tr><td>{@code Windows.UISettings.AutoHideScrollBars}</td><td>{@link Boolean}</td></tr>
      +     *         <tr><td>{@code Windows.NetworkInformation.InternetCostType}</td><td>{@link String}</td></tr>
            *         <tr></tr>
            *     </tbody>
            * </table>
      @@ -553,6 +554,8 @@
            *         <tr><td>{@code macOS.NSWorkspace.accessibilityDisplayShouldReduceMotion}</td><td>{@link Boolean}</td></tr>
            *         <tr><td>{@code macOS.NSWorkspace.accessibilityDisplayShouldReduceTransparency}</td><td>{@link Boolean}</td></tr>
            *         <tr><td>{@code macOS.NSScroller.preferredScrollerStyle}</td><td>{@link String}</td></tr>
      +     *         <tr><td>{@code macOS.NWPathMonitor.currentPathConstrained}</td><td>{@link Boolean}</td></tr>
      +     *         <tr><td>{@code macOS.NWPathMonitor.currentPathExpensive}</td><td>{@link Boolean}</td></tr>
            *         <tr></tr>
            *     </tbody>
            * </table>
      @@ -580,6 +583,7 @@
            *         <tr><td>{@code GTK.success_color}</td><td>{@link Color}</td></tr>
            *         <tr><td>{@code GTK.enable_animations}</td><td>{@link Boolean}</td></tr>
            *         <tr><td>{@code GTK.overlay_scrolling}</td><td>{@link Boolean}</td></tr>
      +     *         <tr><td>{@code GTK.network_metered}</td><td>{@link Boolean}</td></tr>
            *         <tr></tr>
            *     </tbody>
            * </table>
      @@ -631,6 +635,20 @@
      
               boolean isReducedTransparency();
      
      +        /**
      +         * Specifies whether applications should minimize the amount of internet traffic, which users
      +         * might request because they are on a metered network or a limited data plan.
      +         * <p>
      +         * If the platform does not report this preference, this property defaults to {@code false}.
      +         *
      +         * @return the {@code reducedData} property
      +         * @defaultValue {@code false}
      +         * @since 24
      +         */
      +        ReadOnlyBooleanProperty reducedDataProperty();
      +
      +        boolean isReducedData();
      +
               /**
                * The platform color scheme, which specifies whether applications should prefer light text on
                * dark backgrounds, or dark text on light backgrounds.

            mstrauss Michael Strauß
            mstrauss Michael Strauß
            Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: