diff --git a/xwords4/android/XWords4-dbg/build.xml b/xwords4/android/XWords4-dbg/build.xml index 67cca737f..dfc0150f1 100644 --- a/xwords4/android/XWords4-dbg/build.xml +++ b/xwords4/android/XWords4-dbg/build.xml @@ -58,6 +58,7 @@ + diff --git a/xwords4/android/XWords4/build.xml b/xwords4/android/XWords4/build.xml index d04aea9f4..f1ce52211 100644 --- a/xwords4/android/XWords4/build.xml +++ b/xwords4/android/XWords4/build.xml @@ -59,6 +59,7 @@ + diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/WiDirService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/WiDirService.java index c15a1469f..ba882029d 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/WiDirService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/WiDirService.java @@ -76,7 +76,6 @@ public class WiDirService extends XWService { private static final String MAC_ADDR_KEY = "p2p_mac_addr"; private static final String SERVICE_NAME = "srvc_" + BuildConstants.VARIANT; private static final String SERVICE_REG_TYPE = "_presence._tcp"; - private static final boolean WIFI_DIRECT_ENABLED = true; private static final int OWNER_PORT = 5432; private enum P2PAction { _NONE, @@ -138,7 +137,7 @@ public class WiDirService extends XWService { { int result; - if ( WIFI_DIRECT_ENABLED && null != intent ) { + if ( BuildConstants.WIDIR_ENABLED && null != intent ) { result = Service.START_STICKY; int ordinal = intent.getIntExtra( KEY_CMD, -1 ); @@ -205,7 +204,7 @@ public class WiDirService extends XWService { public static boolean supported() { - return WIFI_DIRECT_ENABLED; + return BuildConstants.WIDIR_ENABLED; } public static boolean connecting() { @@ -216,7 +215,7 @@ public class WiDirService extends XWService { public static String getMyMacAddress( Context context ) { - if ( WIFI_DIRECT_ENABLED ) { + if ( BuildConstants.WIDIR_ENABLED ) { if ( null == sMacAddress && null != context ) { sMacAddress = DBUtils.getStringFor( context, MAC_ADDR_KEY, null ); } @@ -305,7 +304,7 @@ public class WiDirService extends XWService { public static void activityResumed( Activity activity ) { - if ( WIFI_DIRECT_ENABLED && sHavePermission ) { + if ( BuildConstants.WIDIR_ENABLED && sHavePermission ) { if ( initListeners( activity ) ) { activity.registerReceiver( sReceiver, sIntentFilter ); DbgUtils.logd( TAG, "activityResumed() done" ); @@ -316,7 +315,7 @@ public class WiDirService extends XWService { public static void activityPaused( Activity activity ) { - if ( WIFI_DIRECT_ENABLED && sHavePermission ) { + if ( BuildConstants.WIDIR_ENABLED && sHavePermission ) { Assert.assertNotNull( sReceiver ); // No idea why I'm seeing this exception... try { @@ -345,7 +344,7 @@ public class WiDirService extends XWService { private static boolean initListeners( final Context context ) { boolean succeeded = false; - if ( WIFI_DIRECT_ENABLED ) { + if ( BuildConstants.WIDIR_ENABLED ) { if ( null == sIface ) { try { WifiP2pManager mgr = getMgr(); @@ -593,7 +592,7 @@ public class WiDirService extends XWService { private static void setDiscoveryListeners( WifiP2pManager mgr ) { - if ( WIFI_DIRECT_ENABLED ) { + if ( BuildConstants.WIDIR_ENABLED ) { DnsSdServiceResponseListener srl = new DnsSdServiceResponseListener() { @Override public void onDnsSdServiceAvailable(String instanceName, @@ -1024,7 +1023,7 @@ public class WiDirService extends XWService { @Override public void onReceive( Context context, Intent intent ) { - if ( WIFI_DIRECT_ENABLED ) { + if ( BuildConstants.WIDIR_ENABLED ) { String action = intent.getAction(); DbgUtils.logd( TAG, "got intent: " + intent.toString() ); diff --git a/xwords4/android/scripts/common_targets.xml b/xwords4/android/scripts/common_targets.xml index 5a497dc4d..38e0cf3c4 100644 --- a/xwords4/android/scripts/common_targets.xml +++ b/xwords4/android/scripts/common_targets.xml @@ -65,6 +65,8 @@ + + diff --git a/xwords4/android/scripts/genvers.sh b/xwords4/android/scripts/genvers.sh index 1950e0461..99b2c40ad 100755 --- a/xwords4/android/scripts/genvers.sh +++ b/xwords4/android/scripts/genvers.sh @@ -8,10 +8,13 @@ VARIANT="" CLIENT_VERS_RELAY="" GCM_SENDER_ID=${GCM_SENDER_ID:-""} CRITTERCISM_APP_ID=${CRITTERCISM_APP_ID:-""} +WIDIR_ENABLED=false usage() { echo "usage: $0 --variant --client-vers \\" echo " [--vers-outfile path/to/versout.txt]" + echo " [--widir-enabled true|false]" + exit 1 } @@ -30,6 +33,10 @@ while [ $# -gt 0 ]; do OUT_PATH=$2 shift ;; + --widir-enabled) + WIDIR_ENABLED=$2 + shift + ;; *) usage ;; @@ -113,6 +120,7 @@ public class BuildConstants { public static final String VARIANT = "$VARIANT"; public static final String GCM_SENDER_ID = "${GCM_SENDER_ID}"; public static final String CRITTERCISM_APP_ID = "${CRITTERCISM_APP_ID}"; + public static final boolean WIDIR_ENABLED = ${WIDIR_ENABLED}; } EOF