Only include ServerHost constant in debug builds

Summary: I recently changed the implementation of `getServerHost` to be more expensive. I am excluding it from constants in non-debug builds, since loading that module lies on a critical path.

Reviewed By: axe-fb

Differential Revision: D12982150

fbshipit-source-id: eaaa50418726dbb2da2d517d0810f39b0dc7fac2
This commit is contained in:
Stepan Hruda
2018-11-09 17:00:54 -08:00
committed by Facebook Github Bot
parent be282b5287
commit 2bf0d54f15

View File

@@ -14,6 +14,7 @@ import android.provider.Settings.Secure;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.common.build.ReactBuildConfig;
import com.facebook.react.module.annotations.ReactModule;
import java.util.HashMap;
@@ -69,7 +70,9 @@ public class AndroidInfoModule extends ReactContextBaseJavaModule {
constants.put("Serial", Build.SERIAL);
constants.put("Fingerprint", Build.FINGERPRINT);
constants.put("Model", Build.MODEL);
constants.put("ServerHost", AndroidInfoHelpers.getServerHost());
if (ReactBuildConfig.DEBUG) {
constants.put("ServerHost", AndroidInfoHelpers.getServerHost());
}
constants.put("isTesting", "true".equals(System.getProperty(IS_TESTING)));
constants.put("reactNativeVersion", ReactNativeVersion.VERSION);
constants.put("uiMode", uiMode());