remove NBSProxy

Only matters for GPlay case, and that's too few people to be worth
worrying about.
This commit is contained in:
Eric House 2022-05-09 15:21:38 -07:00
parent da23bfe23b
commit d2d8ca61ed
4 changed files with 8 additions and 54 deletions

View file

@ -375,8 +375,6 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.+' implementation 'androidx.lifecycle:lifecycle-extensions:2.0.+'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler: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 // 3:1.2.+ crashes on API 18 and below (all Jelly Beans) because
// java.nio.charset.StandardCharsets not defined. Does not crash on // java.nio.charset.StandardCharsets not defined. Does not crash on
// 19 (KitKat). // 19 (KitKat).

View file

@ -34,8 +34,6 @@ import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.eehouse.android.nbsplib.NBSProxy;
import org.eehouse.android.xw4.MultiService.DictFetchOwner; import org.eehouse.android.xw4.MultiService.DictFetchOwner;
import org.eehouse.android.xw4.MultiService.MultiEvent; import org.eehouse.android.xw4.MultiService.MultiEvent;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
@ -331,7 +329,8 @@ public class NBSProto {
{ {
Context context = XWApp.getContext(); Context context = XWApp.getContext();
boolean success = false; boolean success = false;
if ( XWPrefs.getNBSEnabled( context ) ) { if ( XWPrefs.getNBSEnabled( context )
&& !Perms23.Perm.SEND_SMS.isBanned( context ) ) {
// Try send-to-self // Try send-to-self
if ( XWPrefs.getSMSToSelfEnabled( context ) ) { if ( XWPrefs.getSMSToSelfEnabled( context ) ) {
@ -348,20 +347,12 @@ public class NBSProto {
if ( !success ) { if ( !success ) {
try { try {
SmsManager mgr = SmsManager.getDefault(); SmsManager mgr = SmsManager.getDefault();
boolean useProxy = Perms23.Perm.SEND_SMS.isBanned( context ) PendingIntent sent = makeStatusIntent( context, MSG_SENT );
&& NBSProxy.isInstalled( context ); PendingIntent delivery = makeStatusIntent( context, MSG_DELIVERED );
PendingIntent sent = useProxy ? null
: makeStatusIntent( context, MSG_SENT );
PendingIntent delivery = useProxy ? null
: makeStatusIntent( context, MSG_DELIVERED );
for ( byte[] fragment : fragments ) { for ( byte[] fragment : fragments ) {
if ( useProxy ) {
NBSProxy.send( context, phone, port, fragment );
} else {
mgr.sendDataMessage( phone, null, port, fragment, mgr.sendDataMessage( phone, null, port, fragment,
sent, delivery ); sent, delivery );
} }
}
success = true; success = true;
} catch ( IllegalArgumentException iae ) { } catch ( IllegalArgumentException iae ) {
Log.w( TAG, "sendBuffers(%s): %s", phone, iae.toString() ); Log.w( TAG, "sendBuffers(%s): %s", phone, iae.toString() );

View file

@ -34,8 +34,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.eehouse.android.nbsplib.NBSProxy;
import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.loc.LocUtils; import org.eehouse.android.xw4.loc.LocUtils;
@ -447,7 +445,7 @@ public class Perms23 {
switch ( perm ) { switch ( perm ) {
case SEND_SMS: case SEND_SMS:
case RECEIVE_SMS: case RECEIVE_SMS:
workaroundKnown = workaroundKnown && NBSProxy.isInstalled( context ); workaroundKnown = false;
break; break;
default: default:
Log.e( TAG, "bannedWithWorkaround(): unexpected perm %s", perm ); Log.e( TAG, "bannedWithWorkaround(): unexpected perm %s", perm );

View file

@ -30,8 +30,6 @@ import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
import org.eehouse.android.nbsplib.NBSProxy;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.XwJNI; import org.eehouse.android.xw4.jni.XwJNI;
@ -40,7 +38,7 @@ import java.util.UUID;
import static androidx.lifecycle.Lifecycle.Event.ON_ANY; import static androidx.lifecycle.Lifecycle.Event.ON_ANY;
public class XWApp extends Application public class XWApp extends Application
implements LifecycleObserver, NBSProxy.Callbacks { implements LifecycleObserver {
private static final String TAG = XWApp.class.getSimpleName(); private static final String TAG = XWApp.class.getSimpleName();
public static final boolean DEBUG_EXP_TIMERS = false; public static final boolean DEBUG_EXP_TIMERS = false;
@ -93,7 +91,6 @@ public class XWApp extends Application
WiDirWrapper.init( this ); WiDirWrapper.init( this );
mPort = Short.valueOf( getString( R.string.nbs_port ) ); mPort = Short.valueOf( getString( R.string.nbs_port ) );
NBSProxy.register( this, mPort, BuildConfig.APPLICATION_ID, this );
DupeModeTimer.init( this ); DupeModeTimer.init( this );
@ -127,36 +124,6 @@ public class XWApp extends Application
super.onTerminate(); 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() public static UUID getAppUUID()
{ {
if ( null == s_UUID ) { if ( null == s_UUID ) {