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 f7444785ab
commit c4bba7db74
8 changed files with 64 additions and 11 deletions

View file

@ -775,7 +775,8 @@ public class DBUtils {
{
HashMap<Long, CommsConnTypeSet> result = new HashMap<Long,CommsConnTypeSet>();
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 );
synchronized( s_dbHelper ) {
Cursor cursor = s_db.query( DBHelper.TABLE_NAME_SUM, columns,

View file

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

View file

@ -1085,7 +1085,8 @@ public class RelayService extends XWJIService
byte[] msg, String msgNo, // not used yet
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();
try {
DataOutputStream out = new DataOutputStream( bas );

View file

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

View file

@ -68,7 +68,26 @@ public class XWPrefs {
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 )

View file

@ -56,6 +56,7 @@
<string name="key_robot_name">key_robot_name</string>
<string name="key_default_robodict">key_default_robodict</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_connect_frequency">key_connect_frequency</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_sms_toself">key_enable_sms_toself</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_nag_intervals">key_nag_intervals</string>
<string name="key_download_path">key_download_path</string>
@ -324,6 +324,12 @@
<item>@string/radio_name_cdma</item>
</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">
<item>@string/force_tablet_default</item>
<item>@string/force_tablet_phone</item>

View file

@ -2820,4 +2820,23 @@
please check https://eehouse.org/sms.html for updates on the
situation.</string>
<string name="sms_banned_ok_only">The Google Play Store version of
CrossWords no longer supports inviting or playing by Data
SMS.</string>
<string name="button_more_info">Read more</string>
<string name="banned_nbs_perms">This game is configured to
communicate via Data SMS, but apps from the Google Play Store are no
longer allowed to do so (with rare exceptions). You can still open
the game, but it may not be able to send or receive moves.\n\nYou
can remove the Data SMS communication setting, or use the \"Read
more\" button to check my progress developing an
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>

View file

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