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

View file

@ -433,16 +433,16 @@ public class XwJNI {
public static byte[][]
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,
phone, port, forceNow, waitSecs );
phone, port, waitSecs );
}
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,
@ -538,8 +538,7 @@ public class XwJNI {
private static native byte[][]
smsproto_prepOutbound( long jniState, SMS_CMD cmd, int gameID, byte[] buf,
String phone, int port, boolean forceNow,
/*out*/int[] waitSecs );
String phone, int port, /*out*/int[] waitSecs );
private static native SMSProtoMsg[] smsproto_prepInbound( long jniState,
byte[] data,

View file

@ -128,7 +128,6 @@
<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_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_nag_intervals">key_nag_intervals</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_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_summary">Skip radio when phone numbers same</string>

View file

@ -446,11 +446,6 @@
<PreferenceScreen android:title="@string/pref_group_sms_title"
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"
android:title="@string/enable_sms_toself_title"
android:summary="@string/enable_sms_toself_summary"

View file

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