additions for debugging

toward tracking down relay stalls, log a bit more in resend process and
add UI to support an option where there's no reliance on
polling (i.e. FCM only)
This commit is contained in:
Eric House 2019-03-17 21:17:36 -07:00
parent aa2564114a
commit 89cb97c3bb
8 changed files with 51 additions and 11 deletions

View file

@ -775,7 +775,8 @@ public class DBUtils {
{ {
HashMap<Long, CommsConnTypeSet> result = new HashMap<Long,CommsConnTypeSet>(); HashMap<Long, CommsConnTypeSet> result = new HashMap<Long,CommsConnTypeSet>();
String[] columns = { ROW_ID, DBHelper.CONTYPE }; String[] columns = { ROW_ID, DBHelper.CONTYPE };
String selection = String.format( "%s > 0", DBHelper.NPACKETSPENDING ); String selection = String.format( "%s > 0 AND %s != %d", DBHelper.NPACKETSPENDING,
DBHelper.GROUPID, getArchiveGroup( context ) );
initDB( context ); initDB( context );
synchronized( s_dbHelper ) { synchronized( s_dbHelper ) {
Cursor cursor = s_db.query( DBHelper.TABLE_NAME_SUM, columns, Cursor cursor = s_db.query( DBHelper.TABLE_NAME_SUM, columns,

View file

@ -1371,9 +1371,10 @@ public class GameUtils {
if ( null != gamePtr ) { if ( null != gamePtr ) {
int nSent = XwJNI.comms_resendAll( gamePtr, true, int nSent = XwJNI.comms_resendAll( gamePtr, true,
m_filter, false ); m_filter, false );
// Log.d( TAG, "Resender.doInBackground(): sent %d "
// + "messages for rowid %d", nSent, rowid );
nSentTotal += sink.numSent(); nSentTotal += sink.numSent();
// Log.d( TAG, "Resender.doInBackground(): sent %d "
// + "messages for rowid %d (total now %d)",
// nSent, rowid, nSentTotal );
} else { } else {
Log.d( TAG, "Resender.doInBackground(): loadMakeGame()" Log.d( TAG, "Resender.doInBackground(): loadMakeGame()"
+ " failed for rowid %d", rowid ); + " failed for rowid %d", rowid );

View file

@ -1085,7 +1085,8 @@ public class RelayService extends XWJIService
byte[] msg, String msgNo, // not used yet byte[] msg, String msgNo, // not used yet
long timestamp ) long timestamp )
{ {
Log.d( TAG, "sendNoConnMessage(msgNo=%s, len=%d)", msgNo, msg.length ); Log.d( TAG, "sendNoConnMessage(rowid=%d, msgNo=%s, len=%d)", rowid,
msgNo, msg.length );
ByteArrayOutputStream bas = new ByteArrayOutputStream(); ByteArrayOutputStream bas = new ByteArrayOutputStream();
try { try {
DataOutputStream out = new DataOutputStream( bas ); DataOutputStream out = new DataOutputStream( bas );

View file

@ -35,12 +35,14 @@ public class XWListPreference extends ListPreference {
m_context = context; m_context = context;
} }
@Override
protected void onAttachedToActivity() protected void onAttachedToActivity()
{ {
super.onAttachedToActivity(); super.onAttachedToActivity();
setSummary( getPersistedString( "" ) ); setSummary( getPersistedString( "" ) );
} }
@Override
protected boolean persistString( String value ) protected boolean persistString( String value )
{ {
setSummary( value ); setSummary( value );

View file

@ -68,7 +68,26 @@ public class XWPrefs {
public static boolean getIgnoreFCM( Context context ) public static boolean getIgnoreFCM( Context context )
{ {
return getPrefsBoolean( context, R.string.key_ignore_fcm, false ); String curValue =
XWPrefs.getPrefsString( context, R.string.key_relay_poll );
String noFCMString = context.getString(R.string.relay_poll_name_no_fcm);
boolean result = noFCMString.equals( curValue );
// Log.d( TAG, "getIgnoreFCM() => %b (%s vs %s)", result,
// curValue, noFCMString );
return result;
}
// Not used yet
public static boolean getFCMOnly( Context context )
{
String curValue =
XWPrefs.getPrefsString( context, R.string.key_relay_poll );
String FCMOnlyString = context
.getString( R.string.relay_poll_name_no_polling );
boolean result = FCMOnlyString.equals( curValue );
Log.d( TAG, "getFCMOnly() => %b (%s vs %s)", result,
curValue, FCMOnlyString );
return result;
} }
public static boolean getToastFCM( Context context ) public static boolean getToastFCM( Context context )

View file

@ -56,6 +56,7 @@
<string name="key_robot_name">key_robot_name</string> <string name="key_robot_name">key_robot_name</string>
<string name="key_default_robodict">key_default_robodict</string> <string name="key_default_robodict">key_default_robodict</string>
<string name="key_default_phonies">key_default_phonies2</string> <string name="key_default_phonies">key_default_phonies2</string>
<string name="key_relay_poll">key_relay_poll</string>
<string name="key_default_timerenabled">key_default_timerenabled</string> <string name="key_default_timerenabled">key_default_timerenabled</string>
<string name="key_connect_frequency">key_connect_frequency</string> <string name="key_connect_frequency">key_connect_frequency</string>
<string name="key_notify_sound">key_notify_sound</string> <string name="key_notify_sound">key_notify_sound</string>
@ -127,7 +128,6 @@
<string name="key_enable_nfc_toself">key_enable_nfc_toself</string> <string name="key_enable_nfc_toself">key_enable_nfc_toself</string>
<string name="key_enable_sms_toself">key_enable_sms_toself</string> <string name="key_enable_sms_toself">key_enable_sms_toself</string>
<string name="key_enable_smsproto">key_enable_smsproto</string> <string name="key_enable_smsproto">key_enable_smsproto</string>
<string name="key_ignore_fcm">key_ignore_fcm</string>
<string name="key_show_fcm">key_show_fcm</string> <string name="key_show_fcm">key_show_fcm</string>
<string name="key_nag_intervals">key_nag_intervals</string> <string name="key_nag_intervals">key_nag_intervals</string>
<string name="key_download_path">key_download_path</string> <string name="key_download_path">key_download_path</string>
@ -324,6 +324,12 @@
<item>@string/radio_name_cdma</item> <item>@string/radio_name_cdma</item>
</string-array> </string-array>
<string-array name="relay_poll_names">
<item>@string/relay_poll_name_no_fcm</item>
<item>@string/relay_poll_name_no_polling</item>
<item>@string/relay_poll_name_both</item>
</string-array>
<string-array name="force_tablet_names"> <string-array name="force_tablet_names">
<item>@string/force_tablet_default</item> <item>@string/force_tablet_default</item>
<item>@string/force_tablet_phone</item> <item>@string/force_tablet_phone</item>

View file

@ -2821,4 +2821,10 @@
can remove the Data SMS communication setting, or use the \"Read can remove the Data SMS communication setting, or use the \"Read
more\" button to check my progress developing an more\" button to check my progress developing an
alternative.</string> alternative.</string>
<string name="relay_poll_title">Check for moves how?</string>
<string name="relay_poll_name_no_fcm">Poll only: no FCM messages</string>
<string name="relay_poll_name_no_polling">FCM only: no polling</string>
<string name="relay_poll_name_both">Default: mix polling and FCM</string>
</resources> </resources>

View file

@ -358,6 +358,7 @@
</PreferenceScreen> </PreferenceScreen>
<!-- For Debugging -->
<PreferenceScreen android:title="@string/advanced" <PreferenceScreen android:title="@string/advanced"
android:summary="@string/advanced_summary" android:summary="@string/advanced_summary"
> >
@ -393,11 +394,14 @@
<PreferenceScreen android:title="@string/pref_group_relay_title" <PreferenceScreen android:title="@string/pref_group_relay_title"
android:summary="@string/pref_group_relay_summary" android:summary="@string/pref_group_relay_summary"
> >
<CheckBoxPreference android:key="@string/key_ignore_fcm" <org.eehouse.android.xw4.XWListPreference
android:title="@string/ignore_fcm_title" android:key="@string/key_relay_poll"
android:summary="@string/ignore_fcm_summary" android:title="@string/relay_poll_title"
android:defaultValue="false" android:entries="@array/relay_poll_names"
/> android:entryValues="@array/relay_poll_names"
android:defaultValue="@string/relay_poll_name_both"
/>
<CheckBoxPreference android:key="@string/key_show_fcm" <CheckBoxPreference android:key="@string/key_show_fcm"
android:title="@string/show_fcm_title" android:title="@string/show_fcm_title"
android:defaultValue="false" android:defaultValue="false"