From b23b83700963a275c74f9eae1bec1d179ab2975c Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 29 Nov 2018 09:30:14 -0800 Subject: [PATCH 01/25] fix path name string causing JNI crash on emulator And catch NPE that also seems to be emulator-only --- .../src/main/java/org/eehouse/android/xw4/WiDirService.java | 2 ++ xwords4/android/jni/utilwrapper.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java index 693647426..e7695401e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java @@ -214,6 +214,8 @@ public class WiDirService extends XWService { sHavePermission = false; } catch ( SecurityException se ) { // perm not in manifest sHavePermission = false; + } catch ( NullPointerException npe ) { // Seeing this on Oreo emulator + sHavePermission = false; } } diff --git a/xwords4/android/jni/utilwrapper.c b/xwords4/android/jni/utilwrapper.c index 4e948a906..03eab0bf4 100644 --- a/xwords4/android/jni/utilwrapper.c +++ b/xwords4/android/jni/utilwrapper.c @@ -702,10 +702,10 @@ and_dutil_deviceRegistered( XW_DUtilCtxt* duc, DevIDType typ, const XP_UCHAR* idRelay ) { DUTIL_CBK_HEADER( "deviceRegistered", - "(L" PKG_PATH("jni/UtilCtxt$DevIDType") ";Ljava/lang/String;)V" ); + "(L" PKG_PATH("jni/DUtilCtxt$DevIDType") ";Ljava/lang/String;)V" ); jstring jstr = (*env)->NewStringUTF( env, idRelay ); jobject jtyp = intToJEnum( env, typ, - PKG_PATH("jni/UtilCtxt$DevIDType") ); + PKG_PATH("jni/DUtilCtxt$DevIDType") ); (*env)->CallVoidMethod( env, dutil->jdutil, mid, jtyp, jstr ); deleteLocalRefs( env, jstr, jtyp, DELETE_NO_REF ); DUTIL_CBK_TAIL(); From 0a0107dd7fdc5eaadc631141b10b3054fd8d10c5 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 29 Nov 2018 09:35:08 -0800 Subject: [PATCH 02/25] fix to contact relay in foreground on Oreo+ Background still needs a lot of work. --- .../org/eehouse/android/xw4/RelayService.java | 27 ++++++++++++++++++- .../java/org/eehouse/android/xw4/XWApp.java | 2 ++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java index 501891edd..ada0eeeb0 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java @@ -192,7 +192,32 @@ public class RelayService extends XWService private static boolean inForeground() { - return sInForeground != null && sInForeground; + boolean result = sInForeground != null && sInForeground; + Log.d( TAG, "inForeground() => %b", result ); + return result; + } + + private static void onAppStateChange( Context context, boolean inForeground ) + { + Log.d( TAG, "onAppStateChange(inForeground=%b)", inForeground ); + if ( null == sInForeground || inForeground() != inForeground ) { + sInForeground = inForeground; + // Intent intent = + // getIntentTo( context, + // inForeground ? BTAction.START_FOREGROUND + // : BTAction.START_BACKGROUND ); + // startService( context, intent ); + } + } + + static void onAppToForeground( Context context ) + { + onAppStateChange( context, true ); + } + + static void onAppToBackground( Context context ) + { + onAppStateChange( context, false ); } public static void startService( Context context ) 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 7927c4f65..cbbc2e1dc 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 @@ -106,9 +106,11 @@ public class XWApp extends Application implements LifecycleObserver { switch( event ) { case ON_RESUME: BTService.onAppToForeground( this ); + RelayService.onAppToForeground( this ); break; case ON_STOP: BTService.onAppToBackground( this ); + RelayService.onAppToBackground( this ); break; } } From 813669fafb4273a1c88ed7ba7bad8841da55e7d0 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 29 Nov 2018 12:55:35 -0800 Subject: [PATCH 03/25] include X86 native library again It's a pain to have to change code to run in Genymotion, and to have upgrade not testable using Genymotion. Consider verting this change before next release. --- xwords4/android/app/build.gradle | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index e49c1dab1..21bc531e4 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -231,7 +231,12 @@ task copyStrings(type: Exec) { task ndkSetup(type: Exec) { workingDir '../' // remove ', "--arm-only"' for Genymotion builds - commandLine "./scripts/ndksetup.sh", "--with-clang", "--arm-only" + + // I'm putting ARM back for a while. It's too much trouble having + // builds, including those built by travis, that don't run on the + // emulator. Maybe remove this change before each release? + commandLine "./scripts/ndksetup.sh", "--with-clang" + // commandLine "./scripts/ndksetup.sh", "--with-clang", "--arm-only" } task myPreBuild(dependsOn: ['ndkSetup', 'mkImages', 'copyStrings', 'mkXml']) { From 3fe1289a8db5850497909ff47da44c64d4ed4eb5 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 29 Nov 2018 17:07:14 -0800 Subject: [PATCH 04/25] include new permission to install third-party apks Fixed upgrade of Dbg variant not working on Oreo. --- xwords4/android/app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/xwords4/android/app/src/main/AndroidManifest.xml b/xwords4/android/app/src/main/AndroidManifest.xml index ccc7396e2..db24701c9 100644 --- a/xwords4/android/app/src/main/AndroidManifest.xml +++ b/xwords4/android/app/src/main/AndroidManifest.xml @@ -24,6 +24,7 @@ + From af7b9fcba00d71c20034278c6dddcc491c888c2b Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 29 Nov 2018 18:02:06 -0800 Subject: [PATCH 05/25] Always call startForeground after startForegroundService It's an error to e.g. stopSelf() without having called startForeground, so do it even when about to exit. --- .../org/eehouse/android/xw4/BTService.java | 63 ++++++++++++++----- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java index dc1f985b0..11234f7e4 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java @@ -56,6 +56,25 @@ import java.util.Set; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +// Notes on running under Oreo +// +// The goal is to be running only when useful: when user wants to play via +// BT. Ideally we'd not run the foreground service when BT is turned off, but +// there's no way to be notified of its being turned on without installing a +// receiver. So *something* has to be running, whether it's listening on a BT +// socket or hosting the receiver. Might as well be the socket listener. Users +// who want the service not running when BT's off can turn it off via app +// preferences. When they try to start a BT game we can note the preference +// and suggest they change it. And when an invitation sent is not received the +// sender can be told to suggest to his opponent to turn on the preference. +// +// When there's no BT adapter at all (Emulator case) there's no point in +// starting the service. Let's catch that early. +// +// Note also that we need to be careful to NEVER call stopSelf() after calling +// startForegroundService() until AFTER calling startForeground(). Doing so +// will cause a crash. + public class BTService extends XWService { private static final String TAG = BTService.class.getSimpleName(); private static final String BOGUS_MARSHMALLOW_ADDR = "02:00:00:00:00:00"; @@ -169,6 +188,7 @@ public class BTService extends XWService { private BTMsgSink m_btMsgSink; private BTListenerThread m_listener; private BTSenderThread m_sender; + private Notification m_notification; // make once use many private static int s_errCount = 0; public static boolean BTAvailable() @@ -388,6 +408,8 @@ public class BTService extends XWService { @Override public void onCreate() { + startForegroundIf(); + BluetoothAdapter adapter = XWApp.BTSUPPORTED ? BluetoothAdapter.getDefaultAdapter() : null; if ( null != adapter && adapter.isEnabled() ) { @@ -406,11 +428,9 @@ public class BTService extends XWService { @Override public int onStartCommand( Intent intent, int flags, int startId ) { - int result = handleCommand( intent ); + startForegroundIf(); - if ( Service.START_STICKY == result && ! inForeground() ) { - startForeground(); - } + int result = handleCommand( intent ); return result; } @@ -510,21 +530,30 @@ public class BTService extends XWService { return result; } // handleCommand() - private void startForeground() + private void startForegroundIf() { - Intent notifIntent = GamesListDelegate.makeBackgroundIntent( this ); - PendingIntent pendIntent = PendingIntent - .getActivity(this, Utils.nextRandomInt(), notifIntent, PendingIntent.FLAG_ONE_SHOT); - Notification notification = - new NotificationCompat.Builder( this, Utils.getChannelId(this) ) - .setSmallIcon( R.drawable.notify_btservice ) - .setContentTitle( BTService.class.getSimpleName() ) - .setContentText("listening for bluetooth messages...") - .setContentIntent(pendIntent) - .build(); + if ( ! inForeground() ) { + Log.d( TAG, "startForegroundIf(): starting" ); - Log.d( TAG, "calling service.startForeground()" ); - startForeground( 1337, notification ); + if ( null == m_notification ) { + Intent notifIntent = GamesListDelegate.makeBackgroundIntent( this ); + PendingIntent pendIntent = PendingIntent + .getActivity( this, Utils.nextRandomInt(), notifIntent, + PendingIntent.FLAG_ONE_SHOT ); + m_notification = + new NotificationCompat.Builder( this, Utils.getChannelId(this) ) + .setSmallIcon( R.drawable.notify_btservice ) + .setContentTitle( BTService.class.getSimpleName() ) + .setContentText("listening for bluetooth messages...") + .setContentIntent(pendIntent) + .build(); + } + + Log.d( TAG, "calling service.startForeground()" ); + startForeground( R.string.app_name, m_notification ); + } else { + Log.d( TAG, "startForegroundIf(): NOT starting" ); + } } private class BTListenerThread extends Thread { From 683bb384029d2d3b0d84c277a01806fef604d70b Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 3 Dec 2018 08:26:47 -0800 Subject: [PATCH 06/25] replace junit's assert with my own And have it log before throwing. Should be easier to track down asserts coming from jni callbacks this way than in the C code. --- .../org/eehouse/android/xw4/AboutAlert.java | 1 - .../java/org/eehouse/android/xw4/Assert.java | 58 +++++++++++++++++++ .../eehouse/android/xw4/BTInviteDelegate.java | 1 - .../org/eehouse/android/xw4/BTService.java | 1 - .../org/eehouse/android/xw4/BiDiSockWrap.java | 1 - .../org/eehouse/android/xw4/BoardCanvas.java | 1 - .../eehouse/android/xw4/BoardContainer.java | 1 - .../eehouse/android/xw4/BoardDelegate.java | 1 - .../org/eehouse/android/xw4/BoardView.java | 1 - .../org/eehouse/android/xw4/ChatDelegate.java | 1 - .../eehouse/android/xw4/CommsTransport.java | 1 - .../android/xw4/ConnStatusHandler.java | 1 - .../android/xw4/ConnViaViewLayout.java | 1 - .../java/org/eehouse/android/xw4/DBAlert.java | 1 - .../java/org/eehouse/android/xw4/DBUtils.java | 1 - .../org/eehouse/android/xw4/DbgUtils.java | 1 - .../org/eehouse/android/xw4/DelegateBase.java | 1 - .../android/xw4/DictBrowseDelegate.java | 1 - .../eehouse/android/xw4/DictLangCache.java | 1 - .../org/eehouse/android/xw4/DictUtils.java | 1 - .../eehouse/android/xw4/DictsDelegate.java | 1 - .../org/eehouse/android/xw4/DisablesItem.java | 1 - .../org/eehouse/android/xw4/DlgDelegate.java | 1 - .../eehouse/android/xw4/DlgDelegateAlert.java | 1 - .../org/eehouse/android/xw4/DlgState.java | 1 - .../eehouse/android/xw4/DwnldDelegate.java | 1 - .../eehouse/android/xw4/EnableSMSAlert.java | 1 - .../eehouse/android/xw4/ExpiringDelegate.java | 1 - .../android/xw4/GameConfigDelegate.java | 1 - .../org/eehouse/android/xw4/GameListItem.java | 1 - .../org/eehouse/android/xw4/GameLock.java | 1 - .../org/eehouse/android/xw4/GameUtils.java | 1 - .../android/xw4/GamesListDelegate.java | 1 - .../android/xw4/HeaderWithExpander.java | 1 - .../org/eehouse/android/xw4/HostDelegate.java | 1 - .../android/xw4/InviteChoicesAlert.java | 1 - .../eehouse/android/xw4/InviteDelegate.java | 1 - .../org/eehouse/android/xw4/LookupAlert.java | 1 - .../eehouse/android/xw4/LookupAlertView.java | 1 - .../org/eehouse/android/xw4/MainActivity.java | 1 - .../org/eehouse/android/xw4/MultiMsgSink.java | 1 - .../org/eehouse/android/xw4/MultiService.java | 1 - .../eehouse/android/xw4/NagTurnReceiver.java | 1 - .../eehouse/android/xw4/NetLaunchInfo.java | 1 - .../eehouse/android/xw4/NetStateCache.java | 1 - .../org/eehouse/android/xw4/NetUtils.java | 1 - .../eehouse/android/xw4/NotAgainAlert.java | 1 - .../org/eehouse/android/xw4/OkOnlyAlert.java | 1 - .../java/org/eehouse/android/xw4/Perms23.java | 1 - .../eehouse/android/xw4/PrefsActivity.java | 1 - .../eehouse/android/xw4/PrefsDelegate.java | 1 - .../android/xw4/RelayInviteDelegate.java | 1 - .../org/eehouse/android/xw4/RelayService.java | 1 - .../android/xw4/SMSInviteDelegate.java | 1 - .../org/eehouse/android/xw4/SMSService.java | 1 - .../android/xw4/StudyListDelegate.java | 1 - .../eehouse/android/xw4/TilePickAlert.java | 1 - .../org/eehouse/android/xw4/TilePickView.java | 1 - .../java/org/eehouse/android/xw4/Toolbar.java | 1 - .../java/org/eehouse/android/xw4/Utils.java | 1 - .../android/xw4/WiDirInviteDelegate.java | 1 - .../org/eehouse/android/xw4/WiDirService.java | 1 - .../org/eehouse/android/xw4/XWActivity.java | 1 - .../java/org/eehouse/android/xw4/XWApp.java | 1 - .../android/xw4/XWConnAddrPreference.java | 1 - .../eehouse/android/xw4/XWDialogFragment.java | 1 - .../eehouse/android/xw4/XWExpListAdapter.java | 1 - .../org/eehouse/android/xw4/XWFragment.java | 1 - .../java/org/eehouse/android/xw4/XWPrefs.java | 1 - .../org/eehouse/android/xw4/XWService.java | 1 - .../eehouse/android/xw4/jni/CommsAddrRec.java | 3 +- .../eehouse/android/xw4/jni/CurGameInfo.java | 2 +- .../eehouse/android/xw4/jni/DUtilCtxt.java | 3 +- .../eehouse/android/xw4/jni/GameSummary.java | 3 +- .../eehouse/android/xw4/jni/JNIThread.java | 3 +- .../eehouse/android/xw4/jni/JNIUtilsImpl.java | 3 +- .../eehouse/android/xw4/jni/LocalPlayer.java | 3 +- .../eehouse/android/xw4/jni/UtilCtxtImpl.java | 1 - .../org/eehouse/android/xw4/jni/XwJNI.java | 3 +- .../org/eehouse/android/xw4/loc/LocUtils.java | 2 +- .../eehouse/android/xw4/GCMIntentService.java | 1 - xwords4/android/scripts/mk_xml.py | 2 +- 82 files changed, 68 insertions(+), 88 deletions(-) create mode 100644 xwords4/android/app/src/main/java/org/eehouse/android/xw4/Assert.java diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/AboutAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/AboutAlert.java index a64e659c0..da8820309 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/AboutAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/AboutAlert.java @@ -33,7 +33,6 @@ import android.widget.TextView; import java.text.DateFormat; import java.util.Date; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Assert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Assert.java new file mode 100644 index 000000000..8f8a62d81 --- /dev/null +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Assert.java @@ -0,0 +1,58 @@ +/* -*- compile-command: "find-and-gradle.sh insXw4Deb"; -*- */ +/* + * Copyright 2012 by Eric House (xwords@eehouse.org). All rights + * reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.eehouse.android.xw4; + +public class Assert { + private static final String TAG = Assert.class.getSimpleName(); + + public static void fail() { + assertTrue(false); + } + + public static void assertFalse(boolean val) + { + assertTrue(! val); + } + + public static void assertTrue(boolean val) { + if (! val) { + Log.e( TAG, "firing assert!" ); + DbgUtils.printStack( TAG ); + junit.framework.Assert.fail(); + } + } + + public static void assertNotNull( Object val ) + { + assertTrue( val != null ); + } + + public static void assertNull( Object val ) + { + assertTrue( val == null ); + } + + public static void assertEquals( Object obj1, Object obj2 ) + { + assertTrue( (obj1 == null && obj2 == null) + || (obj1 != null && obj1.equals(obj2)) ); + } +} diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java index de9535a06..9a769cb8b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java @@ -27,7 +27,6 @@ import android.os.Bundle; import android.view.View; import android.widget.Button; -import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils.SentInvitesInfo; import org.eehouse.android.xw4.DlgDelegate.Action; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java index 11234f7e4..fedfe3f87 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java @@ -34,7 +34,6 @@ import android.content.Intent; import android.os.Build; import android.support.v4.app.NotificationCompat; -import junit.framework.Assert; import org.eehouse.android.xw4.MultiService.DictFetchOwner; import org.eehouse.android.xw4.MultiService.MultiEvent; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BiDiSockWrap.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BiDiSockWrap.java index e2744c9f5..a62fce31e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BiDiSockWrap.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BiDiSockWrap.java @@ -27,7 +27,6 @@ import java.net.Socket; import java.util.concurrent.LinkedBlockingQueue; import org.json.JSONObject; -import junit.framework.Assert; public class BiDiSockWrap { private static final String TAG = BiDiSockWrap.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java index f58412ae9..217986941 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java @@ -31,7 +31,6 @@ import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.BoardDims; import org.eehouse.android.xw4.jni.CommonPrefs; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardContainer.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardContainer.java index 19bb03e6c..e2b092f4b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardContainer.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardContainer.java @@ -29,7 +29,6 @@ import android.view.View; import android.view.View.MeasureSpec; import android.graphics.Rect; -import junit.framework.Assert; public class BoardContainer extends ViewGroup { private static final String TAG = BoardContainer.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index b2ed17c5d..ba5e64e8f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -49,7 +49,6 @@ import java.util.Map; import java.util.Map; import java.util.Set; -import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils.SentInvitesInfo; import org.eehouse.android.xw4.DlgDelegate.Action; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardView.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardView.java index fff413910..5d059fcf8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardView.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardView.java @@ -31,7 +31,6 @@ import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.BoardDims; import org.eehouse.android.xw4.jni.BoardHandler; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ChatDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ChatDelegate.java index 1219b8d57..f3239e590 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ChatDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ChatDelegate.java @@ -40,7 +40,6 @@ import android.widget.TextView; import java.text.DateFormat; import android.text.format.DateUtils; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.jni.JNIThread; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/CommsTransport.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/CommsTransport.java index 4c51b9af5..b486b89fa 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/CommsTransport.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/CommsTransport.java @@ -22,7 +22,6 @@ package org.eehouse.android.xw4; import android.content.Context; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.CommsAddrRec; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnStatusHandler.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnStatusHandler.java index ac9d8dfeb..efe49c8b2 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnStatusHandler.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnStatusHandler.java @@ -32,7 +32,6 @@ import android.provider.Settings; import android.text.format.DateUtils; import android.text.format.Time; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnViaViewLayout.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnViaViewLayout.java index 2e234e949..d90cbf290 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnViaViewLayout.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnViaViewLayout.java @@ -30,7 +30,6 @@ import android.widget.LinearLayout; import java.util.Map; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBAlert.java index bdf5d0337..9a3724f54 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBAlert.java @@ -34,7 +34,6 @@ import org.eehouse.android.xw4.loc.LocUtils; import java.io.Serializable; -import junit.framework.Assert; public class DBAlert extends XWDialogFragment { private static final String TAG = DBAlert.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java index 035d107e2..700b918a8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java @@ -33,7 +33,6 @@ import android.graphics.BitmapFactory; import android.os.Environment; import android.text.TextUtils; -import junit.framework.Assert; import org.eehouse.android.xw4.DictUtils.DictLoc; import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify.InviteMeans; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java index db5664334..e1b6f86c1 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java @@ -33,7 +33,6 @@ import java.util.Formatter; import java.util.Iterator; import java.util.Set; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java index 144c61b91..66932cfa1 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java @@ -40,7 +40,6 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.ActionPair; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictBrowseDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictBrowseDelegate.java index 5a165bcf1..05fc4c51e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictBrowseDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictBrowseDelegate.java @@ -37,7 +37,6 @@ import android.widget.SectionIndexer; import android.widget.Spinner; import android.widget.TextView; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.jni.JNIUtilsImpl; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictLangCache.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictLangCache.java index b614446b2..9573533a5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictLangCache.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictLangCache.java @@ -25,7 +25,6 @@ import android.content.res.Resources; import android.os.Handler; import android.widget.ArrayAdapter; -import junit.framework.Assert; import org.eehouse.android.xw4.DictUtils.DictAndLoc; import org.eehouse.android.xw4.DictUtils.DictLoc; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java index f354b1e29..cd46b0106 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java @@ -24,7 +24,6 @@ import android.content.Context; import android.content.res.AssetManager; import android.os.Environment; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.JNIUtilsImpl; import org.eehouse.android.xw4.jni.XwJNI; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java index 19ede5444..c02d61c19 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java @@ -45,7 +45,6 @@ import android.widget.ListView; import android.widget.PopupMenu; import android.widget.TextView; -import junit.framework.Assert; import org.eehouse.android.xw4.DictUtils.DictAndLoc; import org.eehouse.android.xw4.DictUtils.DictLoc; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DisablesItem.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DisablesItem.java index 6cb9f16ad..9eebd7584 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DisablesItem.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DisablesItem.java @@ -31,7 +31,6 @@ import android.widget.TextView; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; -import junit.framework.Assert; public class DisablesItem extends LinearLayout { private CommsConnType m_type; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java index c805f4999..526e26107 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java @@ -34,7 +34,6 @@ import android.view.View; import java.io.Serializable; -import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils.SentInvitesInfo; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegateAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegateAlert.java index f30ad2f1a..8c2266033 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegateAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegateAlert.java @@ -31,7 +31,6 @@ import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.ActionPair; import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java index e3ce8f217..850971e10 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java @@ -32,7 +32,6 @@ import java.util.List; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.ActionPair; -import junit.framework.Assert; public class DlgState implements Parcelable { private static final String TAG = DlgState.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DwnldDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DwnldDelegate.java index 858787047..df6e900fa 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DwnldDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DwnldDelegate.java @@ -34,7 +34,6 @@ import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; -import junit.framework.Assert; import java.io.File; import java.io.FileOutputStream; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/EnableSMSAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/EnableSMSAlert.java index 07548ab49..41760d3c1 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/EnableSMSAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/EnableSMSAlert.java @@ -30,7 +30,6 @@ import android.widget.AdapterView; import android.widget.Button; import android.widget.Spinner; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ExpiringDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ExpiringDelegate.java index 3987291eb..d1c21ca91 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ExpiringDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ExpiringDelegate.java @@ -29,7 +29,6 @@ import android.graphics.drawable.Drawable; import android.os.Handler; import android.view.View; -import junit.framework.Assert; import java.lang.ref.WeakReference; import java.util.ArrayList; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java index 81fa89ca2..9c5f1d1ee 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java @@ -45,7 +45,6 @@ import android.widget.TextView; import java.util.HashMap; import java.util.Map; -import junit.framework.Assert; import org.eehouse.android.xw4.DictLangCache.LangsArrayAdapter; import org.eehouse.android.xw4.DlgDelegate.Action; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameListItem.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameListItem.java index ae98e4fab..cb3203c48 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameListItem.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameListItem.java @@ -33,7 +33,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.GameSummary; import org.eehouse.android.xw4.jni.JNIThread; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameLock.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameLock.java index 54b8e1643..85d66310b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameLock.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameLock.java @@ -20,7 +20,6 @@ package org.eehouse.android.xw4; -import junit.framework.Assert; import java.util.HashMap; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java index 2d9963ed5..ba3d807d5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java @@ -31,7 +31,6 @@ import android.text.Html; import android.text.TextUtils; import android.view.Display; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.CommonPrefs; import org.eehouse.android.xw4.jni.CommsAddrRec; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index 73a6e9395..bae29f46e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -44,7 +44,6 @@ import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; -import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils.GameChangeType; import org.eehouse.android.xw4.DBUtils.GameGroupInfo; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HeaderWithExpander.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HeaderWithExpander.java index fd32744d5..153d01776 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HeaderWithExpander.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HeaderWithExpander.java @@ -27,7 +27,6 @@ import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostDelegate.java index e93665297..f69bd5927 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostDelegate.java @@ -26,7 +26,6 @@ import android.content.Intent; import org.eehouse.android.xw4.DlgDelegate.Action; -import junit.framework.Assert; class HostDelegate extends DelegateBase { private static final String ACTION = "ACTION"; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java index a9ed0250e..0b15bedd7 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java @@ -31,7 +31,6 @@ import android.widget.Button; import java.util.ArrayList; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.ActionPair; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteDelegate.java index c536cec93..d5c060d06 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteDelegate.java @@ -42,7 +42,6 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import junit.framework.Assert; abstract class InviteDelegate extends ListDelegateBase implements View.OnClickListener, diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlert.java index 45df88f55..f1ed332fb 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlert.java @@ -26,7 +26,6 @@ import android.os.Bundle; import android.support.v4.app.DialogFragment; import java.io.Serializable; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlertView.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlertView.java index 3f48cba0d..e82b12322 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlertView.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlertView.java @@ -36,7 +36,6 @@ import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MainActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MainActivity.java index d4142fc47..8ea9949f3 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MainActivity.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MainActivity.java @@ -35,7 +35,6 @@ import android.view.MenuItem; import android.view.View; import android.widget.LinearLayout; -import junit.framework.Assert; import java.lang.ref.WeakReference; import java.util.ArrayList; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiMsgSink.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiMsgSink.java index 0a08833e2..64197516c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiMsgSink.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiMsgSink.java @@ -22,7 +22,6 @@ package org.eehouse.android.xw4; import android.content.Context; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.CommsAddrRec; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiService.java index 5aac018c5..91dbd8390 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiService.java @@ -26,7 +26,6 @@ import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.os.Bundle; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NagTurnReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NagTurnReceiver.java index ba4ea6d33..5327b6c90 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NagTurnReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NagTurnReceiver.java @@ -27,7 +27,6 @@ import android.content.Context; import android.content.Intent; import android.text.TextUtils; -import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils.NeedsNagInfo; import org.eehouse.android.xw4.jni.GameSummary; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetLaunchInfo.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetLaunchInfo.java index ebc7a99f0..551a24cb5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetLaunchInfo.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetLaunchInfo.java @@ -39,7 +39,6 @@ import java.util.Iterator; import org.json.JSONException; import org.json.JSONObject; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java index 101f52059..6c5ed36f5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java @@ -29,7 +29,6 @@ import android.net.NetworkInfo; import android.os.Build; import android.os.Handler; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetUtils.java index acf6ac4be..1c07bf43b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetUtils.java @@ -23,7 +23,6 @@ package org.eehouse.android.xw4; import android.content.Context; import android.text.TextUtils; -import junit.framework.Assert; import org.json.JSONArray; import org.json.JSONException; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NotAgainAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NotAgainAlert.java index d12a0cd4e..6e90fb9b3 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NotAgainAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NotAgainAlert.java @@ -30,7 +30,6 @@ import android.support.v4.app.DialogFragment; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.ActionPair; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OkOnlyAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OkOnlyAlert.java index 3a74feacf..317b2cb6f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OkOnlyAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OkOnlyAlert.java @@ -30,7 +30,6 @@ import android.support.v4.app.DialogFragment; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.ActionPair; -import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; 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 2610d5146..f8b3be7bf 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 @@ -38,7 +38,6 @@ import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.loc.LocUtils; -import junit.framework.Assert; public class Perms23 { private static final String TAG = Perms23.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsActivity.java index 8c9787c32..816943179 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsActivity.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsActivity.java @@ -27,7 +27,6 @@ import android.os.Bundle; import android.preference.PreferenceActivity; import android.support.v4.app.DialogFragment; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.ConfirmThenBuilder; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java index a64e9dcda..faef1f88b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java @@ -36,7 +36,6 @@ import android.preference.PreferenceScreen; import android.view.View; import android.widget.Button; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.loc.LocUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java index f8b043aba..8d738b3c2 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java @@ -52,7 +52,6 @@ import java.util.Set; import org.json.JSONArray; import org.json.JSONObject; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java index ada0eeeb0..4934b75d5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java @@ -27,7 +27,6 @@ import android.os.Build; import android.os.Handler; import android.text.TextUtils; -import junit.framework.Assert; import org.eehouse.android.xw4.GameUtils.BackMoveResult; import org.eehouse.android.xw4.MultiService.DictFetchOwner; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java index e80006550..23942077a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java @@ -36,7 +36,6 @@ import android.view.View; import android.widget.Button; import android.widget.EditText; -import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils.SentInvitesInfo; import org.eehouse.android.xw4.DlgDelegate.Action; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSService.java index 49d26e588..610d1421a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSService.java @@ -34,7 +34,6 @@ import android.telephony.PhoneNumberUtils; import android.telephony.SmsManager; import android.telephony.TelephonyManager; -import junit.framework.Assert; import org.eehouse.android.xw4.MultiService.DictFetchOwner; import org.eehouse.android.xw4.MultiService.MultiEvent; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/StudyListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/StudyListDelegate.java index db51df1f4..bcf218584 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/StudyListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/StudyListDelegate.java @@ -36,7 +36,6 @@ import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Spinner; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.jni.GameSummary; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickAlert.java index d855a22a1..a45e350df 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickAlert.java @@ -31,7 +31,6 @@ import android.widget.Button; import java.io.Serializable; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickView.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickView.java index 4469176f5..6a9d4fc7d 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickView.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickView.java @@ -38,7 +38,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import junit.framework.Assert; public class TilePickView extends LinearLayout { private static final String TAG = TilePickView.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Toolbar.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Toolbar.java index 4eded5deb..0ecefa929 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Toolbar.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Toolbar.java @@ -35,7 +35,6 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.HasDlgDelegate; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Utils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Utils.java index f80ff4018..848da6f3f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Utils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Utils.java @@ -74,7 +74,6 @@ import java.util.Iterator; import java.util.List; import java.util.Random; -import junit.framework.Assert; import org.eehouse.android.xw4.Perms23.Perm; import org.eehouse.android.xw4.jni.CommonPrefs; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirInviteDelegate.java index a1d6343a6..6d39ffe53 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirInviteDelegate.java @@ -30,7 +30,6 @@ import android.widget.TextView; import java.util.Iterator; import java.util.Map; -import junit.framework.Assert; public class WiDirInviteDelegate extends InviteDelegate implements WiDirService.DevSetListener { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java index e7695401e..600c03770 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java @@ -69,7 +69,6 @@ import org.eehouse.android.xw4.jni.CommsAddrRec; import org.eehouse.android.xw4.jni.XwJNI; import org.eehouse.android.xw4.loc.LocUtils; -import junit.framework.Assert; public class WiDirService extends XWService { private static final String TAG = WiDirService.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWActivity.java index 82a8dab89..df83b45fb 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWActivity.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWActivity.java @@ -40,7 +40,6 @@ import android.widget.ListView; import org.eehouse.android.xw4.DlgDelegate.Action; -import junit.framework.Assert; public class XWActivity extends FragmentActivity implements Delegator, DlgDelegate.DlgClickNotify { 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 cbbc2e1dc..441e3d67b 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 @@ -35,7 +35,6 @@ import org.eehouse.android.xw4.jni.XwJNI; import java.util.UUID; -import junit.framework.Assert; import static android.arch.lifecycle.Lifecycle.Event.ON_ANY; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWConnAddrPreference.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWConnAddrPreference.java index de57f1bef..3c63c41a1 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWConnAddrPreference.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWConnAddrPreference.java @@ -27,7 +27,6 @@ import android.preference.DialogPreference; import android.util.AttributeSet; import android.view.View; -import junit.framework.Assert; import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWDialogFragment.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWDialogFragment.java index 2ecd0bf7e..38eac8ea2 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWDialogFragment.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWDialogFragment.java @@ -30,7 +30,6 @@ import android.view.View; import java.util.HashMap; import java.util.Map; -import junit.framework.Assert; abstract class XWDialogFragment extends DialogFragment { private static final String TAG = XWDialogFragment.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java index 77fe2c807..b07b937ae 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java @@ -23,7 +23,6 @@ package org.eehouse.android.xw4; import android.view.View; import android.view.ViewGroup; -import junit.framework.Assert; import java.util.Arrays; import java.util.HashMap; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWFragment.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWFragment.java index db4b076c7..7509d2fb5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWFragment.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWFragment.java @@ -36,7 +36,6 @@ import android.widget.ListView; import java.util.HashSet; import java.util.Set; -import junit.framework.Assert; abstract class XWFragment extends Fragment implements Delegator { private static final String TAG = XWFragment.class.getSimpleName(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java index fafe5208e..3262b8fef 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java @@ -29,7 +29,6 @@ import android.text.TextUtils; import org.json.JSONException; import org.json.JSONObject; -import junit.framework.Assert; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWService.java index 62e680abf..524695feb 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWService.java @@ -25,7 +25,6 @@ import android.content.Context; import android.content.Intent; import android.os.IBinder; -import junit.framework.Assert; import org.eehouse.android.xw4.MultiService.DictFetchOwner; import org.eehouse.android.xw4.MultiService.MultiEvent; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommsAddrRec.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommsAddrRec.java index 3701610d9..512500082 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommsAddrRec.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommsAddrRec.java @@ -23,8 +23,7 @@ package org.eehouse.android.xw4.jni; import android.content.Context; import android.text.TextUtils; -import junit.framework.Assert; - +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.BTService; import org.eehouse.android.xw4.GameUtils; import org.eehouse.android.xw4.Log; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java index 4d9b2d8f1..ac898b2b5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java @@ -29,8 +29,8 @@ import java.util.HashSet; import java.util.Random; import org.json.JSONObject; -import junit.framework.Assert; +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.BuildConfig; import org.eehouse.android.xw4.DictLangCache; import org.eehouse.android.xw4.DictUtils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java index 8192636f7..ae13ba97d 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java @@ -23,8 +23,7 @@ package org.eehouse.android.xw4.jni; import android.content.Context; import android.telephony.PhoneNumberUtils; -import junit.framework.Assert; - +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.XWApp; import org.eehouse.android.xw4.DBUtils; import org.eehouse.android.xw4.DevID; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/GameSummary.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/GameSummary.java index 654661e79..2c7c43247 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/GameSummary.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/GameSummary.java @@ -28,8 +28,7 @@ import java.util.Arrays; import org.json.JSONObject; -import junit.framework.Assert; - +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.BuildConfig; import org.eehouse.android.xw4.DBUtils; import org.eehouse.android.xw4.Log; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIThread.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIThread.java index d6c9a6c37..91bc41ae8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIThread.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIThread.java @@ -26,8 +26,7 @@ import android.graphics.Bitmap; import android.os.Handler; import android.os.Message; -import junit.framework.Assert; - +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.BuildConfig; import org.eehouse.android.xw4.CommsTransport; import org.eehouse.android.xw4.ConnStatusHandler; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIUtilsImpl.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIUtilsImpl.java index 79743be24..5d8c6a060 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIUtilsImpl.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIUtilsImpl.java @@ -22,8 +22,7 @@ package org.eehouse.android.xw4.jni; import android.content.Context; -import junit.framework.Assert; - +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.DBUtils; import org.eehouse.android.xw4.XWApp; import org.eehouse.android.xw4.Log; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java index 0a9109857..ca1106a5f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java @@ -25,8 +25,7 @@ import android.text.TextUtils; import java.io.Serializable; -import junit.framework.Assert; - +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.BuildConfig; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.Utils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/UtilCtxtImpl.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/UtilCtxtImpl.java index 6b3883086..2a1c30043 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/UtilCtxtImpl.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/UtilCtxtImpl.java @@ -22,7 +22,6 @@ package org.eehouse.android.xw4.jni; import android.content.Context; -import junit.framework.Assert; import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java index 315b51c86..2b9f96110 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java @@ -24,8 +24,7 @@ import android.graphics.Rect; import java.util.Arrays; -import junit.framework.Assert; - +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.NetLaunchInfo; import org.eehouse.android.xw4.Utils; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocUtils.java index af983d125..c63374251 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocUtils.java @@ -42,8 +42,8 @@ import android.widget.Spinner; import android.widget.SpinnerAdapter; import android.widget.TextView; -import junit.framework.Assert; +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.DBUtils; import org.eehouse.android.xw4.DbgUtils; import org.eehouse.android.xw4.Log; diff --git a/xwords4/android/app/src/xw4/java/org/eehouse/android/xw4/GCMIntentService.java b/xwords4/android/app/src/xw4/java/org/eehouse/android/xw4/GCMIntentService.java index 5069dea57..bc2f8e4f4 100644 --- a/xwords4/android/app/src/xw4/java/org/eehouse/android/xw4/GCMIntentService.java +++ b/xwords4/android/app/src/xw4/java/org/eehouse/android/xw4/GCMIntentService.java @@ -29,7 +29,6 @@ import com.google.android.gcm.GCMRegistrar; import org.json.JSONArray; -import junit.framework.Assert; public class GCMIntentService extends GCMBaseIntentService { private static final String TAG = GCMIntentService.class.getSimpleName(); diff --git a/xwords4/android/scripts/mk_xml.py b/xwords4/android/scripts/mk_xml.py index 706b0e9b0..b71e01542 100755 --- a/xwords4/android/scripts/mk_xml.py +++ b/xwords4/android/scripts/mk_xml.py @@ -95,8 +95,8 @@ def printStrings( pairs, outfile, target ): package org.eehouse.android.xw4.loc; import android.content.Context; -import junit.framework.Assert; +import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.Log; From ff51dd78309aef3e273f041466ce3b52847c1622 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 4 Dec 2018 05:10:05 -0800 Subject: [PATCH 07/25] remove assert Constructor is called from JNI code and so not on the UI thread. --- .../src/main/java/org/eehouse/android/xw4/NetStateCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java index 6c5ed36f5..373c88ce2 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java @@ -181,7 +181,7 @@ public class NetStateCache { public PvtBroadcastReceiver() { - DbgUtils.assertOnUIThread(); + // DbgUtils.assertOnUIThread(); // firing mHandler = new Handler(); mLastStateSent = s_netAvail; } From 4540f9c0778092b23add5ad7314ec8e10979bdd7 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 4 Dec 2018 05:18:29 -0800 Subject: [PATCH 08/25] change foreground-service notification text --- .../app/src/main/java/org/eehouse/android/xw4/BTService.java | 5 ++--- xwords4/android/app/src/main/res/values/strings.xml | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java index fedfe3f87..1bc51167a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java @@ -542,9 +542,8 @@ public class BTService extends XWService { m_notification = new NotificationCompat.Builder( this, Utils.getChannelId(this) ) .setSmallIcon( R.drawable.notify_btservice ) - .setContentTitle( BTService.class.getSimpleName() ) - .setContentText("listening for bluetooth messages...") - .setContentIntent(pendIntent) + .setContentText( getString(R.string.bkng_notify_text) ) + .setContentIntent( pendIntent ) .build(); } diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index 6ab747561..e5d84f35f 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -2028,6 +2028,7 @@ Enable background Bluetooth Always listen for Bluetooth messages + Accepting Bluetooth messages… Confirm your SMS plan From 9537100399f120b2404bd0c525b11737908bb22d Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 4 Dec 2018 06:17:47 -0800 Subject: [PATCH 09/25] btinvite dlg shows results of scan not all paired devs Moving toward a better BT invite experience: use BTService to scan for ourselves on all paired devices, and only allow selecting from among those on which we're running (and so likely to respond to an invitation.) --- .../eehouse/android/xw4/BTInviteDelegate.java | 22 ++-- .../org/eehouse/android/xw4/BTService.java | 120 +++--------------- .../app/src/main/res/layout/bt_buttons.xml | 9 +- .../app/src/main/res/values/strings.xml | 21 +-- 4 files changed, 42 insertions(+), 130 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java index 9a769cb8b..8ecd1a1ee 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java @@ -22,6 +22,7 @@ package org.eehouse.android.xw4; import android.app.Activity; import android.app.AlertDialog; +import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.view.View; @@ -35,12 +36,13 @@ import java.util.Iterator; import java.util.Set; public class BTInviteDelegate extends InviteDelegate { - private static final int[] BUTTONIDS = { R.id.button_add, + private static final String TAG = BTInviteDelegate.class.getSimpleName(); + private static final int[] BUTTONIDS = { R.id.button_scan, R.id.button_settings, - R.id.button_clear, }; private Activity m_activity; private TwoStringPair[] m_pairs; + private ProgressDialog m_progress; public static void launchForResult( Activity activity, int nMissing, SentInvitesInfo info, @@ -67,28 +69,25 @@ public class BTInviteDelegate extends InviteDelegate { @Override protected void init( Bundle savedInstanceState ) { - String msg = getString( R.string.bt_pick_addall_button ); - msg = getQuantityString( R.plurals.invite_bt_desc_fmt, m_nMissing, - m_nMissing, msg ); + String msg = getQuantityString( R.plurals.invite_bt_desc_fmt_2, m_nMissing, + m_nMissing ); super.init( msg, 0 ); addButtonBar( R.layout.bt_buttons, BUTTONIDS ); BTService.clearDevices( m_activity, null ); // will return names + + scan(); } @Override protected void onBarButtonClicked( int id ) { switch( id ) { - case R.id.button_add: + case R.id.button_scan: scan(); break; case R.id.button_settings: BTService.openBTSettings( m_activity ); break; - case R.id.button_clear: - removeSelected(); - clearChecked(); - break; } } @@ -101,6 +100,7 @@ public class BTInviteDelegate extends InviteDelegate { post( new Runnable() { public void run() { synchronized( BTInviteDelegate.this ) { + m_progress.cancel(); m_pairs = null; if ( 0 < args.length ) { @@ -143,6 +143,8 @@ public class BTInviteDelegate extends InviteDelegate { { int count = BTService.getPairedCount( m_activity ); if ( 0 < count ) { + String msg = getQuantityString( R.plurals.bt_scan_progress_fmt, count, count ); + m_progress = ProgressDialog.show( m_activity, msg, null, true, true ); BTService.scan( m_activity ); } else { makeConfirmThenBuilder( R.string.bt_no_devs, diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java index 1bc51167a..b6e384799 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java @@ -183,7 +183,6 @@ public class BTService extends XWService { } private BluetoothAdapter m_adapter; - private Set m_addrs; private BTMsgSink m_btMsgSink; private BTListenerThread m_listener; private BTSenderThread m_sender; @@ -415,7 +414,6 @@ public class BTService extends XWService { m_adapter = adapter; Log.i( TAG, "onCreate(); bt name = %s; bt addr = %s", adapter.getName(), adapter.getAddress() ); - initAddrs(); startListener(); startSender(); } else { @@ -456,8 +454,6 @@ public class BTService extends XWService { case CLEAR: String[] btAddrs = intent.getStringArrayExtra( CLEAR_KEY ); - clearDevs( btAddrs ); - sendNames(); break; case SCAN: m_sender.add( new BTQueueElem( BTCmd.SCAN ) ); @@ -572,7 +568,6 @@ public class BTService extends XWService { while ( null != m_serverSocket && m_adapter.isEnabled() ) { try { BluetoothSocket socket = m_serverSocket.accept(); // blocks - addAddr( socket ); DataInputStream inStream = new DataInputStream( socket.getInputStream() ); @@ -678,8 +673,6 @@ public class BTService extends XWService { } BluetoothDevice host = socket.getRemoteDevice(); - addAddr( host ); - result = makeOrNotify( nli, host.getName(), host.getAddress() ); DataOutputStream os = new DataOutputStream( socket.getOutputStream() ); @@ -699,7 +692,6 @@ public class BTService extends XWService { byte[] buffer = new byte[dis.readShort()]; dis.readFully( buffer ); BluetoothDevice host = socket.getRemoteDevice(); - addAddr( host ); CommsAddrRec addr = new CommsAddrRec( host.getName(), host.getAddress() ); @@ -731,35 +723,6 @@ public class BTService extends XWService { } // receiveMessage } // class BTListenerThread - private void addAddr( BluetoothSocket socket ) - { - addAddr( socket.getRemoteDevice() ); - } - - private void addAddr( BluetoothDevice dev ) - { - addAddr( dev.getAddress(), dev.getName() ); - } - - private void addAddr( String btAddr, String btName ) - { - boolean save = false; - synchronized( m_addrs ) { - save = !m_addrs.contains( btAddr ); - if ( save ) { - m_addrs.add( btAddr ); - } - } - if ( save ) { - saveAddrs(); - } - } - - private boolean haveAddr( String btAddr ) - { - return m_addrs.contains( btAddr ); - } - private static Map s_namesToAddrs; private static String getSafeAddr( CommsAddrRec addr ) { @@ -786,18 +749,6 @@ public class BTService extends XWService { return btAddr; } - private void clearDevs( String[] btAddrs ) - { - if ( null != btAddrs ) { - synchronized( m_addrs ) { - for ( String btAddr : btAddrs ) { - m_addrs.remove( btAddr ); - } - } - } - saveAddrs(); - } - private class BTSenderThread extends Thread { private LinkedBlockingQueue m_queue; private HashMap > m_resends; @@ -836,15 +787,15 @@ public class BTService extends XWService { switch( elem.m_cmd ) { case PING: if ( null == elem.m_btAddr ) { - sendPings( MultiEvent.HOST_PONGED ); + sendPings( MultiEvent.HOST_PONGED, null ); } else { sendPing( elem.m_btAddr, elem.m_gameID ); } break; case SCAN: - addAllToNames(); - sendNames(); - saveAddrs(); + Set devs = new HashSet<>(); + sendPings( null, devs ); + sendNames( devs ); break; case INVITE: sendInvite( elem ); @@ -870,18 +821,17 @@ public class BTService extends XWService { } } // run - private void sendPings( MultiEvent event ) + private void sendPings( MultiEvent event, Set addrs ) { Set pairedDevs = m_adapter.getBondedDevices(); // DbgUtils.logf( "ping: got %d paired devices", pairedDevs.size() ); for ( BluetoothDevice dev : pairedDevs ) { String btAddr = dev.getAddress(); - if ( haveAddr( btAddr ) ) { - continue; - } if ( sendPing( dev, 0 ) ) { // did we get a reply? - addAddr( dev ); + if ( null != addrs ) { + addrs.add( dev ); + } if ( null != event ) { postEvent( event, dev.getName() ); } @@ -927,6 +877,7 @@ public class BTService extends XWService { } updateStatusOut( sendWorking ); updateStatusIn( receiveWorking ); + Log.d( TAG, "sendPing(%s) => %b", dev, gotReply ); return gotReply; } // sendPing @@ -1130,60 +1081,21 @@ public class BTService extends XWService { } return found; } - } // class BTSenderThread - private void addAllToNames() + private void sendNames( Set devs ) { - Set pairedDevs = m_adapter.getBondedDevices(); - synchronized( m_addrs ) { - for ( BluetoothDevice dev : pairedDevs ) { - int clazz = dev.getBluetoothClass().getMajorDeviceClass(); - if ( Major.PHONE == clazz - || (XWApp.BT_SCAN_COMPUTERS && Major.COMPUTER == clazz) ) { - m_addrs.add( dev.getAddress() ); - } - } - } - } - - private void sendNames() - { - String[] btAddrs = getAddrs(); - int size = btAddrs.length; - String[] btNames = new String[size]; - for ( int ii = 0; ii < size; ++ii ) { + String[] btNames = new String[devs.size()]; + String[] btAddrs = new String[devs.size()]; + int ii = 0; + for ( BluetoothDevice dev : devs ) { + btAddrs[ii] = dev.getAddress(); btNames[ii] = nameForAddr( m_adapter, btAddrs[ii] ); + ++ii; } postEvent( MultiEvent.SCAN_DONE, (Object)btAddrs, (Object)btNames ); } - private void initAddrs() - { - m_addrs = new HashSet(); - - String[] addrs = XWPrefs.getBTAddresses( this ); - if ( null != addrs ) { - for ( String btAddr : addrs ) { - m_addrs.add( btAddr ); - } - } - } - - private String[] getAddrs() - { - String[] addrs; - synchronized( m_addrs ) { - addrs = m_addrs.toArray( new String[m_addrs.size()] ); - } - return addrs; - } - - private void saveAddrs() - { - XWPrefs.setBTAddresses( this, getAddrs() ); - } - private void startListener() { m_btMsgSink = new BTMsgSink(); diff --git a/xwords4/android/app/src/main/res/layout/bt_buttons.xml b/xwords4/android/app/src/main/res/layout/bt_buttons.xml index ea287c312..df6e78e69 100644 --- a/xwords4/android/app/src/main/res/layout/bt_buttons.xml +++ b/xwords4/android/app/src/main/res/layout/bt_buttons.xml @@ -5,8 +5,8 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" > -