8222819: Remove setting of headless property on MacOS from launcher code

Reviewed-by: serb, rriggs
This commit is contained in:
Phil Race 2019-05-03 17:06:42 -07:00
parent 501a6f3423
commit 5c2948942f
6 changed files with 1 additions and 30 deletions
src/java.base
macosx/native/libjava
share
classes/jdk/internal/util
native/libjava
unix/native/libjava

@ -212,25 +212,6 @@ char *setupMacOSXLocale(int cat) {
}
}
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 {

@ -30,4 +30,3 @@ const char *convertToPOSIXLocale(const char* src);
void setOSNameAndVersion(java_props_t *sprops);
void setUserHome(java_props_t *sprops);
void setProxyProperties(java_props_t *sProps);
int isInAquaSession();

@ -91,7 +91,6 @@ public final class SystemProps {
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 @@ public final class SystemProps {
@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;

@ -161,8 +161,6 @@ Java_jdk_internal_util_SystemProps_00024Raw_platformProperties(JNIEnv *env, jcla
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);

@ -102,8 +102,6 @@ typedef struct {
char *socksPort;
char *exceptionList;
char *awt_headless; /* java.awt.headless setting, if NULL (default) will not be set */
#endif
} java_props_t;

@ -398,9 +398,6 @@ GetJavaProperties(JNIEnv *env)
#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