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/archive/R.java b/xwords4/android/XWords4/archive/R.java
index 209638e3c..ec0d1b1f9 100644
--- a/xwords4/android/XWords4/archive/R.java
+++ b/xwords4/android/XWords4/archive/R.java
@@ -84,30 +84,29 @@ public final class R {
public static final int add_player=0x7f0a0030;
public static final int advertise_new_room_check=0x7f0a0037;
public static final int blessed_label=0x7f0a0057;
- public static final int board_menu_chat=0x7f0a009f;
- public static final int board_menu_dict=0x7f0a009b;
+ public static final int board_menu_chat=0x7f0a009e;
+ public static final int board_menu_dict=0x7f0a009a;
public static final int board_menu_done=0x7f0a0085;
- public static final int board_menu_file_about=0x7f0a0093;
public static final int board_menu_file_prefs=0x7f0a0092;
- public static final int board_menu_flip=0x7f0a009d;
+ public static final int board_menu_flip=0x7f0a009c;
public static final int board_menu_game_counts=0x7f0a008b;
public static final int board_menu_game_history=0x7f0a008d;
public static final int board_menu_game_left=0x7f0a008c;
- public static final int board_menu_game_netstats=0x7f0a0094;
+ public static final int board_menu_game_netstats=0x7f0a0093;
public static final int board_menu_game_resend=0x7f0a008f;
public static final int board_menu_game_resign=0x7f0a008e;
- public static final int board_menu_hint_next=0x7f0a0099;
- public static final int board_menu_hint_prev=0x7f0a0098;
- public static final int board_menu_invite=0x7f0a0095;
- public static final int board_menu_juggle=0x7f0a009c;
- public static final int board_menu_toggle=0x7f0a00a0;
+ public static final int board_menu_hint_next=0x7f0a0098;
+ public static final int board_menu_hint_prev=0x7f0a0097;
+ public static final int board_menu_invite=0x7f0a0094;
+ public static final int board_menu_juggle=0x7f0a009b;
+ public static final int board_menu_toggle=0x7f0a009f;
public static final int board_menu_trade=0x7f0a0086;
public static final int board_menu_trade_cancel=0x7f0a0087;
public static final int board_menu_trade_commit=0x7f0a0088;
public static final int board_menu_tray=0x7f0a008a;
- public static final int board_menu_undo_current=0x7f0a009a;
+ public static final int board_menu_undo_current=0x7f0a0099;
public static final int board_menu_undo_last=0x7f0a0089;
- public static final int board_menu_zoom=0x7f0a009e;
+ public static final int board_menu_zoom=0x7f0a009d;
public static final int board_root=0x7f0a0002;
public static final int board_view=0x7f0a0003;
public static final int boardsize_spinner=0x7f0a0043;
@@ -123,7 +122,7 @@ public final class R {
public static final int chat_button=0x7f0a0080;
public static final int chat_edit=0x7f0a0010;
public static final int chat_history=0x7f0a000f;
- public static final int chat_menu_clear=0x7f0a00a1;
+ public static final int chat_menu_clear=0x7f0a00a0;
public static final int checkbox=0x7f0a0051;
public static final int color_display_sample=0x7f0a0012;
public static final int color_edit_sample=0x7f0a0013;
@@ -138,11 +137,11 @@ public final class R {
public static final int dict_label=0x7f0a0069;
public static final int dict_spinner=0x7f0a002d;
public static final int dictlist_button=0x7f0a007f;
- public static final int dicts_delete=0x7f0a00a4;
- public static final int dicts_deselect_all=0x7f0a00a3;
- public static final int dicts_download=0x7f0a00a2;
- public static final int dicts_move=0x7f0a00a5;
- public static final int dicts_select=0x7f0a00a6;
+ public static final int dicts_delete=0x7f0a00a3;
+ public static final int dicts_deselect_all=0x7f0a00a2;
+ public static final int dicts_download=0x7f0a00a1;
+ public static final int dicts_move=0x7f0a00a4;
+ public static final int dicts_select=0x7f0a00a5;
public static final int divider=0x7f0a0024;
public static final int download_button=0x7f0a0072;
public static final int dwnld_message=0x7f0a004f;
@@ -161,35 +160,35 @@ public final class R {
public static final int game_locked_check=0x7f0a0028;
public static final int game_name=0x7f0a0046;
public static final int gamel_menu_checkmoves=0x7f0a0091;
- public static final int games_game_config=0x7f0a00b2;
- public static final int games_game_copy=0x7f0a00b7;
- public static final int games_game_delete=0x7f0a00b1;
- public static final int games_game_move=0x7f0a00b3;
- public static final int games_game_new_from=0x7f0a00b5;
- public static final int games_game_rename=0x7f0a00b6;
- public static final int games_game_reset=0x7f0a00b4;
- public static final int games_group_default=0x7f0a00bb;
- public static final int games_group_delete=0x7f0a00ba;
- public static final int games_group_movedown=0x7f0a00b9;
- public static final int games_group_moveup=0x7f0a00b8;
- public static final int games_group_rename=0x7f0a00bc;
- public static final int games_menu_about=0x7f0a00ae;
- public static final int games_menu_checkmoves=0x7f0a00b0;
- public static final int games_menu_checkupdates=0x7f0a00bd;
- public static final int games_menu_dicts=0x7f0a00ac;
- public static final int games_menu_email=0x7f0a00ad;
- public static final int games_menu_loaddb=0x7f0a00bf;
- public static final int games_menu_newgame_net=0x7f0a00a8;
- public static final int games_menu_newgame_solo=0x7f0a00a7;
- public static final int games_menu_newgroup=0x7f0a00a9;
- public static final int games_menu_prefs=0x7f0a00aa;
- public static final int games_menu_rateme=0x7f0a00ab;
- public static final int games_menu_resend=0x7f0a00af;
- public static final int games_menu_storedb=0x7f0a00be;
+ public static final int games_game_config=0x7f0a00b1;
+ public static final int games_game_copy=0x7f0a00b6;
+ public static final int games_game_delete=0x7f0a00b0;
+ public static final int games_game_move=0x7f0a00b2;
+ public static final int games_game_new_from=0x7f0a00b4;
+ public static final int games_game_rename=0x7f0a00b5;
+ public static final int games_game_reset=0x7f0a00b3;
+ public static final int games_group_default=0x7f0a00ba;
+ public static final int games_group_delete=0x7f0a00b9;
+ public static final int games_group_movedown=0x7f0a00b8;
+ public static final int games_group_moveup=0x7f0a00b7;
+ public static final int games_group_rename=0x7f0a00bb;
+ public static final int games_menu_about=0x7f0a00ad;
+ public static final int games_menu_checkmoves=0x7f0a00af;
+ public static final int games_menu_checkupdates=0x7f0a00bc;
+ public static final int games_menu_dicts=0x7f0a00ab;
+ public static final int games_menu_email=0x7f0a00ac;
+ public static final int games_menu_loaddb=0x7f0a00be;
+ public static final int games_menu_newgame_net=0x7f0a00a7;
+ public static final int games_menu_newgame_solo=0x7f0a00a6;
+ public static final int games_menu_newgroup=0x7f0a00a8;
+ public static final int games_menu_prefs=0x7f0a00a9;
+ public static final int games_menu_rateme=0x7f0a00aa;
+ public static final int games_menu_resend=0x7f0a00ae;
+ public static final int games_menu_storedb=0x7f0a00bd;
public static final int games_menu_study=0x7f0a0090;
public static final int group_done=0x7f0a0084;
- public static final int group_exchange=0x7f0a0096;
- public static final int group_hint=0x7f0a0097;
+ public static final int group_exchange=0x7f0a0095;
+ public static final int group_hint=0x7f0a0096;
public static final int hideable=0x7f0a004b;
public static final int hints_allowed=0x7f0a003c;
public static final int invite_desc=0x7f0a0009;
@@ -201,10 +200,10 @@ public final class R {
public static final int label=0x7f0a0025;
public static final int lang_separator=0x7f0a002b;
public static final int lang_spinner=0x7f0a002c;
- public static final int loc_item_check=0x7f0a00c1;
- public static final int loc_item_clear=0x7f0a00c0;
- public static final int loc_item_copy_bless=0x7f0a00c3;
- public static final int loc_item_copy_eng=0x7f0a00c2;
+ public static final int loc_item_check=0x7f0a00c0;
+ public static final int loc_item_clear=0x7f0a00bf;
+ public static final int loc_item_copy_bless=0x7f0a00c2;
+ public static final int loc_item_copy_eng=0x7f0a00c1;
public static final int loc_search_button=0x7f0a005e;
public static final int loc_search_field=0x7f0a005d;
public static final int local_label=0x7f0a0059;
@@ -252,11 +251,11 @@ public final class R {
public static final int send_button=0x7f0a0011;
public static final int show_remote=0x7f0a001e;
public static final int shuffle_button=0x7f0a007d;
- public static final int slmenu_clear_sel=0x7f0a00c8;
- public static final int slmenu_copy_sel=0x7f0a00c7;
- public static final int slmenu_deselect_all=0x7f0a00c6;
- public static final int slmenu_lookup_sel=0x7f0a00c4;
- public static final int slmenu_select_all=0x7f0a00c5;
+ public static final int slmenu_clear_sel=0x7f0a00c7;
+ public static final int slmenu_copy_sel=0x7f0a00c6;
+ public static final int slmenu_deselect_all=0x7f0a00c5;
+ public static final int slmenu_lookup_sel=0x7f0a00c3;
+ public static final int slmenu_select_all=0x7f0a00c4;
public static final int smart_robot=0x7f0a0040;
public static final int state=0x7f0a004d;
public static final int summary=0x7f0a0060;
@@ -458,9 +457,7 @@ public final class R {
/**
*/
public static final int alert_empty_dict_fmt=0x7f0501d8;
- /** The name of the app. Not localized!
- */
- public static final int app_name=0x7f050001;
+ public static final int app_name=0x7f05007b;
public static final int app_not_found_fmt=0x7f0502ad;
public static final int app_version=0x7f050000;
/** the background color of the area outside the board,
@@ -986,7 +983,7 @@ public final class R {
public static final int default_dict=0x7f05011f;
/** other
*/
- public static final int default_host=0x7f050076;
+ public static final int default_host=0x7f050075;
/** label within default wordlists in app preferences
*/
public static final int default_language=0x7f0502ae;
@@ -1018,7 +1015,7 @@ public final class R {
new game
*/
public static final int default_robodict=0x7f050120;
- public static final int default_update_url=0x7f05007c;
+ public static final int default_update_url=0x7f05007a;
public static final int delete_dicts=0x7f050299;
/**
Playing via SMS is currently disabled.
@@ -1041,7 +1038,7 @@ public final class R {
public static final int dict_on_server=0x7f05029f;
/** string name="invite_mime">text/plainkey_notagain_sms_ready
*/
- public static final int key_notagain_newselect=0x7f05004c;
- public static final int key_notagain_relay=0x7f05004f;
- public static final int key_notagain_sync=0x7f05004b;
- public static final int key_notagain_trading=0x7f05005e;
- public static final int key_notagain_turnchanged=0x7f05005c;
- public static final int key_notagain_undo=0x7f050055;
- public static final int key_notagain_unlock=0x7f050057;
- public static final int key_notagain_zoom=0x7f050054;
- public static final int key_notify_sound=0x7f050033;
- public static final int key_notify_vibrate=0x7f050034;
- public static final int key_peek_other=0x7f050009;
- public static final int key_player0=0x7f050010;
- public static final int key_player1=0x7f050011;
- public static final int key_player1_name=0x7f05002d;
- public static final int key_player2=0x7f050012;
- public static final int key_player3=0x7f050013;
- public static final int key_proxy_port=0x7f050021;
- public static final int key_relay_host=0x7f05001d;
- public static final int key_relay_port=0x7f05001e;
- public static final int key_relay_regid=0x7f050045;
- public static final int key_relay_regid_ackd=0x7f050046;
- public static final int key_ringer_zoom=0x7f05000c;
- public static final int key_robot_name=0x7f05002e;
- public static final int key_show_arrow=0x7f050003;
- public static final int key_show_sms=0x7f050025;
- public static final int key_skip_confirm=0x7f050006;
- public static final int key_sms_phones=0x7f050041;
- public static final int key_sms_port=0x7f050022;
- public static final int key_sort_tiles=0x7f050008;
- public static final int key_square_tiles=0x7f050004;
- public static final int key_studyon=0x7f050039;
- public static final int key_summary_field=0x7f05003a;
- public static final int key_thumbsize=0x7f050038;
- public static final int key_tile_back=0x7f050018;
- public static final int key_udp_interval=0x7f05004a;
- public static final int key_update_prerel=0x7f050020;
- public static final int key_update_url=0x7f05001f;
- public static final int key_xlations_enabled=0x7f05006f;
- public static final int key_xlations_locale=0x7f05006e;
+ public static final int key_notagain_newselect=0x7f05004b;
+ public static final int key_notagain_relay=0x7f05004e;
+ public static final int key_notagain_sync=0x7f05004a;
+ public static final int key_notagain_trading=0x7f05005d;
+ public static final int key_notagain_turnchanged=0x7f05005b;
+ public static final int key_notagain_undo=0x7f050054;
+ public static final int key_notagain_unlock=0x7f050056;
+ public static final int key_notagain_zoom=0x7f050053;
+ public static final int key_notify_sound=0x7f050032;
+ public static final int key_notify_vibrate=0x7f050033;
+ public static final int key_peek_other=0x7f050008;
+ public static final int key_player0=0x7f05000f;
+ public static final int key_player1=0x7f050010;
+ public static final int key_player1_name=0x7f05002c;
+ public static final int key_player2=0x7f050011;
+ public static final int key_player3=0x7f050012;
+ public static final int key_proxy_port=0x7f050020;
+ public static final int key_relay_host=0x7f05001c;
+ public static final int key_relay_port=0x7f05001d;
+ public static final int key_relay_regid=0x7f050044;
+ public static final int key_relay_regid_ackd=0x7f050045;
+ public static final int key_ringer_zoom=0x7f05000b;
+ public static final int key_robot_name=0x7f05002d;
+ public static final int key_show_arrow=0x7f050002;
+ public static final int key_show_sms=0x7f050024;
+ public static final int key_skip_confirm=0x7f050005;
+ public static final int key_sms_phones=0x7f050040;
+ public static final int key_sms_port=0x7f050021;
+ public static final int key_sort_tiles=0x7f050007;
+ public static final int key_square_tiles=0x7f050003;
+ public static final int key_studyon=0x7f050038;
+ public static final int key_summary_field=0x7f050039;
+ public static final int key_thumbsize=0x7f050037;
+ public static final int key_tile_back=0x7f050017;
+ public static final int key_udp_interval=0x7f050049;
+ public static final int key_update_prerel=0x7f05001f;
+ public static final int key_update_url=0x7f05001e;
+ public static final int key_xlations_enabled=0x7f05006e;
+ public static final int key_xlations_locale=0x7f05006d;
/** text of separator marking out the language area of the
dialog. First is used for single-device games, and second
for networked games (where players aren't allowed to have
@@ -2732,7 +2729,7 @@ public final class R {
language
*/
public static final int xlator=0x7f0501be;
- public static final int xwords_nfc_mime=0x7f050077;
+ public static final int xwords_nfc_mime=0x7f050076;
}
public static final class style {
public static final int about_items=0x7f080005;
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/utilwrapper.c b/xwords4/android/XWords4/jni/utilwrapper.c
index ed100cf5e..d9f6cd1c3 100644
--- a/xwords4/android/XWords4/jni/utilwrapper.c
+++ b/xwords4/android/XWords4/jni/utilwrapper.c
@@ -643,11 +643,11 @@ static void
and_util_deviceRegistered( XW_UtilCtxt* uc, DevIDType typ,
const XP_UCHAR* idRelay )
{
- UTIL_CBK_HEADER( "deviceRegistered", "(Lorg/eehouse/android/xw4/"
- "jni/UtilCtxt$DevIDType;Ljava/lang/String;)V" );
+ UTIL_CBK_HEADER( "deviceRegistered",
+ "(L" PKG_PATH("jni/UtilCtxt$DevIDType") ";Ljava/lang/String;)V" );
jstring jstr = (*env)->NewStringUTF( env, idRelay );
jobject jtyp = intToJEnum( env, typ,
- "org/eehouse/android/xw4/jni/UtilCtxt$DevIDType" );
+ PKG_PATH("jni/UtilCtxt$DevIDType") );
(*env)->CallVoidMethod( env, util->jutil, mid, jtyp, jstr );
deleteLocalRefs( env, jstr, jtyp, DELETE_NO_REF );
UTIL_CBK_TAIL();
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/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"
/>
-
-
+
+
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..34a9f39ac 100644
--- a/xwords4/android/XWords4/res/values/common_rsrc.xml
+++ b/xwords4/android/XWords4/res/values/common_rsrc.xml
@@ -2,8 +2,6 @@
-
- Crosswordskey_color_tiles
@@ -139,15 +137,12 @@
eehouse.orgapplication/org.eehouse.android.xw4eehouse.org
- /and/application/x-xwordsinvitehttp://eehouse.org/and_wordlistshttp://eehouse.org/xw4/info.py
- 3344
-
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 ) ) {
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..c36156fc4 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();
@@ -78,6 +78,14 @@ public class DbgUtils {
}
} // logf
+ public static void logdf( String format, Object... args )
+ {
+ if ( s_doLog && BuildConfig.DEBUG ) {
+ Formatter formatter = new Formatter();
+ logf( formatter.format( format, args ).toString() );
+ }
+ } // logdf
+
public static void showf( Context context, String format, Object... args )
{
Formatter formatter = new Formatter();
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java
index 406edc407..dfe0ea19f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java
@@ -71,7 +71,9 @@ public class SMSService extends XWService {
private static final String MSG_SENT = "MSG_SENT";
private static final String MSG_DELIVERED = "MSG_DELIVERED";
- private static final int SMS_PROTO_VERSION = 0;
+ private static final int SMS_PROTO_VERSION_ORIG = 0;
+ private static final int SMS_PROTO_VERSION_WITHPORT = 1;
+ private static final int SMS_PROTO_VERSION = SMS_PROTO_VERSION_WITHPORT;
private static final int MAX_LEN_TEXT = 100;
private static final int MAX_LEN_BINARY = 100;
private static final int MAX_MSG_COUNT = 16; // 1.6K enough? Should be....
@@ -449,6 +451,7 @@ public class SMSService extends XWService {
ByteArrayOutputStream bas = new ByteArrayOutputStream( 128 );
DataOutputStream das = new DataOutputStream( bas );
das.writeByte( SMS_PROTO_VERSION );
+ das.writeShort( getNBSPort() );
das.writeByte( cmd.ordinal() );
das.write( bytes, 0, bytes.length );
das.flush();
@@ -568,7 +571,7 @@ public class SMSService extends XWService {
{
boolean success = true;
if ( index == 0 && count == 1 ) { // most common case
- disAssemble( senderPhone, msg );
+ success = disAssemble( senderPhone, msg );
} else if ( count > 0 && count < MAX_MSG_COUNT && index < count ) {
// required? Should always be in main thread.
synchronized( s_partialMsgs ) {
@@ -585,7 +588,7 @@ public class SMSService extends XWService {
}
if ( store.add( index, msg ).isComplete() ) {
- disAssemble( senderPhone, store.messageData() );
+ success = disAssemble( senderPhone, store.messageData() );
perPhone.remove( id );
}
}
@@ -595,21 +598,33 @@ public class SMSService extends XWService {
return success;
}
- private void disAssemble( String senderPhone, byte[] fullMsg )
+ private boolean disAssemble( String senderPhone, byte[] fullMsg )
{
+ boolean success = false;
DataInputStream dis =
new DataInputStream( new ByteArrayInputStream(fullMsg) );
try {
byte proto = dis.readByte();
- if ( SMS_PROTO_VERSION != proto ) {
+ short myPort = getNBSPort();
+ short sentPort;
+ if ( SMS_PROTO_VERSION_WITHPORT > proto ) {
+ sentPort = myPort;
+ } else {
+ sentPort = dis.readShort();
+ }
+ if ( SMS_PROTO_VERSION < proto ) {
DbgUtils.logf( "SMSService.disAssemble: bad proto %d from %s;"
+ " dropping", proto, senderPhone );
sendResult( MultiEvent.BAD_PROTO_SMS, senderPhone );
+ } else if ( sentPort != myPort ) {
+ DbgUtils.logdf( "SMSService.disAssemble(): received on port %d"
+ + " but expected %d", sentPort, myPort );
} else {
SMS_CMD cmd = SMS_CMD.values()[dis.readByte()];
byte[] rest = new byte[dis.available()];
dis.read( rest );
receive( cmd, rest, senderPhone );
+ success = true;
}
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
@@ -617,6 +632,7 @@ public class SMSService extends XWService {
// enum this older code doesn't know about; drop it
DbgUtils.logf( "disAssemble: dropping message with too-new enum" );
}
+ return success;
}
private void postNotification( String phone, int gameID, long rowid )
@@ -673,7 +689,7 @@ public class SMSService extends XWService {
}
if ( !success ) {
- short nbsPort = (short)Integer.parseInt( getString( R.string.nbs_port ) );
+ short nbsPort = getNBSPort();
try {
SmsManager mgr = SmsManager.getDefault();
PendingIntent sent = makeStatusIntent( MSG_SENT );
@@ -782,6 +798,16 @@ public class SMSService extends XWService {
return result;
}
+ private static Short s_nbsPort = null;
+ private short getNBSPort()
+ {
+ if ( null == s_nbsPort ) {
+ String asStr = getString( R.string.nbs_port );
+ s_nbsPort = new Short((short)Integer.parseInt( asStr ) );
+ }
+ return s_nbsPort;
+ }
+
private class SMSMsgSink extends MultiMsgSink {
public SMSMsgSink( Context context ) {
super( context );
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 @@
+ ${BUILD_DIR}/res/values/git_string.xml
+cat < ${BUILD_DIR}/res/values/gen_strings.xml
-
+
+ $APPNAME$GITVERSION
+ $SMSPORT
+ $INVITE_PREFIX
EOF
@@ -55,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
diff --git a/xwords4/common/comms.h b/xwords4/common/comms.h
index b6615294f..dcd95cdf2 100644
--- a/xwords4/common/comms.h
+++ b/xwords4/common/comms.h
@@ -59,6 +59,7 @@ typedef enum {
#ifdef XWFEATURE_BLUETOOTH
# define XW_BT_UUID "7be0d084-ff89-4d6d-9c78-594773a6f963"
+# define XW_BT_UUID_DBG "b079b640-35fe-11e5-a432-0002a5d5c51b"
# define XW_BT_NAME "Crosswords"
#endif