From b500a4646d97b272cbc0d3b676befb0e721b770a Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 29 Jul 2015 19:48:56 -0700 Subject: [PATCH 01/10] use different uuid for dbg variant so it's not cross-sending BT messages with other variants, causing among other problems spurious "deleted on other device" warnings. --- xwords4/android/XWords4/jni/Android.mk | 1 + xwords4/android/XWords4/jni/xwjni.c | 10 ++++++++-- xwords4/android/scripts/common_targets.xml | 1 + xwords4/common/comms.h | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/jni/Android.mk b/xwords4/android/XWords4/jni/Android.mk index 9f02d5721..b0c291a38 100644 --- a/xwords4/android/XWords4/jni/Android.mk +++ b/xwords4/android/XWords4/jni/Android.mk @@ -41,6 +41,7 @@ LOCAL_DEFINES += \ -DCOMMON_LAYOUT \ -DCOMMS_VERSION=1 \ -DINITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS} \ + -DVARIANT=\"${VARIANT}\" \ -DRELAY_ROOM_DEFAULT=\"\" \ -D__LITTLE_ENDIAN \ diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index 29ae3ea43..5248bd815 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -471,8 +471,14 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getUUID { jstring jstr = NULL; #ifdef XWFEATURE_BLUETOOTH - const char* uuid = XW_BT_UUID; - XP_LOGF( "uuid: %s", uuid ); + const char* uuid; + if ( 0 == XP_STRCMP( VARIANT, "xw4" ) ) { + uuid = XW_BT_UUID; + } else if ( 0 == XP_STRCMP( VARIANT, "xw4dbg" ) ) { + uuid = XW_BT_UUID_DBG; + } else { + XP_ASSERT(0); + } jstr = (*env)->NewStringUTF( env, uuid ); #endif return jstr; diff --git a/xwords4/android/scripts/common_targets.xml b/xwords4/android/scripts/common_targets.xml index ef91f60e6..83a1c640b 100644 --- a/xwords4/android/scripts/common_targets.xml +++ b/xwords4/android/scripts/common_targets.xml @@ -35,6 +35,7 @@ + Date: Sat, 1 Aug 2015 22:17:13 -0700 Subject: [PATCH 02/10] fix NPE reported by crittercism --- .../XWords4/src/org/eehouse/android/xw4/BoardDelegate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java index db6f32c9e..4d3dd8de2 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -2119,7 +2119,8 @@ public class BoardDelegate extends DelegateBase private void pingBTRemotes() { - if ( m_connTypes.contains( CommsConnType.COMMS_CONN_BT ) ) { + if ( null != m_connTypes + && m_connTypes.contains( CommsConnType.COMMS_CONN_BT ) ) { CommsAddrRec[] addrs = XwJNI.comms_getAddrs( m_jniGamePtr ); for ( CommsAddrRec addr : addrs ) { if ( addr.contains( CommsConnType.COMMS_CONN_BT ) ) { From 6871ef24a6a6c65aa6bf8453dd516832f395703f Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 1 Aug 2015 22:39:00 -0700 Subject: [PATCH 03/10] move several strings, including app name, NBS port, and url prefix, into generated .xml file so Dbg and regular variants can co-exist better Conflicts: xwords4/android/XWords4/archive/R.java --- .../android/XWords4-dbg/res/values/.gitignore | 3 ++- xwords4/android/XWords4/res/values/.gitignore | 2 +- .../XWords4/res/values/common_rsrc.xml | 3 --- xwords4/android/scripts/genvers.sh | 24 +++++++++++++++++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/xwords4/android/XWords4-dbg/res/values/.gitignore b/xwords4/android/XWords4-dbg/res/values/.gitignore index 72e6f3e45..3347fc597 100644 --- a/xwords4/android/XWords4-dbg/res/values/.gitignore +++ b/xwords4/android/XWords4-dbg/res/values/.gitignore @@ -1,4 +1,5 @@ -git_string.xml strings.xml styles.xml common_rsrc.xml +gen_strings.xml +app_name.xml diff --git a/xwords4/android/XWords4/res/values/.gitignore b/xwords4/android/XWords4/res/values/.gitignore index 02baea630..a8f81aa73 100644 --- a/xwords4/android/XWords4/res/values/.gitignore +++ b/xwords4/android/XWords4/res/values/.gitignore @@ -1 +1 @@ -/git_string.xml +/gen_strings.xml diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 47b6085b8..ead3423ee 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -139,15 +139,12 @@ eehouse.org application/org.eehouse.android.xw4 eehouse.org - /and/ application/x-xwordsinvite http://eehouse.org/and_wordlists http://eehouse.org/xw4/info.py - 3344 - diff --git a/xwords4/android/scripts/genvers.sh b/xwords4/android/scripts/genvers.sh index 7f77f5b71..0a828d42e 100755 --- a/xwords4/android/scripts/genvers.sh +++ b/xwords4/android/scripts/genvers.sh @@ -22,6 +22,23 @@ cd ../ GITVERSION=$(../scripts/gitversion.sh) +case $VARIANT in + xw4) + APPNAME=Crosswords + SMSPORT=3344 + INVITE_PREFIX=/and/ + ;; + xw4dbg) + APPNAME=CrossDbg + SMSPORT=3345 + INVITE_PREFIX=/anddbg/ + ;; + *) + usage + ;; +esac + + # Need to verify that R.java is unmodified; otherwise we can't set # this constant!!! Shouldn't be a problem with release builds, # though. @@ -31,12 +48,15 @@ fi # TODO: deal with case where there's no hash available -- exported # code maybe? Better: gitversion.sh does that. -cat < ${BUILD_DIR}/res/values/git_string.xml +cat < ${BUILD_DIR}/res/values/gen_strings.xml - + + $APPNAME $GITVERSION + $SMSPORT + $INVITE_PREFIX EOF From a5f332dd1d814d1b833b0afad18994f3d4895e30 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 2 Aug 2015 10:29:17 -0700 Subject: [PATCH 04/10] different logging TAG for different variants --- .../android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java | 2 +- xwords4/android/scripts/genvers.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java index 971abf66a..c7c24a3dc 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java @@ -43,7 +43,7 @@ import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; public class DbgUtils { - private static final String TAG = "XW4"; + private static final String TAG = BuildConstants.DBG_TAG; private static boolean s_doLog = BuildConfig.DEBUG; private static Time s_time = new Time(); diff --git a/xwords4/android/scripts/genvers.sh b/xwords4/android/scripts/genvers.sh index 0a828d42e..6a7ab7cb5 100755 --- a/xwords4/android/scripts/genvers.sh +++ b/xwords4/android/scripts/genvers.sh @@ -27,11 +27,13 @@ case $VARIANT in APPNAME=Crosswords SMSPORT=3344 INVITE_PREFIX=/and/ + DBG_TAG=XW4 ;; xw4dbg) APPNAME=CrossDbg SMSPORT=3345 INVITE_PREFIX=/anddbg/ + DBG_TAG=X4BG ;; *) usage @@ -75,6 +77,7 @@ class BuildConstants { public static final boolean CHAT_SUPPORTED = $CHAT_SUPPORTED; public static final boolean THUMBNAIL_SUPPORTED = $THUMBNAIL_SUPPORTED; public static final long BUILD_STAMP = $(date +'%s'); + public static final String DBG_TAG = "$DBG_TAG"; } EOF From 1e7f51a88d1cd2a41c36297529a86733ad74dd75 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 2 Aug 2015 14:14:19 -0700 Subject: [PATCH 05/10] move last-pressed button to bottom of screen where it's natural to look for it --- xwords4/android/XWords4/res/layout/smsinviter.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xwords4/android/XWords4/res/layout/smsinviter.xml b/xwords4/android/XWords4/res/layout/smsinviter.xml index bc8255fb7..7487a14e3 100644 --- a/xwords4/android/XWords4/res/layout/smsinviter.xml +++ b/xwords4/android/XWords4/res/layout/smsinviter.xml @@ -28,13 +28,6 @@ android:padding="20dp" /> -