refactor: move inline tests for being on emulator into a static method

This commit is contained in:
Eric House 2015-11-17 07:19:37 -08:00
parent a2e00794fa
commit 8626fdf027
3 changed files with 4 additions and 3 deletions

View file

@ -87,7 +87,7 @@ public class CommsTransport implements TransportProcs,
m_done = false;
boolean failed = true;
try {
if ( Build.PRODUCT.contains("sdk") ) {
if ( XWApp.onEmulator() ) {
System.setProperty("java.net.preferIPv6Addresses", "false");
}

View file

@ -48,7 +48,7 @@ public class NetStateCache {
private static boolean s_netAvail = false;
private static boolean s_isWifi;
private static PvtBroadcastReceiver s_receiver;
private static final boolean s_onSim = Build.PRODUCT.contains("sdk");
private static final boolean s_onSim = XWApp.onEmulator();
public static void register( Context context, StateChangedIf proc )
{

View file

@ -112,7 +112,8 @@ public class XWApp extends Application {
public static boolean onEmulator()
{
if ( null == s_onEmulator ) {
s_onEmulator = new Boolean( "google_sdk".equals(Build.MODEL) );
s_onEmulator = new Boolean( "google_sdk".equals(Build.MODEL)
|| Build.PRODUCT.startsWith("vbox") );
}
return s_onEmulator;
}