From d2d8ca61edc1a4e6be999f1d70d820002026fe63 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 9 May 2022 15:21:38 -0700 Subject: [PATCH] remove NBSProxy Only matters for GPlay case, and that's too few people to be worth worrying about. --- xwords4/android/app/build.gradle | 2 -- .../org/eehouse/android/xw4/NBSProto.java | 21 ++++------- .../java/org/eehouse/android/xw4/Perms23.java | 4 +-- .../java/org/eehouse/android/xw4/XWApp.java | 35 +------------------ 4 files changed, 8 insertions(+), 54 deletions(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index 7625e9999..cbad3b5f2 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -375,8 +375,6 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-extensions:2.0.+' annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.+' - implementation 'com.github.eehouse:nbsproxy:v0.2.2' - // 3:1.2.+ crashes on API 18 and below (all Jelly Beans) because // java.nio.charset.StandardCharsets not defined. Does not crash on // 19 (KitKat). diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NBSProto.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NBSProto.java index e610598f6..2d47a72a7 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NBSProto.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NBSProto.java @@ -34,8 +34,6 @@ import java.util.Set; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.eehouse.android.nbsplib.NBSProxy; - import org.eehouse.android.xw4.MultiService.DictFetchOwner; import org.eehouse.android.xw4.MultiService.MultiEvent; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; @@ -331,7 +329,8 @@ public class NBSProto { { Context context = XWApp.getContext(); boolean success = false; - if ( XWPrefs.getNBSEnabled( context ) ) { + if ( XWPrefs.getNBSEnabled( context ) + && !Perms23.Perm.SEND_SMS.isBanned( context ) ) { // Try send-to-self if ( XWPrefs.getSMSToSelfEnabled( context ) ) { @@ -348,19 +347,11 @@ public class NBSProto { if ( !success ) { try { SmsManager mgr = SmsManager.getDefault(); - boolean useProxy = Perms23.Perm.SEND_SMS.isBanned( context ) - && NBSProxy.isInstalled( context ); - PendingIntent sent = useProxy ? null - : makeStatusIntent( context, MSG_SENT ); - PendingIntent delivery = useProxy ? null - : makeStatusIntent( context, MSG_DELIVERED ); + PendingIntent sent = makeStatusIntent( context, MSG_SENT ); + PendingIntent delivery = makeStatusIntent( context, MSG_DELIVERED ); for ( byte[] fragment : fragments ) { - if ( useProxy ) { - NBSProxy.send( context, phone, port, fragment ); - } else { - mgr.sendDataMessage( phone, null, port, fragment, - sent, delivery ); - } + mgr.sendDataMessage( phone, null, port, fragment, + sent, delivery ); } success = true; } catch ( IllegalArgumentException iae ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Perms23.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Perms23.java index 7bc525c7c..0b4a337ab 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Perms23.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Perms23.java @@ -34,8 +34,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.eehouse.android.nbsplib.NBSProxy; - import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.loc.LocUtils; @@ -447,7 +445,7 @@ public class Perms23 { switch ( perm ) { case SEND_SMS: case RECEIVE_SMS: - workaroundKnown = workaroundKnown && NBSProxy.isInstalled( context ); + workaroundKnown = false; break; default: Log.e( TAG, "bannedWithWorkaround(): unexpected perm %s", perm ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java index cffd6e903..ca5fa80f7 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java @@ -30,8 +30,6 @@ import android.content.Context; import android.graphics.Color; import android.os.Build; -import org.eehouse.android.nbsplib.NBSProxy; - import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.XwJNI; @@ -40,7 +38,7 @@ import java.util.UUID; import static androidx.lifecycle.Lifecycle.Event.ON_ANY; public class XWApp extends Application - implements LifecycleObserver, NBSProxy.Callbacks { + implements LifecycleObserver { private static final String TAG = XWApp.class.getSimpleName(); public static final boolean DEBUG_EXP_TIMERS = false; @@ -93,7 +91,6 @@ public class XWApp extends Application WiDirWrapper.init( this ); mPort = Short.valueOf( getString( R.string.nbs_port ) ); - NBSProxy.register( this, mPort, BuildConfig.APPLICATION_ID, this ); DupeModeTimer.init( this ); @@ -127,36 +124,6 @@ public class XWApp extends Application super.onTerminate(); } - // NBSProxy.Callbacks - @Override - public void onProxyAppLaunched() - { - Log.d( TAG, "onProxyAppLaunched()" ); - } - - @Override - public void onPermissionsGranted() - { - Log.d( TAG, "onPermissionsGranted()" ); - GameUtils.resendAllIf( this, CommsConnType.COMMS_CONN_SMS ); - } - - @Override - public void onDataReceived( short port, String fromPhone, byte[] data ) - { - Assert.assertTrue( port == mPort || !BuildConfig.DEBUG ); - NBSProto.handleFrom( this, data, fromPhone, port ); - } - - @Override - public void onRegResponse( boolean appReached, boolean needsInitialLaunch ) - { - if ( needsInitialLaunch ) { - String channelID = Channels.getChannelID( this, Channels.ID.NBSPROXY ); - NBSProxy.postLaunchNotification( this, channelID, R.drawable.notify ); - } - } - public static UUID getAppUUID() { if ( null == s_UUID ) {