remove option to use backwards-compatible smsproto

Everybody should have upgraded by now...
This commit is contained in:
Eric House 2019-07-06 10:49:12 -07:00
parent df14108e4e
commit 22f697cd37
7 changed files with 12 additions and 32 deletions

View file

@ -149,14 +149,12 @@ public class NBSProto {
private static LinkedBlockingQueue<QueueElem> sQueue = new LinkedBlockingQueue<>(); private static LinkedBlockingQueue<QueueElem> sQueue = new LinkedBlockingQueue<>();
static class NBSProtoThread extends Thread { static class NBSProtoThread extends Thread {
private boolean mForceNow;
private int[] mWaitSecs = { 0 }; private int[] mWaitSecs = { 0 };
private Set<String> mCachedDests = new HashSet<>(); private Set<String> mCachedDests = new HashSet<>();
NBSProtoThread() NBSProtoThread()
{ {
super( "NBSProtoThread" ); super( "NBSProtoThread" );
mForceNow = !XWPrefs.getSMSProtoEnabled( XWApp.getContext() );
} }
@Override @Override
@ -213,7 +211,6 @@ public class NBSProto {
// already waiting for possible combination with other messages. // already waiting for possible combination with other messages.
private boolean processRetry() private boolean processRetry()
{ {
Assert.assertTrue( !mForceNow || !BuildConfig.DEBUG );
boolean handled = false; boolean handled = false;
for ( Iterator<String> iter = mCachedDests.iterator(); for ( Iterator<String> iter = mCachedDests.iterator();
@ -221,8 +218,7 @@ public class NBSProto {
String[] portAndPhone = iter.next().split( "\0", 2 ); String[] portAndPhone = iter.next().split( "\0", 2 );
short port = Short.valueOf(portAndPhone[0]); short port = Short.valueOf(portAndPhone[0]);
byte[][] msgs = XwJNI byte[][] msgs = XwJNI
.smsproto_prepOutbound( portAndPhone[1], port, .smsproto_prepOutbound( portAndPhone[1], port, mWaitSecs );
mForceNow, mWaitSecs );
if ( null != msgs ) { if ( null != msgs ) {
sendBuffers( msgs, portAndPhone[1], port ); sendBuffers( msgs, portAndPhone[1], port );
handled = true; handled = true;
@ -238,10 +234,9 @@ public class NBSProto {
private boolean processSend( SendElem elem ) private boolean processSend( SendElem elem )
{ {
boolean forceNow = mForceNow;
byte[][] msgs = XwJNI byte[][] msgs = XwJNI
.smsproto_prepOutbound( elem.cmd, elem.gameID, elem.data, .smsproto_prepOutbound( elem.cmd, elem.gameID, elem.data,
elem.phone, elem.port, forceNow, mWaitSecs ); elem.phone, elem.port, mWaitSecs );
if ( null != msgs ) { if ( null != msgs ) {
sendBuffers( msgs, elem.phone, elem.port ); sendBuffers( msgs, elem.phone, elem.port );
} }

View file

@ -100,11 +100,6 @@ public class XWPrefs {
return getPrefsBoolean( context, R.string.key_enable_sms_toself, false ); return getPrefsBoolean( context, R.string.key_enable_sms_toself, false );
} }
public static boolean getSMSProtoEnabled( Context context )
{
return getPrefsBoolean( context, R.string.key_enable_smsproto, false );
}
public static boolean getHideNewgameButtons( Context context ) public static boolean getHideNewgameButtons( Context context )
{ {
return getPrefsBoolean( context, R.string.key_hide_newgames, return getPrefsBoolean( context, R.string.key_hide_newgames,

View file

@ -433,16 +433,16 @@ public class XwJNI {
public static byte[][] public static byte[][]
smsproto_prepOutbound( SMS_CMD cmd, int gameID, byte[] buf, String phone, smsproto_prepOutbound( SMS_CMD cmd, int gameID, byte[] buf, String phone,
int port, boolean forceNow, /*out*/ int[] waitSecs ) int port, /*out*/ int[] waitSecs )
{ {
return smsproto_prepOutbound( getJNI().m_ptrGlobals, cmd, gameID, buf, return smsproto_prepOutbound( getJNI().m_ptrGlobals, cmd, gameID, buf,
phone, port, forceNow, waitSecs ); phone, port, waitSecs );
} }
public static byte[][] public static byte[][]
smsproto_prepOutbound( String phone, int port, boolean forceNow, int[] waitSecs ) smsproto_prepOutbound( String phone, int port, int[] waitSecs )
{ {
return smsproto_prepOutbound( SMS_CMD.NONE, 0, null, phone, port, forceNow, waitSecs ); return smsproto_prepOutbound( SMS_CMD.NONE, 0, null, phone, port, waitSecs );
} }
public static SMSProtoMsg[] smsproto_prepInbound( byte[] data, public static SMSProtoMsg[] smsproto_prepInbound( byte[] data,
@ -538,8 +538,7 @@ public class XwJNI {
private static native byte[][] private static native byte[][]
smsproto_prepOutbound( long jniState, SMS_CMD cmd, int gameID, byte[] buf, smsproto_prepOutbound( long jniState, SMS_CMD cmd, int gameID, byte[] buf,
String phone, int port, boolean forceNow, String phone, int port, /*out*/int[] waitSecs );
/*out*/int[] waitSecs );
private static native SMSProtoMsg[] smsproto_prepInbound( long jniState, private static native SMSProtoMsg[] smsproto_prepInbound( long jniState,
byte[] data, byte[] data,

View file

@ -128,7 +128,6 @@
<string name="key_enable_dup_invite">key_enable_dup_invite</string> <string name="key_enable_dup_invite">key_enable_dup_invite</string>
<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_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>

View file

@ -2583,9 +2583,6 @@
<string name="enable_nfc_toself_title">Enable NFC to self</string> <string name="enable_nfc_toself_title">Enable NFC to self</string>
<string name="enable_nfc_toself_summary">Fake invitation to aid debugging</string> <string name="enable_nfc_toself_summary">Fake invitation to aid debugging</string>
<string name="enable_smsproto_title">Use new/experimental SMS code</string>
<string name="enable_smsproto_summary">(Requires that opponent be using it too)</string>
<string name="enable_sms_toself_title">Short-circuit SMS to self</string> <string name="enable_sms_toself_title">Short-circuit SMS to self</string>
<string name="enable_sms_toself_summary">Skip radio when phone numbers same</string> <string name="enable_sms_toself_summary">Skip radio when phone numbers same</string>

View file

@ -446,11 +446,6 @@
<PreferenceScreen android:title="@string/pref_group_sms_title" <PreferenceScreen android:title="@string/pref_group_sms_title"
android:summary="@string/pref_group_sms_summary" android:summary="@string/pref_group_sms_summary"
> >
<CheckBoxPreference android:key="@string/key_enable_smsproto"
android:title="@string/enable_smsproto_title"
android:summary="@string/enable_smsproto_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_enable_sms_toself" <CheckBoxPreference android:key="@string/key_enable_sms_toself"
android:title="@string/enable_sms_toself_title" android:title="@string/enable_sms_toself_title"
android:summary="@string/enable_sms_toself_summary" android:summary="@string/enable_sms_toself_summary"

View file

@ -841,8 +841,7 @@ msgArrayToJMsgArray( JNIEnv* env, const SMSMsgArray* arr )
JNIEXPORT jobjectArray JNICALL JNIEXPORT jobjectArray JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_smsproto_1prepOutbound Java_org_eehouse_android_xw4_jni_XwJNI_smsproto_1prepOutbound
( JNIEnv* env, jclass C, jlong jniGlobalPtr, jobject jCmd, jint jGameID, ( JNIEnv* env, jclass C, jlong jniGlobalPtr, jobject jCmd, jint jGameID,
jbyteArray jData, jstring jToPhone, jint jPort, jboolean jForce, jbyteArray jData, jstring jToPhone, jint jPort, jintArray jWaitSecsArr )
jintArray jWaitSecsArr )
{ {
jobjectArray result = NULL; jobjectArray result = NULL;
JNIGlobalState* globalState = (JNIGlobalState*)jniGlobalPtr; JNIGlobalState* globalState = (JNIGlobalState*)jniGlobalPtr;
@ -858,9 +857,10 @@ Java_org_eehouse_android_xw4_jni_XwJNI_smsproto_1prepOutbound
const char* toPhone = (*env)->GetStringUTFChars( env, jToPhone, NULL ); const char* toPhone = (*env)->GetStringUTFChars( env, jToPhone, NULL );
XP_U16 waitSecs; XP_U16 waitSecs;
SMSMsgArray* arr = smsproto_prepOutbound( globalState->smsProto, cmd, jGameID, SMSMsgArray* arr = smsproto_prepOutbound( globalState->smsProto, cmd,
(const XP_U8*)data, len, jGameID, (const XP_U8*)data, len,
toPhone, jPort, jForce, &waitSecs ); toPhone, jPort, XP_FALSE,
&waitSecs );
if ( !!arr ) { if ( !!arr ) {
result = msgArrayToByteArrays( env, arr ); result = msgArrayToByteArrays( env, arr );
smsproto_freeMsgArray( globalState->smsProto, arr ); smsproto_freeMsgArray( globalState->smsProto, arr );