8222819: Remove setting of headless property on MacOS from launcher code.
authorprr
Fri, 03 May 2019 17:06:42 -0700
changeset 54869 72d194129803
parent 54868 88b769ae99c7
child 54870 0d49e7c0b4fa
8222819: Remove setting of headless property on MacOS from launcher code. Reviewed-by: serb, rriggs
src/java.base/macosx/native/libjava/java_props_macosx.c
src/java.base/macosx/native/libjava/java_props_macosx.h
src/java.base/share/classes/jdk/internal/util/SystemProps.java
src/java.base/share/native/libjava/System.c
src/java.base/share/native/libjava/java_props.h
src/java.base/unix/native/libjava/java_props_md.c
--- a/src/java.base/macosx/native/libjava/java_props_macosx.c	Thu May 02 10:48:56 2019 -0700
+++ b/src/java.base/macosx/native/libjava/java_props_macosx.c	Fri May 03 17:06:42 2019 -0700
@@ -212,25 +212,6 @@
     }
 }
 
-int isInAquaSession() {
-    // environment variable to bypass the aqua session check
-    char *ev = getenv("AWT_FORCE_HEADFUL");
-    if (ev && (strncasecmp(ev, "true", 4) == 0)) {
-        // if "true" then tell the caller we're in an Aqua session without actually checking
-        return 1;
-    }
-    // Is the WindowServer available?
-    SecuritySessionId session_id;
-    SessionAttributeBits session_info;
-    OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
-    if (status == noErr) {
-        if (session_info & sessionHasGraphicAccess) {
-            return 1;
-        }
-    }
-    return 0;
-}
-
 // 10.9 SDK does not include the NSOperatingSystemVersion struct.
 // For now, create our own
 typedef struct {
--- a/src/java.base/macosx/native/libjava/java_props_macosx.h	Thu May 02 10:48:56 2019 -0700
+++ b/src/java.base/macosx/native/libjava/java_props_macosx.h	Fri May 03 17:06:42 2019 -0700
@@ -30,4 +30,3 @@
 void setOSNameAndVersion(java_props_t *sprops);
 void setUserHome(java_props_t *sprops);
 void setProxyProperties(java_props_t *sProps);
-int isInAquaSession();
--- a/src/java.base/share/classes/jdk/internal/util/SystemProps.java	Thu May 02 10:48:56 2019 -0700
+++ b/src/java.base/share/classes/jdk/internal/util/SystemProps.java	Fri May 03 17:06:42 2019 -0700
@@ -91,7 +91,6 @@
         putIfAbsent(props, "ftp.nonProxyHosts", raw.propDefault(Raw._ftp_nonProxyHosts_NDX));
         putIfAbsent(props, "socksNonProxyHosts", raw.propDefault(Raw._socksNonProxyHosts_NDX));
         putIfAbsent(props, "awt.toolkit", raw.propDefault(Raw._awt_toolkit_NDX));
-        putIfAbsent(props, "java.awt.headless", raw.propDefault(Raw._java_awt_headless_NDX));
         putIfAbsent(props, "sun.arch.abi", raw.propDefault(Raw._sun_arch_abi_NDX));
         putIfAbsent(props, "sun.arch.data.model", raw.propDefault(Raw._sun_arch_data_model_NDX));
         putIfAbsent(props, "sun.os.patch.level", raw.propDefault(Raw._sun_os_patch_level_NDX));
@@ -205,8 +204,7 @@
         @Native private static final int _http_proxyPort_NDX = 1 + _http_proxyHost_NDX;
         @Native private static final int _https_proxyHost_NDX = 1 + _http_proxyPort_NDX;
         @Native private static final int _https_proxyPort_NDX = 1 + _https_proxyHost_NDX;
-        @Native private static final int _java_awt_headless_NDX = 1 + _https_proxyPort_NDX;
-        @Native private static final int _java_io_tmpdir_NDX = 1 + _java_awt_headless_NDX;
+        @Native private static final int _java_io_tmpdir_NDX = 1 + _https_proxyPort_NDX;
         @Native private static final int _line_separator_NDX = 1 + _java_io_tmpdir_NDX;
         @Native private static final int _os_arch_NDX = 1 + _line_separator_NDX;
         @Native private static final int _os_name_NDX = 1 + _os_arch_NDX;
--- a/src/java.base/share/native/libjava/System.c	Thu May 02 10:48:56 2019 -0700
+++ b/src/java.base/share/native/libjava/System.c	Fri May 03 17:06:42 2019 -0700
@@ -161,8 +161,6 @@
     PUTPROP(propArray, _sun_cpu_isalist_NDX, sprops->cpu_isalist);
 
 #ifdef MACOSX
-    PUTPROP(propArray, _java_awt_headless_NDX, sprops->awt_headless);
-
     /* Proxy setting properties */
     if (sprops->httpProxyEnabled) {
         PUTPROP(propArray, _http_proxyHost_NDX, sprops->httpHost);
--- a/src/java.base/share/native/libjava/java_props.h	Thu May 02 10:48:56 2019 -0700
+++ b/src/java.base/share/native/libjava/java_props.h	Fri May 03 17:06:42 2019 -0700
@@ -102,8 +102,6 @@
     char *socksPort;
 
     char *exceptionList;
-
-    char *awt_headless;  /* java.awt.headless setting, if NULL (default) will not be set */
 #endif
 
 } java_props_t;
--- a/src/java.base/unix/native/libjava/java_props_md.c	Thu May 02 10:48:56 2019 -0700
+++ b/src/java.base/unix/native/libjava/java_props_md.c	Fri May 03 17:06:42 2019 -0700
@@ -398,9 +398,6 @@
 #ifdef MACOSX
     // Always the same Toolkit on Mac OS X
     sprops.awt_toolkit = "sun.lwawt.macosx.LWCToolkit";
-
-    // check if we're in a GUI login session and set java.awt.headless=true if not
-    sprops.awt_headless = isInAquaSession() ? NULL : "true";
 #else
     sprops.awt_toolkit = "sun.awt.X11.XToolkit";
 #endif