From e7d4e93d129c371d75e8dc700101297fefa2cc09 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 28 Mar 2017 06:54:42 -0700 Subject: [PATCH] Use Log.? instead of DbgUtils.log? everywhere Too much trouble switching modes between work and home :-) --- .../org/eehouse/android/xw4/BTReceiver.java | 4 +- .../org/eehouse/android/xw4/BTService.java | 52 ++--- .../org/eehouse/android/xw4/BiDiSockWrap.java | 32 +-- .../org/eehouse/android/xw4/BoardCanvas.java | 2 +- .../eehouse/android/xw4/BoardContainer.java | 6 +- .../eehouse/android/xw4/BoardDelegate.java | 39 ++-- .../org/eehouse/android/xw4/BoardView.java | 36 ++-- .../org/eehouse/android/xw4/ChatDelegate.java | 2 +- .../eehouse/android/xw4/CommsTransport.java | 38 ++-- .../android/xw4/ConnStatusHandler.java | 7 +- .../java/org/eehouse/android/xw4/DBAlert.java | 6 +- .../org/eehouse/android/xw4/DBHelper.java | 3 +- .../java/org/eehouse/android/xw4/DBUtils.java | 61 +++--- .../org/eehouse/android/xw4/DbgUtils.java | 36 +--- .../org/eehouse/android/xw4/DelegateBase.java | 36 ++-- .../java/org/eehouse/android/xw4/DevID.java | 8 +- .../android/xw4/DictBrowseDelegate.java | 4 +- .../eehouse/android/xw4/DictLangCache.java | 9 +- .../org/eehouse/android/xw4/DictUtils.java | 20 +- .../eehouse/android/xw4/DictsDelegate.java | 22 +-- .../org/eehouse/android/xw4/DlgDelegate.java | 8 +- .../eehouse/android/xw4/DlgDelegateAlert.java | 3 +- .../eehouse/android/xw4/DualpaneDelegate.java | 4 +- .../eehouse/android/xw4/DwnldDelegate.java | 10 +- .../eehouse/android/xw4/ExpiringDelegate.java | 7 +- .../org/eehouse/android/xw4/FragActivity.java | 2 +- .../eehouse/android/xw4/GCMIntentService.java | 16 +- .../android/xw4/GameConfigDelegate.java | 16 +- .../org/eehouse/android/xw4/GameListItem.java | 3 +- .../org/eehouse/android/xw4/GameLock.java | 34 ++-- .../org/eehouse/android/xw4/GameUtils.java | 48 +++-- .../android/xw4/GamesListDelegate.java | 24 +-- .../eehouse/android/xw4/InviteDelegate.java | 2 +- .../eehouse/android/xw4/LookupAlertView.java | 2 +- .../org/eehouse/android/xw4/MainActivity.java | 27 ++- .../android/xw4/MountEventReceiver.java | 2 +- .../org/eehouse/android/xw4/MultiMsgSink.java | 6 +- .../org/eehouse/android/xw4/MultiService.java | 2 +- .../eehouse/android/xw4/NagTurnReceiver.java | 2 +- .../eehouse/android/xw4/NetLaunchInfo.java | 12 +- .../eehouse/android/xw4/NetStateCache.java | 19 +- .../org/eehouse/android/xw4/NetUtils.java | 22 +-- .../eehouse/android/xw4/OnBootReceiver.java | 2 +- .../java/org/eehouse/android/xw4/Perms23.java | 16 +- .../eehouse/android/xw4/PrefsDelegate.java | 2 +- .../eehouse/android/xw4/RefreshNamesTask.java | 14 +- .../android/xw4/RelayInviteDelegate.java | 8 +- .../org/eehouse/android/xw4/RelayService.java | 178 +++++++++-------- .../android/xw4/SMSInviteDelegate.java | 2 +- .../org/eehouse/android/xw4/SMSReceiver.java | 2 +- .../org/eehouse/android/xw4/SMSService.java | 62 +++--- .../org/eehouse/android/xw4/TilePickView.java | 2 +- .../java/org/eehouse/android/xw4/Toolbar.java | 4 +- .../android/xw4/UpdateCheckReceiver.java | 23 ++- .../java/org/eehouse/android/xw4/Utils.java | 8 +- .../org/eehouse/android/xw4/WiDirService.java | 183 +++++++++--------- .../org/eehouse/android/xw4/XWActivity.java | 16 +- .../java/org/eehouse/android/xw4/XWApp.java | 5 +- .../org/eehouse/android/xw4/XWFragment.java | 22 +-- .../org/eehouse/android/xw4/XWPacket.java | 10 +- .../java/org/eehouse/android/xw4/XWPrefs.java | 4 +- .../org/eehouse/android/xw4/XWService.java | 6 +- .../eehouse/android/xw4/jni/CommsAddrRec.java | 10 +- .../eehouse/android/xw4/jni/CurGameInfo.java | 6 +- .../eehouse/android/xw4/jni/GameSummary.java | 12 +- .../eehouse/android/xw4/jni/JNIThread.java | 28 +-- .../eehouse/android/xw4/jni/JNIUtilsImpl.java | 8 +- .../eehouse/android/xw4/jni/UtilCtxtImpl.java | 4 +- .../org/eehouse/android/xw4/jni/XwJNI.java | 10 +- .../eehouse/android/xw4/loc/LocDelegate.java | 4 +- .../org/eehouse/android/xw4/loc/LocIDs.java | 4 +- .../eehouse/android/xw4/loc/LocSearcher.java | 4 +- .../org/eehouse/android/xw4/loc/LocUtils.java | 26 +-- xwords4/android/scripts/mk_xml.py | 8 +- 74 files changed, 662 insertions(+), 725 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTReceiver.java index 437c6f812..d23a50af9 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTReceiver.java @@ -34,8 +34,8 @@ public class BTReceiver extends BroadcastReceiver { { if ( XWApp.BTSUPPORTED ) { String action = intent.getAction(); - DbgUtils.logd( TAG, "BTReceiver.onReceive(action=%s, intent=%s)", - action, intent.toString() ); + Log.d( TAG, "BTReceiver.onReceive(action=%s, intent=%s)", + action, intent.toString() ); if ( action.equals( BluetoothDevice.ACTION_ACL_CONNECTED ) ) { BTService.startService( context ); 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 9726f2073..2f460feb7 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 @@ -301,8 +301,8 @@ public class BTService extends XWService { } if ( -1 == nSent ) { - DbgUtils.logi( TAG, "enqueueFor(): can't send to %s", - targetAddr.bt_hostName ); + Log.i( TAG, "enqueueFor(): can't send to %s", + targetAddr.bt_hostName ); } return nSent; } @@ -329,13 +329,13 @@ public class BTService extends XWService { ? BluetoothAdapter.getDefaultAdapter() : null; if ( null != adapter && adapter.isEnabled() ) { m_adapter = adapter; - DbgUtils.logi( TAG, "onCreate(); bt name = %s; bt addr = %s", - adapter.getName(), adapter.getAddress() ); + Log.i( TAG, "onCreate(); bt name = %s; bt addr = %s", + adapter.getName(), adapter.getAddress() ); initAddrs(); startListener(); startSender(); } else { - DbgUtils.logw( TAG, "not starting threads: BT not available" ); + Log.w( TAG, "not starting threads: BT not available" ); stopSelf(); } } @@ -349,11 +349,11 @@ public class BTService extends XWService { if ( -1 == ordinal ) { // Drop it } else if ( null == m_sender ) { - DbgUtils.logw( TAG, "exiting: m_queue is null" ); + Log.w( TAG, "exiting: m_queue is null" ); stopSelf(); } else { BTAction cmd = BTAction.values()[ordinal]; - DbgUtils.logi( TAG, "onStartCommand; cmd=%s", cmd.toString() ); + Log.i( TAG, "onStartCommand; cmd=%s", cmd.toString() ); switch( cmd ) { case CLEAR: String[] btAddrs = intent.getStringArrayExtra( CLEAR_KEY ); @@ -366,7 +366,7 @@ public class BTService extends XWService { case INVITE: String jsonData = intent.getStringExtra( GAMEDATA_KEY ); NetLaunchInfo nli = new NetLaunchInfo( this, jsonData ); - DbgUtils.logi( TAG, "onStartCommand: nli: %s", nli.toString() ); + Log.i( TAG, "onStartCommand: nli: %s", nli.toString() ); String btAddr = intent.getStringExtra( ADDR_KEY ); m_sender.add( new BTQueueElem( BTCmd.INVITE, nli, btAddr ) ); break; @@ -472,7 +472,7 @@ public class BTService extends XWService { break; default: - DbgUtils.loge( TAG, "unexpected msg %s", cmd.toString()); + Log.e( TAG, "unexpected msg %s", cmd.toString()); break; } updateStatusIn( true ); @@ -486,7 +486,7 @@ public class BTService extends XWService { sendBadProto( socket ); } } catch ( IOException ioe ) { - DbgUtils.logw( TAG, "trying again..." ); + Log.w( TAG, "trying again..." ); logIOE( ioe); continue; } @@ -588,8 +588,8 @@ public class BTService extends XWService { result = rslt == ReceiveResult.GAME_GONE ? BTCmd.MESG_GAMEGONE : BTCmd.MESG_ACCPT; } else { - DbgUtils.loge( TAG, "receiveMessage(): read only " - + "%d of %d bytes", nRead, len ); + Log.e( TAG, "receiveMessage(): read only %d of %d bytes", + nRead, len ); } break; case MESG_GAMEGONE: @@ -705,7 +705,7 @@ public class BTService extends XWService { try { elem = m_queue.poll( timeout, TimeUnit.SECONDS ); } catch ( InterruptedException ie ) { - DbgUtils.logw( TAG, "interrupted; killing thread" ); + Log.w( TAG, "interrupted; killing thread" ); break; } @@ -837,7 +837,7 @@ public class BTService extends XWService { outStream.writeShort( nliData.length ); outStream.write( nliData, 0, nliData.length ); } - DbgUtils.logi( TAG, "sending invite" ); + Log.i( TAG, "sending invite" ); outStream.flush(); DataInputStream inStream = @@ -880,8 +880,8 @@ public class BTService extends XWService { MultiEvent evt; if ( success ) { evt = MultiEvent.MESSAGE_DROPPED; - DbgUtils.logw( TAG, "sendElem: dropping message %s because game %X dead", - elem.m_cmd, elem.m_gameID ); + Log.w( TAG, "sendElem: dropping message %s because game %X dead", + elem.m_cmd, elem.m_gameID ); } else { evt = MultiEvent.MESSAGE_REFUSED; } @@ -1084,7 +1084,7 @@ public class BTService extends XWService { try { m_listener.join( 100 ); } catch ( InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); } m_listener = null; } @@ -1095,7 +1095,7 @@ public class BTService extends XWService { try { m_sender.join( 100 ); } catch ( InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); } m_sender = null; } @@ -1167,10 +1167,10 @@ public class BTService extends XWService { dos = new DataOutputStream( socket.getOutputStream() ); dos.writeByte( BT_PROTO ); dos.writeByte( cmd.ordinal() ); - DbgUtils.logi( TAG, "connect() to %s successful", name ); + Log.i( TAG, "connect() to %s successful", name ); } catch ( IOException ioe ) { dos = null; - DbgUtils.logw( TAG, "BTService.connect() to %s failed", name ); + Log.w( TAG, "BTService.connect() to %s failed", name ); // logIOE( ioe ); } return dos; @@ -1178,7 +1178,7 @@ public class BTService extends XWService { private void logIOE( IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); ++s_errCount; // if ( 0 == s_errCount % 10 ) { postEvent( MultiEvent.BT_ERR_COUNT, s_errCount ); @@ -1215,13 +1215,13 @@ public class BTService extends XWService { try { Thread.sleep( millis ); } catch ( InterruptedException ie ) { - DbgUtils.logw( TAG, "killSocketIn: killed by owner" ); + Log.w( TAG, "killSocketIn: killed by owner" ); return; } try { socket.close(); } catch( IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } } ); @@ -1238,7 +1238,7 @@ public class BTService extends XWService { { int nSent = -1; if ( null == m_sender ) { - DbgUtils.logw( TAG, "sendViaBluetooth(): no send thread" ); + Log.w( TAG, "sendViaBluetooth(): no send thread" ); } else { String btAddr = getSafeAddr( addr ); if ( null != btAddr && 0 < btAddr.length() ) { @@ -1246,8 +1246,8 @@ public class BTService extends XWService { gameID ) ); nSent = buf.length; } else { - DbgUtils.logi( TAG, "sendViaBluetooth(): no addr for dev %s", - addr.bt_hostName ); + Log.i( TAG, "sendViaBluetooth(): no addr for dev %s", + addr.bt_hostName ); } } return nSent; 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 020050d10..5ddde95cc 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 @@ -72,18 +72,18 @@ public class BiDiSockWrap { while ( mActive ) { try { Thread.sleep( waitMillis ); - DbgUtils.logd( TAG, "trying to connect..." ); + Log.d( TAG, "trying to connect..." ); Socket socket = new Socket( mAddress, mPort ); - DbgUtils.logd( TAG, "connected!!!" ); + Log.d( TAG, "connected!!!" ); init( socket ); mIface.connectStateChanged( BiDiSockWrap.this, true ); break; } catch ( java.net.UnknownHostException uhe ) { - DbgUtils.logex( TAG, uhe ); + Log.ex( TAG, uhe ); } catch ( IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } catch ( InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); } waitMillis = Math.min( waitMillis * 2, 1000 * 60 ); } @@ -102,7 +102,7 @@ public class BiDiSockWrap { try { send( packet.getBytes( "UTF-8" ) ); } catch ( java.io.UnsupportedEncodingException uee ) { - DbgUtils.logex( TAG, uee ); + Log.ex( TAG, uee ); } } @@ -132,13 +132,13 @@ public class BiDiSockWrap { private void closeSocket() { - DbgUtils.logd( TAG, "closeSocket()" ); + Log.d( TAG, "closeSocket()" ); mRunThreads = false; mActive = false; try { mSocket.close(); } catch ( IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } mIface.connectStateChanged( this, false ); mQueue.add( new byte[0] ); @@ -150,13 +150,13 @@ public class BiDiSockWrap { mWriteThread = new Thread( new Runnable() { @Override public void run() { - DbgUtils.logd( TAG, "write thread starting" ); + Log.d( TAG, "write thread starting" ); try { DataOutputStream outStream = new DataOutputStream( mSocket.getOutputStream() ); while ( mRunThreads ) { byte[] packet = mQueue.take(); - DbgUtils.logd( TAG, + Log.d( TAG, "write thread got packet of len %d", packet.length ); Assert.assertNotNull( packet ); @@ -170,12 +170,12 @@ public class BiDiSockWrap { mIface.onWriteSuccess( BiDiSockWrap.this ); } } catch ( IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); closeSocket(); } catch ( InterruptedException ie ) { Assert.fail(); } - DbgUtils.logd( TAG, "write thread exiting" ); + Log.d( TAG, "write thread exiting" ); } } ); mWriteThread.start(); @@ -183,22 +183,22 @@ public class BiDiSockWrap { mReadThread = new Thread( new Runnable() { @Override public void run() { - DbgUtils.logd( TAG, "read thread starting" ); + Log.d( TAG, "read thread starting" ); try { DataInputStream inStream = new DataInputStream( mSocket.getInputStream() ); while ( mRunThreads ) { short len = inStream.readShort(); - DbgUtils.logd( TAG, "got len: %d", len ); + Log.d( TAG, "got len: %d", len ); byte[] packet = new byte[len]; inStream.read( packet ); mIface.gotPacket( BiDiSockWrap.this, packet ); } } catch( IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); closeSocket(); } - DbgUtils.logd( TAG, "read thread exiting" ); + Log.d( TAG, "read thread exiting" ); } } ); mReadThread.start(); 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 1c9f1ec77..9ccd9404f 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 @@ -181,7 +181,7 @@ public class BoardCanvas extends Canvas implements DrawCtx { DbgUtils.assertOnUIThread(); if ( null == jniThread ) { } else if ( ! jniThread.equals( m_jniThread ) ) { - DbgUtils.logw( TAG, "changing threads" ); + Log.w( TAG, "changing threads" ); } m_jniThread = jniThread; } 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 9d492211a..814e49386 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 @@ -92,9 +92,9 @@ public class BoardContainer extends ViewGroup { measureChild( s_isPortrait ? HBAR_INDX : VBAR_INDX, m_toolsBounds ); adjustBounds(); View child = getChildAt( s_isPortrait ? HBAR_INDX : VBAR_INDX ); - DbgUtils.logi( TAG, "measured %s; passed ht: %d; got back ht: %d", - child.toString(), m_toolsBounds.height(), - child.getMeasuredHeight() ); + Log.i( TAG, "measured %s; passed ht: %d; got back ht: %d", + child.toString(), m_toolsBounds.height(), + child.getMeasuredHeight() ); if ( haveTradeBar() ) { // Measure the exchange buttons bar 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 4fa39725b..a57f3ba24 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 @@ -166,7 +166,7 @@ public class BoardDelegate extends DelegateBase protected Dialog makeDialog( DBAlert alert, Object[] params ) { final DlgID dlgID = alert.getDlgID(); - DbgUtils.logd( TAG, "makeDialog(%s)", dlgID.toString() ); + Log.d( TAG, "makeDialog(%s)", dlgID.toString() ); OnClickListener lstnr; AlertDialog.Builder ab = makeAlertBuilder(); @@ -587,7 +587,7 @@ public class BoardDelegate extends DelegateBase Bundle args = getArguments(); m_rowid = args.getLong( GameUtils.INTENT_KEY_ROWID, -1 ); - DbgUtils.logi( TAG, "opening rowid %d", m_rowid ); + Log.i( TAG, "opening rowid %d", m_rowid ); m_haveInvited = args.getBoolean( GameUtils.INVITED, false ); m_overNotShown = true; @@ -735,7 +735,7 @@ public class BoardDelegate extends DelegateBase @Override public void orientationChanged() { - DbgUtils.logd( TAG, "BoardDelegate.orientationChanged()" ); + Log.d( TAG, "BoardDelegate.orientationChanged()" ); initToolbar(); m_view.orientationChanged(); } @@ -989,7 +989,7 @@ public class BoardDelegate extends DelegateBase break; default: - DbgUtils.logw( TAG, "menuitem %d not handled", id ); + Log.w( TAG, "menuitem %d not handled", id ); handled = false; } @@ -1274,7 +1274,7 @@ public class BoardDelegate extends DelegateBase // This can be BT or SMS. In BT case there's a progress // thing going. Not in SMS case. case NEWGAME_FAILURE: - DbgUtils.logw( TAG, "failed to create game" ); + Log.w( TAG, "failed to create game" ); break; case NEWGAME_DUP_REJECTED: if ( m_progressShown ) { @@ -1426,8 +1426,8 @@ public class BoardDelegate extends DelegateBase nli.addP2PInfo( m_activity ); break; default: - DbgUtils.logw( TAG, "Not doing NFC join for conn type %s", - typ.toString() ); + Log.w( TAG, "Not doing NFC join for conn type %s", + typ.toString() ); } } data = nli.makeLaunchJSON(); @@ -1593,7 +1593,7 @@ public class BoardDelegate extends DelegateBase } if ( null != toastStr ) { - DbgUtils.logi( TAG, "handleConndMessage(): toastStr: %s", toastStr ); + Log.i( TAG, "handleConndMessage(): toastStr: %s", toastStr ); m_mySIS.toastStr = toastStr; if ( naMsg == 0 ) { onPosButton( Action.SHOW_EXPL_ACTION, null ); @@ -2181,8 +2181,7 @@ public class BoardDelegate extends DelegateBase case COMMS_CONN_P2P: break; default: - DbgUtils.logw( TAG, "tickle: unexpected type %s", - typ.toString() ); + Log.w( TAG, "tickle: unexpected type %s", typ.toString() ); Assert.fail(); } } @@ -2202,7 +2201,7 @@ public class BoardDelegate extends DelegateBase } if ( 0 == nMissing || !m_relayMissing ) { if ( null != m_inviteAlert ) { - DbgUtils.logd( TAG, "dismissing invite alert" ); + Log.d( TAG, "dismissing invite alert" ); m_inviteAlert.dismiss(); } } @@ -2439,7 +2438,7 @@ public class BoardDelegate extends DelegateBase RelayService.inviteRemote( m_activity, destDevID, null, nli ); } catch (NumberFormatException nfi) { - DbgUtils.logex( TAG, nfi ); + Log.ex( TAG, nfi ); } break; case WIFIDIRECT: @@ -2532,7 +2531,7 @@ public class BoardDelegate extends DelegateBase if ( canPost ) { m_handler.post( runnable ); } else { - DbgUtils.logw( TAG, "post(): dropping b/c handler null" ); + Log.w( TAG, "post(): dropping b/c handler null" ); DbgUtils.printStack( TAG ); } return canPost; @@ -2543,7 +2542,7 @@ public class BoardDelegate extends DelegateBase if ( null != m_handler ) { m_handler.postDelayed( runnable, when ); } else { - DbgUtils.logw( TAG, "postDelayed: dropping %d because handler null", when ); + Log.w( TAG, "postDelayed: dropping %d because handler null", when ); } } @@ -2552,8 +2551,8 @@ public class BoardDelegate extends DelegateBase if ( null != m_handler ) { m_handler.removeCallbacks( which ); } else { - DbgUtils.logw( TAG, "removeCallbacks: dropping %h because handler null", - which ); + Log.w( TAG, "removeCallbacks: dropping %h because handler null", + which ); } } @@ -2696,7 +2695,7 @@ public class BoardDelegate extends DelegateBase doRematchIf( activity, null, rowID, summary, gi, gamePtr ); gamePtr.release(); } else { - DbgUtils.logw( TAG, "setupRematchFor(): unable to lock game" ); + Log.w( TAG, "setupRematchFor(): unable to lock game" ); } if ( null != thread ) { @@ -2771,7 +2770,7 @@ public class BoardDelegate extends DelegateBase sendSMSInviteIf( (String)params[1], (NetLaunchInfo)params[0], false ); } else { - DbgUtils.logw( TAG, "retrySMSInvites: tests failed" ); + Log.w( TAG, "retrySMSInvites: tests failed" ); } } @@ -2789,7 +2788,7 @@ public class BoardDelegate extends DelegateBase if ( !invitesSent ) { m_inviteAlert.dismiss(); m_inviteAlert = null; - DbgUtils.logd( TAG, "recordInviteSent(): redoing invite alert" ); + Log.d( TAG, "recordInviteSent(): redoing invite alert" ); showInviteAlertIf(); } } @@ -2797,7 +2796,7 @@ public class BoardDelegate extends DelegateBase private void handleViaThread( JNICmd cmd, Object... args ) { if ( null == m_jniThread ) { - DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() ); + Log.w( TAG, "not calling handle(%s)", cmd.toString() ); DbgUtils.printStack( TAG ); } else { m_jniThread.handle( cmd, args ); 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 4fbab0d87..2e2055b5d 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 @@ -109,7 +109,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { } else if ( XwJNI.board_containsPt( m_jniGamePtr, xx, yy ) ) { handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy ); } else { - DbgUtils.logd( TAG, "onTouchEvent(): in white space" ); + Log.d( TAG, "onTouchEvent(): in white space" ); } break; case MotionEvent.ACTION_MOVE: @@ -142,7 +142,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { m_lastSpacing = MULTI_INACTIVE; break; default: - DbgUtils.logw( TAG, "onTouchEvent: unknown action: %d", action ); + Log.w( TAG, "onTouchEvent: unknown action: %d", action ); break; } } @@ -160,7 +160,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { if ( BoardContainer.getIsPortrait() != (m_dims.height > m_dims.width) ) { // square possible; will break above! Assert.assertTrue( m_dims.height != m_dims.width ); - DbgUtils.logd( TAG, "onMeasure: discarding m_dims" ); + Log.d( TAG, "onMeasure: discarding m_dims" ); if ( ++m_dimsTossCount < 4 ) { m_dims = null; m_layoutWidth = m_layoutHeight = 0; @@ -187,8 +187,8 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { width = minWidth; } setMeasuredDimension( width, height ); - DbgUtils.logd( TAG, "onMeasure: calling setMeasuredDimension( width=%d, height=%d )", - width, height ); + Log.d( TAG, "onMeasure: calling setMeasuredDimension( width=%d, height=%d )", + width, height ); } // @Override @@ -214,7 +214,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { ConnStatusHandler.draw( m_context, canvas, getResources(), m_connTypes, m_isSolo ); } else { - DbgUtils.logd( TAG, "onDraw(): board not laid out yet" ); + Log.d( TAG, "onDraw(): board not laid out yet" ); } } } @@ -225,15 +225,15 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { final int height = getHeight(); boolean layoutDone = width == m_layoutWidth && height == m_layoutHeight; if ( layoutDone ) { - DbgUtils.logd( TAG, "layoutBoardOnce(): layoutDone true" ); + Log.d( TAG, "layoutBoardOnce(): layoutDone true" ); } else if ( null == m_gi ) { // nothing to do either - DbgUtils.logd( TAG, "layoutBoardOnce(): no m_gi" ); + Log.d( TAG, "layoutBoardOnce(): no m_gi" ); } else if ( null == m_jniThread ) { // nothing to do either - DbgUtils.logd( TAG, "layoutBoardOnce(): no m_jniThread" ); + Log.d( TAG, "layoutBoardOnce(): no m_jniThread" ); } else if ( null == m_dims ) { - DbgUtils.logd( TAG, "layoutBoardOnce(): null m_dims" ); + Log.d( TAG, "layoutBoardOnce(): null m_dims" ); // m_canvas = null; // need to synchronize?? Paint paint = new Paint(); @@ -244,13 +244,13 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { int timerWidth = scratch.width(); int fontWidth = Math.min(m_defaultFontHt, timerWidth / timerTxt.length()); - DbgUtils.logd( TAG, "layoutBoardOnce(): posting JNICmd.CMD_LAYOUT(w=%d, h=%d)", - width, height ); + Log.d( TAG, "layoutBoardOnce(): posting JNICmd.CMD_LAYOUT(w=%d, h=%d)", + width, height ); handle( JNIThread.JNICmd.CMD_LAYOUT, width, height, - fontWidth, m_defaultFontHt ); + fontWidth, m_defaultFontHt ); // We'll be back.... } else { - DbgUtils.logd( TAG, "layoutBoardOnce(): DOING IT" ); + Log.d( TAG, "layoutBoardOnce(): DOING IT" ); // If board size has changed we need a new bitmap int bmHeight = 1 + m_dims.height; int bmWidth = 1 + m_dims.width; @@ -284,7 +284,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { m_layoutHeight = height; layoutDone = true; } - DbgUtils.logd( TAG, "layoutBoardOnce()=>%b", layoutDone ); + Log.d( TAG, "layoutBoardOnce()=>%b", layoutDone ); return layoutDone; } // layoutBoardOnce @@ -297,7 +297,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { public void startHandling( Activity parent, JNIThread thread, CommsConnTypeSet connTypes ) { - DbgUtils.logd( TAG, "startHandling(thread=%H)", thread ); + Log.d( TAG, "startHandling(thread=%H)", thread ); m_parent = parent; m_jniThread = thread; m_jniGamePtr = thread.getGamePtr(); @@ -347,7 +347,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { public void dimsChanged( BoardDims dims ) { - DbgUtils.logd( TAG, "dimsChanged(%s)", dims.toString() ); + Log.d( TAG, "dimsChanged(%s)", dims.toString() ); m_dims = dims; m_parent.runOnUiThread( new Runnable() { public void run() @@ -412,7 +412,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { private void handle( JNIThread.JNICmd cmd, Object... args ) { if ( null == m_jniThread ) { - DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() ); + Log.w( TAG, "not calling handle(%s)", cmd.toString() ); DbgUtils.printStack( TAG ); } else { m_jniThread.handle( cmd, args ); 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 500c0ffa5..c9be05f40 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 @@ -130,7 +130,7 @@ public class ChatDelegate extends DelegateBase { super.onResume(); m_jniThreadRef = JNIThread.getRetained( m_rowid ); if ( null == m_jniThreadRef ) { - DbgUtils.logw( TAG, "onResume(): m_jniThreadRef null; exiting" ); + Log.w( TAG, "onResume(): m_jniThreadRef null; exiting" ); finish(); } else { s_visibleThis = this; 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 828d83b51..6d5c02d75 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 @@ -95,11 +95,10 @@ public class CommsTransport implements TransportProcs, closeSocket(); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } catch ( UnresolvedAddressException uae ) { - DbgUtils.logw( TAG, "bad address: name: %s; port: %s; exception: %s", - m_useHost, m_relayAddr.ip_relay_port, - uae.toString() ); + Log.w( TAG, "bad address: name: %s; port: %s; exception: %s", + m_useHost, m_relayAddr.ip_relay_port, uae.toString() ); } m_thread = null; @@ -125,15 +124,14 @@ public class CommsTransport implements TransportProcs, try { m_socketChannel = SocketChannel.open(); m_socketChannel.configureBlocking( false ); - DbgUtils.logi( TAG, "connecting to %s:%d", - m_useHost, - m_relayAddr.ip_relay_port ); + Log.i( TAG, "connecting to %s:%d", + m_useHost, m_relayAddr.ip_relay_port ); InetSocketAddress isa = new InetSocketAddress(m_useHost, m_relayAddr.ip_relay_port ); m_socketChannel.connect( isa ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); failed = true; break outer_loop; } @@ -150,14 +148,14 @@ public class CommsTransport implements TransportProcs, // we get this when relay goes down. Need to notify! failed = true; closeSocket(); - DbgUtils.logw( TAG, "exiting: %s", cce.toString() ); + Log.w( TAG, "exiting: %s", cce.toString() ); break; // don't try again } catch ( java.io.IOException ioe ) { closeSocket(); - DbgUtils.logw( TAG, "exiting: %s", ioe.toString() ); - DbgUtils.logw( TAG, ioe.toString() ); + Log.w( TAG, "exiting: %s", ioe.toString() ); + Log.w( TAG, ioe.toString() ); } catch ( java.nio.channels.NoConnectionPendingException ncp ) { - DbgUtils.logex( TAG, ncp ); + Log.ex( TAG, ncp ); closeSocket(); break; } @@ -199,13 +197,13 @@ public class CommsTransport implements TransportProcs, } } } catch ( java.io.IOException ioe ) { - DbgUtils.logw( TAG, "%s: cancelling key", ioe.toString() ); + Log.w( TAG, "%s: cancelling key", ioe.toString() ); key.cancel(); failed = true; break outer_loop; } catch ( java.nio.channels. NoConnectionPendingException ncp ) { - DbgUtils.logex( TAG, ncp ); + Log.ex( TAG, ncp ); break outer_loop; } } @@ -261,7 +259,7 @@ public class CommsTransport implements TransportProcs, try { m_socketChannel.close(); } catch ( Exception e ) { - DbgUtils.logw( TAG, "closing socket: %s", e.toString() ); + Log.w( TAG, "closing socket: %s", e.toString() ); } m_socketChannel = null; } @@ -342,7 +340,7 @@ public class CommsTransport implements TransportProcs, try { m_thread.join(100); // wait up to 1/10 second } catch ( java.lang.InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); } m_thread = null; } @@ -356,8 +354,8 @@ public class CommsTransport implements TransportProcs, public int transportSend( byte[] buf, String msgNo, CommsAddrRec addr, CommsConnType conType, int gameID ) { - DbgUtils.logd( TAG, "transportSend(len=%d, typ=%s)", - buf.length, conType.toString() ); + Log.d( TAG, "transportSend(len=%d, typ=%s)", buf.length, + conType.toString() ); int nSent = -1; Assert.assertNotNull( addr ); Assert.assertTrue( addr.contains( conType ) ); @@ -385,13 +383,13 @@ public class CommsTransport implements TransportProcs, // Keep this while debugging why the resend_all that gets // fired on reconnect doesn't unstall a game but a manual // resend does. - DbgUtils.logd( TAG, "transportSend(%d)=>%d", buf.length, nSent ); + Log.d( TAG, "transportSend(%d)=>%d", buf.length, nSent ); return nSent; } public void relayStatus( CommsRelayState newState ) { - DbgUtils.logi( TAG, "relayStatus called; state=%s", newState.toString() ); + Log.i( TAG, "relayStatus called; state=%s", newState.toString() ); switch( newState ) { case COMMS_RELAYSTATE_UNCONNECTED: 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 0be93dd72..92af260c9 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 @@ -387,7 +387,7 @@ public class ConnStatusHandler { // } catch ( java.lang.ClassNotFoundException cnfe ) { // DbgUtils.logf( "loadState: %s", cnfe.toString() ); } catch ( Exception ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } } @@ -506,7 +506,7 @@ public class ConnStatusHandler { XWPrefs.setPrefsString( context, R.string.key_connstat_data, as64 ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } s_needsSave = false; } @@ -545,8 +545,7 @@ public class ConnStatusHandler { result = WiDirService.connecting(); break; default: - DbgUtils.logw( TAG, "connTypeEnabled: %s not handled", - connType.toString() ); + Log.w( TAG, "connTypeEnabled: %s not handled", connType.toString() ); break; } return result; 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 94b4cc7b9..4da52eac2 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 @@ -45,8 +45,8 @@ public class DBAlert extends XWDialogFragment { if ( BuildConfig.DEBUG ) { for ( Object obj : params ) { if ( null != obj && !(obj instanceof Serializable) ) { - DbgUtils.logd( TAG, "OOPS: %s not Serializable", - obj.getClass().getName() ); + Log.d( TAG, "OOPS: %s not Serializable", + obj.getClass().getName() ); // Assert.fail(); } } @@ -107,7 +107,7 @@ public class DBAlert extends XWDialogFragment { activity.show( newMe ); dismiss(); // kill myself... } else { - DbgUtils.logd( TAG, "null activity..." ); + Log.d( TAG, "null activity..." ); } } } ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java index 8f40878ab..2ca79a073 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java @@ -261,8 +261,7 @@ public class DBHelper extends SQLiteOpenHelper { @SuppressWarnings("fallthrough") public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion ) { - DbgUtils.logi( TAG, false, "onUpgrade: old: %d; new: %d", - oldVersion, newVersion ); + Log.i( TAG, "onUpgrade: old: %d; new: %d", oldVersion, newVersion ); boolean madeSumTable = false; switch( oldVersion ) { 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 29c4c6db2..ae2baa3f5 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 @@ -449,7 +449,7 @@ public class DBUtils { db.close(); } - // DbgUtils.logd( TAG, "countOpenGamesUsingRelay() => %d", result ); + // Log.d( TAG, "countOpenGamesUsingRelay() => %d", result ); return result; } @@ -826,8 +826,8 @@ public class DBUtils { db.close(); } if ( null != result && 1 < result.length ) { - DbgUtils.logi( TAG, "getRowIDsFor(%x)=>length %d array", gameID, - result.length ); + Log.i( TAG, "getRowIDsFor(%x)=>length %d array", gameID, + result.length ); } return result; } @@ -874,7 +874,7 @@ public class DBUtils { int gameID = cursor.getInt( col ); col = cursor.getColumnIndex( DBHelper.REMOTEDEVS ); String devs = cursor.getString( col ); - DbgUtils.logi( TAG, "gameid %d has remote[s] %s", gameID, devs ); + Log.i( TAG, "gameid %d has remote[s] %s", gameID, devs ); if ( null != devs && 0 < devs.length() ) { for ( String dev : TextUtils.split( devs, "\n" ) ) { @@ -990,7 +990,7 @@ public class DBUtils { long result = db.replaceOrThrow( DBHelper.TABLE_NAME_OBITS, "", values ); } catch ( Exception ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } db.close(); } @@ -1125,8 +1125,7 @@ public class DBUtils { result = cursor.getBlob( cursor .getColumnIndex(DBHelper.SNAPSHOT)); } else { - DbgUtils.loge( TAG, "loadGame: none for rowid=%d", - rowid ); + Log.e( TAG, "loadGame: none for rowid=%d", rowid ); } cursor.close(); db.close(); @@ -1143,7 +1142,7 @@ public class DBUtils { deleteGame( context, lock ); lock.unlock(); } else { - DbgUtils.loge( TAG, "deleteGame: unable to lock rowid %d", rowid ); + Log.e( TAG, "deleteGame: unable to lock rowid %d", rowid ); if ( BuildConfig.DEBUG ) { Assert.fail(); } @@ -1234,15 +1233,15 @@ public class DBUtils { HistoryPair[] result = null; String oldHistory = getChatHistoryStr( context, rowid ); if ( null != oldHistory ) { - DbgUtils.logd( TAG, "convertChatString(): got string: %s", oldHistory ); + Log.d( TAG, "convertChatString(): got string: %s", oldHistory ); ArrayList valuess = new ArrayList(); ArrayList pairs = new ArrayList(); String localPrefix = LocUtils.getString( context, R.string.chat_local_id ); String rmtPrefix = LocUtils.getString( context, R.string.chat_other_id ); - DbgUtils.logd( TAG, "convertChatString(): prefixes: \"%s\" and \"%s\"", localPrefix, rmtPrefix ); + Log.d( TAG, "convertChatString(): prefixes: \"%s\" and \"%s\"", localPrefix, rmtPrefix ); String[] msgs = oldHistory.split( "\n" ); - DbgUtils.logd( TAG, "convertChatString(): split into %d", msgs.length ); + Log.d( TAG, "convertChatString(): split into %d", msgs.length ); int localPlayerIndx = -1; int remotePlayerIndx = -1; for ( int ii = playersLocal.length - 1; ii >= 0; --ii ) { @@ -1253,24 +1252,24 @@ public class DBUtils { } } for ( String msg : msgs ) { - DbgUtils.logd( TAG, "convertChatString(): msg: %s", msg ); + Log.d( TAG, "convertChatString(): msg: %s", msg ); int indx = -1; String prefix = null; if ( msg.startsWith( localPrefix ) ) { - DbgUtils.logd( TAG, "convertChatString(): msg: %s starts with %s", msg, localPrefix ); + Log.d( TAG, "convertChatString(): msg: %s starts with %s", msg, localPrefix ); prefix = localPrefix; indx = localPlayerIndx; } else if ( msg.startsWith( rmtPrefix ) ) { - DbgUtils.logd( TAG, "convertChatString(): msg: %s starts with %s", msg, rmtPrefix ); + Log.d( TAG, "convertChatString(): msg: %s starts with %s", msg, rmtPrefix ); prefix = rmtPrefix; indx = remotePlayerIndx; } else { - DbgUtils.logd( TAG, "convertChatString(): msg: %s starts with neither", msg ); + Log.d( TAG, "convertChatString(): msg: %s starts with neither", msg ); } if ( -1 != indx ) { - DbgUtils.logd( TAG, "convertChatString(): removing substring %s; was: %s", prefix, msg ); + Log.d( TAG, "convertChatString(): removing substring %s; was: %s", prefix, msg ); msg = msg.substring( prefix.length(), msg.length() ); - DbgUtils.logd( TAG, "convertChatString(): removED substring; now %s", msg ); + Log.d( TAG, "convertChatString(): removED substring; now %s", msg ); valuess.add( cvForChat( rowid, msg, indx ) ); HistoryPair pair = new HistoryPair(msg, indx ); @@ -1340,8 +1339,8 @@ public class DBUtils { startAndEndOut[1] = Math.min( result.length(), Integer.parseInt( parts[1] ) ); } - DbgUtils.logd( TAG, "getCurChat(): => %s [%d,%d]", result, - startAndEndOut[0], startAndEndOut[1] ); + Log.d( TAG, "getCurChat(): => %s [%d,%d]", result, + startAndEndOut[0], startAndEndOut[1] ); return result; } @@ -1863,8 +1862,8 @@ public class DBUtils { ArrayList valuess = new ArrayList(); valuess.add( cvForChat( rowid, msg, fromPlayer ) ); appendChatHistory( context, valuess ); - DbgUtils.logi( TAG, "appendChatHistory: inserted \"%s\" from player %d", - msg, fromPlayer ); + Log.i( TAG, "appendChatHistory: inserted \"%s\" from player %d", + msg, fromPlayer ); } // appendChatHistory public static void clearChatHistory( Context context, long rowid ) @@ -1938,13 +1937,13 @@ public class DBUtils { channelSrc.transferTo( 0, channelSrc.size(), channelDest ); success = true; } catch( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } finally { try { channelSrc.close(); channelDest.close(); } catch( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } return success; @@ -2303,7 +2302,7 @@ public class DBUtils { try { updateStmt.execute(); } catch ( Exception ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); Assert.fail(); } } @@ -2440,7 +2439,7 @@ public class DBUtils { public static void setIntFor( Context context, String key, int value ) { - // DbgUtils.logdf( "DBUtils.setIntFor(key=%s, val=%d)", key, value ); + // Log.df( "DBUtils.setIntFor(key=%s, val=%d)", key, value ); String asStr = String.format( "%d", value ); setStringFor( context, key, asStr ); } @@ -2451,13 +2450,13 @@ public class DBUtils { if ( null != asStr ) { dflt = Integer.parseInt( asStr ); } - // DbgUtils.logdf( "DBUtils.getIntFor(key=%s)=>%d", key, dflt ); + // Log.df( "DBUtils.getIntFor(key=%s)=>%d", key, dflt ); return dflt; } public static void setBoolFor( Context context, String key, boolean value ) { - // DbgUtils.logdf( "DBUtils.setBoolFor(key=%s, val=%b)", key, value ); + // Log.df( "DBUtils.setBoolFor(key=%s, val=%b)", key, value ); String asStr = String.format( "%b", value ); setStringFor( context, key, asStr ); } @@ -2468,7 +2467,7 @@ public class DBUtils { if ( null != asStr ) { dflt = Boolean.parseBoolean( asStr ); } - // DbgUtils.logdf( "DBUtils.getBoolFor(key=%s)=>%b", key, dflt ); + // Log.df( "DBUtils.getBoolFor(key=%s)=>%b", key, dflt ); return dflt; } @@ -2527,7 +2526,7 @@ public class DBUtils { String.format( "not rowid in (select rowid from %s order by TIMESTAMP desc limit %d)", DBHelper.TABLE_NAME_LOGS, LOGLIMIT ); int nGone = db.delete( DBHelper.TABLE_NAME_LOGS, where, null ); - DbgUtils.logi( TAG, false, "appendLog(): deleted %d rows", nGone ); + Log.i( TAG, "appendLog(): deleted %d rows", nGone ); } db.close(); } @@ -2558,7 +2557,7 @@ public class DBUtils { invalGroupsCache(); } } catch( java.io.FileNotFoundException fnfe ) { - DbgUtils.logex( TAG, fnfe ); + Log.ex( TAG, fnfe ); } } @@ -2602,7 +2601,7 @@ public class DBUtils { int result = updateRowImpl( db, table, rowid, values ); db.close(); if ( 0 == result ) { - DbgUtils.logw( TAG, "updateRow failed" ); + Log.w( TAG, "updateRow failed" ); } } } 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 89aa2b331..33c6de9fc 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 @@ -26,7 +26,6 @@ import android.database.Cursor; import android.database.DatabaseUtils; import android.os.Looper; import android.text.format.Time; -import android.util.Log; import junit.framework.Assert; @@ -79,31 +78,6 @@ public class DbgUtils { } } - public static void logd( String tag, String fmt, Object... args ) { - callLog( LogType.DEBUG, tag, fmt, args ); - } - - public static void loge( String tag, String fmt, Object... args ) - { - callLog( LogType.ERROR, tag, fmt, args ); - } - - public static void logi( String tag, String fmt, Object... args ) - { - logi( tag, true, fmt, args ); - } - - public static void logi( String tag, boolean persist, String fmt, - Object... args ) - { - callLog( LogType.INFO, tag, fmt, args ); - } - - public static void logw( String tag, String fmt, Object... args ) - { - callLog( LogType.WARN, tag, fmt, args ); - } - public static void showf( String format, Object... args ) { showf( XWApp.getContext(), format, args ); @@ -121,12 +95,6 @@ public class DbgUtils { showf( context, LocUtils.getString( context, formatid ), args ); } // showf - public static void logex( String tag, Exception exception ) - { - logw( TAG, "Exception: %s", exception.toString() ); - printStack( tag, exception.getStackTrace() ); - } - public static void assertOnUIThread() { Assert.assertTrue( Looper.getMainLooper().equals(Looper.myLooper()) ); @@ -137,7 +105,7 @@ public class DbgUtils { if ( s_doLog && null != trace ) { // 1: skip printStack etc. for ( int ii = 1; ii < trace.length; ++ii ) { - DbgUtils.logd( tag, "ste %d: %s", ii, trace[ii].toString() ); + Log.d( tag, "ste %d: %s", ii, trace[ii].toString() ); } } } @@ -169,7 +137,7 @@ public class DbgUtils { { if ( s_doLog ) { String dump = DatabaseUtils.dumpCursorToString( cursor ); - logi( TAG, "cursor: %s", dump ); + Log.i( TAG, "cursor: %s", dump ); } } 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 6ea3dfb8d..b600bce7d 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 @@ -129,14 +129,14 @@ public class DelegateBase implements DlgClickNotify, protected void onActivityResult( RequestCode requestCode, int resultCode, Intent data ) { - DbgUtils.logi( TAG, "onActivityResult(): subclass responsibility!!!" ); + Log.i( TAG, "onActivityResult(): subclass responsibility!!!" ); } protected void onStart() { Class clazz = getClass(); if ( s_instances.containsKey( clazz ) ) { - DbgUtils.logd( TAG, "onStart(): replacing curThis" ); + Log.d( TAG, "onStart(): replacing curThis" ); } s_instances.put( clazz, new WeakReference(this) ); } @@ -172,7 +172,7 @@ public class DelegateBase implements DlgClickNotify, result = ref.get(); } if ( this != result ) { - DbgUtils.logd( TAG, "%s.curThis() => " + result, this.toString() ); + Log.d( TAG, "%s.curThis() => " + result, this.toString() ); } return result; } @@ -199,7 +199,7 @@ public class DelegateBase implements DlgClickNotify, protected boolean isFinishing() { boolean result = m_activity.isFinishing(); - // DbgUtils.logd( TAG, "%s.isFinishing() => %b", getClass().getSimpleName(), result ); + // Log.d( TAG, "%s.isFinishing() => %b", getClass().getSimpleName(), result ); return result; } @@ -430,7 +430,7 @@ public class DelegateBase implements DlgClickNotify, protected Dialog makeDialog( DBAlert alert, Object[] params ) { DlgID dlgID = alert.getDlgID(); - DbgUtils.logd( TAG, "makeDialog(): not handling %s", dlgID.toString() ); + Log.d( TAG, "makeDialog(): not handling %s", dlgID.toString() ); return null; } @@ -487,7 +487,7 @@ public class DelegateBase implements DlgClickNotify, try { m_activity.dismissDialog( dlgID.ordinal() ); } catch ( Exception ex ) { - // DbgUtils.logex( ex ); + // Log.ex( ex ); } } @@ -619,13 +619,12 @@ public class DelegateBase implements DlgClickNotify, protected boolean canHandleNewIntent( Intent intent ) { - DbgUtils.logd( TAG, "canHandleNewIntent() => false" ); + Log.d( TAG, "canHandleNewIntent() => false" ); return false; } protected void handleNewIntent( Intent intent ) { - DbgUtils.logd( TAG, "handleNewIntent(%s): not handling", - intent.toString() ); + Log.d( TAG, "handleNewIntent(%s): not handling", intent.toString() ); } protected void runWhenActive( Runnable proc ) @@ -643,7 +642,7 @@ public class DelegateBase implements DlgClickNotify, switch( event ) { case BT_ERR_COUNT: int count = (Integer)args[0]; - DbgUtils.logi( TAG, "Bluetooth error count: %d", count ); + Log.i( TAG, "Bluetooth error count: %d", count ); break; case BAD_PROTO_BT: fmtId = R.string.bt_bad_proto_fmt; @@ -658,8 +657,7 @@ public class DelegateBase implements DlgClickNotify, m_dlgDelegate.eventOccurred( event, args ); break; default: - DbgUtils.logd( TAG, "eventOccurred(event=%s) (DROPPED)", - event.toString() ); + Log.d( TAG, "eventOccurred(event=%s) (DROPPED)", event.toString() ); break; } @@ -679,8 +677,8 @@ public class DelegateBase implements DlgClickNotify, public boolean onPosButton( Action action, Object[] params ) { boolean handled = true; - DbgUtils.logd( TAG, "%s.posButtonClicked(%s)", getClass().getSimpleName(), - action.toString() ); + Log.d( TAG, "%s.posButtonClicked(%s)", getClass().getSimpleName(), + action.toString() ); switch( action ) { case ENABLE_SMS_ASK: showSMSEnableDialog( Action.ENABLE_SMS_DO ); @@ -698,7 +696,7 @@ public class DelegateBase implements DlgClickNotify, Perms23.onGotPermsAction( true, params ); break; default: - DbgUtils.logd( TAG, "unhandled action %s", action.toString() ); + Log.d( TAG, "unhandled action %s", action.toString() ); // Assert.assertTrue( !BuildConfig.DEBUG ); handled = false; break; @@ -709,14 +707,14 @@ public class DelegateBase implements DlgClickNotify, public boolean onNegButton( Action action, Object[] params ) { boolean handled = true; - // DbgUtils.logd( TAG, "%s.negButtonClicked(%s)", getClass().getSimpleName(), + // Log.d( TAG, "%s.negButtonClicked(%s)", getClass().getSimpleName(), // action.toString() ); switch ( action ) { case PERMS_QUERY: Perms23.onGotPermsAction( false, params ); break; default: - DbgUtils.logd( TAG, "onNegButton: unhandled action %s", action.toString() ); + Log.d( TAG, "onNegButton: unhandled action %s", action.toString() ); handled = false; break; } @@ -725,8 +723,8 @@ public class DelegateBase implements DlgClickNotify, public boolean onDismissed( Action action, Object[] params ) { - DbgUtils.logd( TAG, "%s.dlgDismissed(%s)", getClass().getSimpleName(), - action.toString() ); + Log.d( TAG, "%s.dlgDismissed(%s)", getClass().getSimpleName(), + action.toString() ); return false; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DevID.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DevID.java index f72bf5b74..0fc95e534 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DevID.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DevID.java @@ -85,18 +85,18 @@ public class DevID { s_relayDevID = asStr; } } - DbgUtils.logd( TAG, "getRelayDevID() => %s", s_relayDevID ); + Log.d( TAG, "getRelayDevID() => %s", s_relayDevID ); return s_relayDevID; } public static void setRelayDevID( Context context, String devID ) { - DbgUtils.logd( TAG, "setRelayDevID()" ); + Log.d( TAG, "setRelayDevID()" ); if ( BuildConfig.DEBUG ) { String oldID = getRelayDevID( context ); if ( null != oldID && 0 < oldID.length() && ! devID.equals( oldID ) ) { - DbgUtils.logd( TAG, "devID changing!!!: %s => %s", oldID, devID ); + Log.d( TAG, "devID changing!!!: %s => %s", oldID, devID ); } } DBUtils.setStringFor( context, DEVID_KEY, devID ); @@ -108,7 +108,7 @@ public class DevID { public static void clearRelayDevID( Context context ) { - DbgUtils.logi( TAG, "clearRelayDevID()" ); + Log.i( TAG, "clearRelayDevID()" ); DBUtils.setStringFor( context, DEVID_KEY, "" ); // DbgUtils.printStack(); } 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 56acabda7..e40bc856d 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 @@ -259,7 +259,7 @@ public class DictBrowseDelegate extends DelegateBase try { super.finalize(); } catch ( java.lang.Throwable err ){ - DbgUtils.logi( TAG, "%s", err.toString() ); + Log.i( TAG, "%s", err.toString() ); } } @@ -455,7 +455,7 @@ public class DictBrowseDelegate extends DelegateBase DictUtils.DictLoc loc = DictUtils.getDictLoc( delegator.getActivity(), name ); if ( null == loc ) { - DbgUtils.logw( TAG, "launch(): DictLoc null; try again?" ); + Log.w( TAG, "launch(): DictLoc null; try again?" ); } else { launch( delegator, name, loc ); } 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 371083aeb..6f9bdd41c 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 @@ -362,7 +362,7 @@ public class DictLangCache { for ( DictAndLoc dal : dals ) { String name = getLangName( context, dal.name ); if ( null == name || 0 == name.length() ) { - DbgUtils.logw( TAG, "bad lang name for dal name %s", dal.name ); + Log.w( TAG, "bad lang name for dal name %s", dal.name ); // Assert.fail(); } langs.add( name ); @@ -474,8 +474,8 @@ public class DictLangCache { // Tmp test that recovers from problem with new background download code if ( null != info && 0 == info.langCode ) { - DbgUtils.logw( TAG, "getInfo: dropping info for %s b/c lang code wrong", - dal.name ); + Log.w( TAG, "getInfo: dropping info for %s b/c lang code wrong", + dal.name ); info = null; } @@ -494,8 +494,7 @@ public class DictLangCache { DBUtils.dictsSetInfo( context, dal, info ); } else { info = null; - DbgUtils.logi( TAG, - "getInfo(): unable to open dict %s", dal.name ); + Log.i( TAG, "getInfo(): unable to open dict %s", dal.name ); } } return info; 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 81b666ffc..f45608da5 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 @@ -207,9 +207,9 @@ public class DictUtils { fis.close(); loc = DictLoc.INTERNAL; } catch ( java.io.FileNotFoundException fnf ) { - // DbgUtils.logex( fnf ); + // Log.ex( fnf ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -278,7 +278,7 @@ public class DictUtils { success = DBUtils.copyFileStream( fos, fis ); } catch ( java.io.FileNotFoundException fnfe ) { - DbgUtils.logex( TAG, fnfe ); + Log.ex( TAG, fnfe ); } return success; } // copyDict @@ -375,11 +375,11 @@ public class DictUtils { bytes = new byte[len]; fis.read( bytes, 0, len ); fis.close(); - DbgUtils.logi( TAG, "Successfully loaded %s", name ); + Log.i( TAG, "Successfully loaded %s", name ); } catch ( java.io.FileNotFoundException fnf ) { - // DbgUtils.logex( fnf ); + // Log.ex( fnf ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -492,9 +492,9 @@ public class DictUtils { invalDictList(); } } catch ( java.io.FileNotFoundException fnf ) { - DbgUtils.logex( TAG, fnf ); + Log.ex( TAG, fnf ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); tmpFile.delete(); } } @@ -579,7 +579,7 @@ public class DictUtils { AssetManager am = context.getAssets(); return am.list(""); } catch( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); return new String[0]; } } @@ -604,7 +604,7 @@ public class DictUtils { if ( !result.exists() ) { result.mkdirs(); if ( !result.exists() ) { - DbgUtils.logw( TAG, "unable to create sd dir %s", packdir ); + Log.w( TAG, "unable to create sd dir %s", packdir ); result = null; } } 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 030335917..bffe2cb9b 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 @@ -338,7 +338,7 @@ public class DictsDelegate extends ListDelegateBase } } } else { - DbgUtils.logw( TAG, "No remote info for lang %s", langName ); + Log.w( TAG, "No remote info for lang %s", langName ); } } @@ -682,7 +682,7 @@ public class DictsDelegate extends ListDelegateBase for ( String name : selNames ) { DictLoc fromLoc = (DictLoc)m_selDicts.get( name ); if ( fromLoc == toLoc ) { - DbgUtils.logw( TAG, "not moving %s: same loc", name ); + Log.w( TAG, "not moving %s: same loc", name ); } else if ( DictUtils.moveDict( m_activity, name, fromLoc, toLoc ) ) { @@ -696,7 +696,7 @@ public class DictsDelegate extends ListDelegateBase fromLoc, toLoc ); } else { DbgUtils.showf( m_activity, R.string.toast_no_permission ); - DbgUtils.logw( TAG, "moveDict(%s) failed", name ); + Log.w( TAG, "moveDict(%s) failed", name ); } } } @@ -892,7 +892,7 @@ public class DictsDelegate extends ListDelegateBase ////////////////////////////////////////////////////////////////////// public void cardMounted( boolean nowMounted ) { - DbgUtils.logi( TAG, "cardMounted(%b)", nowMounted ); + Log.i( TAG, "cardMounted(%b)", nowMounted ); // post so other SDCardNotifiee implementations get a chance // to process first: avoid race conditions post( new Runnable() { @@ -1025,12 +1025,12 @@ public class DictsDelegate extends ListDelegateBase } else if ( obj instanceof DictInfo ) { ++results[SEL_REMOTE]; } else { - DbgUtils.logd( TAG, "obj is a: " + obj ); + Log.d( TAG, "obj is a: " + obj ); Assert.fail(); } } - DbgUtils.logi( TAG, "countSelDicts() => {loc: %d; remote: %d}", - results[SEL_LOCAL], results[SEL_REMOTE] ); + Log.i( TAG, "countSelDicts() => {loc: %d; remote: %d}", + results[SEL_LOCAL], results[SEL_REMOTE] ); return results; } @@ -1192,7 +1192,7 @@ public class DictsDelegate extends ListDelegateBase public void itemClicked( SelectableItem.LongClickHandler clicked, GameSummary summary ) { - DbgUtils.logi( TAG, "itemClicked not implemented" ); + Log.i( TAG, "itemClicked not implemented" ); } public void itemToggled( SelectableItem.LongClickHandler toggled, @@ -1287,7 +1287,7 @@ public class DictsDelegate extends ListDelegateBase } } catch ( JSONException ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); theOne = null; } } @@ -1385,7 +1385,7 @@ public class DictsDelegate extends ListDelegateBase new HashSet( Arrays.asList( m_langs ) ); // DictLangCache hits the DB hundreds of times below. Fix! - DbgUtils.logw( TAG, "Fix me I'm stupid" ); + Log.w( TAG, "Fix me I'm stupid" ); try { // DbgUtils.logf( "data: %s", jsonData ); JSONObject obj = new JSONObject( jsonData ); @@ -1467,7 +1467,7 @@ public class DictsDelegate extends ListDelegateBase success = true; } catch ( JSONException ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } 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 855fe7caa..bb5be8804 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 @@ -384,7 +384,7 @@ public class DlgDelegate { Assert.assertFalse( BuildConfig.DEBUG ); break; default: - DbgUtils.logd( TAG, "not creating %s", dlgID.toString() ); + Log.d( TAG, "not creating %s", dlgID.toString() ); break; } return dialog; @@ -559,7 +559,7 @@ public class DlgDelegate { break; default: - DbgUtils.loge( TAG, "eventOccurred: unhandled event %s", event.toString() ); + Log.e( TAG, "eventOccurred: unhandled event %s", event.toString() ); } if ( null != msg ) { @@ -643,8 +643,8 @@ public class DlgDelegate { if ( null == oneBase ) { iter.remove(); // no point in keeping it } else if ( base.equals( oneBase ) ) { - DbgUtils.logd( TAG, "removing alert %s for %s", dlgID.toString(), - oneBase.toString() ); + Log.d( TAG, "removing alert %s for %s", dlgID.toString(), + oneBase.toString() ); activity.removeDialog( dlgID.ordinal() ); iter.remove(); // no point in keeping this either } 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 2c19b8904..4414ca569 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 @@ -125,8 +125,7 @@ abstract class DlgDelegateAlert extends XWDialogFragment { notify.onNegButton( m_state.m_action, m_state.m_params ); break; default: - DbgUtils.loge( TAG, "unexpected button %d", - button ); + Log.e( TAG, "unexpected button %d", button ); // ignore on release builds Assert.assertFalse( BuildConfig.DEBUG ); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DualpaneDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DualpaneDelegate.java index 1a8fcb3a8..af65611c4 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DualpaneDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DualpaneDelegate.java @@ -78,7 +78,7 @@ public class DualpaneDelegate extends DelegateBase { { MainActivity main = (MainActivity)m_activity; main.dispatchNewIntent( intent ); - DbgUtils.logi( TAG, "handleNewIntent()" ); + Log.i( TAG, "handleNewIntent()" ); } @Override @@ -86,7 +86,7 @@ public class DualpaneDelegate extends DelegateBase { { MainActivity main = (MainActivity)m_activity; boolean handled = main.dispatchBackPressed(); - DbgUtils.logi( TAG, "handleBackPressed() => %b", handled ); + Log.i( TAG, "handleBackPressed() => %b", handled ); return handled; } 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 c90644419..9301fe024 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 @@ -146,11 +146,11 @@ public class DwnldDelegate extends ListDelegateBase { } is.close(); } catch ( java.net.URISyntaxException use ) { - DbgUtils.logex( TAG, use ); + Log.ex( TAG, use ); } catch ( java.net.MalformedURLException mue ) { - DbgUtils.logex( TAG, mue ); + Log.ex( TAG, mue ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } return null; } @@ -226,9 +226,9 @@ public class DwnldDelegate extends ListDelegateBase { fos.close(); success = !cancelled; } catch ( java.io.FileNotFoundException fnf ) { - DbgUtils.logex( TAG, fnf ); + Log.ex( TAG, fnf ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } if ( !success ) { 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 595def57a..c02b10d74 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 @@ -92,8 +92,8 @@ public class ExpiringDelegate { } } - DbgUtils.logd( TAG, "ref had %d refs, now has %d expiringdelegate views", - sizeBefore, dlgts.size() ); + Log.d( TAG, "ref had %d refs, now has %d expiringdelegate views", + sizeBefore, dlgts.size() ); for ( ExpiringDelegate dlgt : dlgts ) { dlgt.timerFired(); @@ -121,8 +121,7 @@ public class ExpiringDelegate { private void setHandler( Handler handler ) { if ( handler != m_handler ) { - DbgUtils.logd( TAG, "handler changing from %H to %H", - m_handler, handler ); + Log.d( TAG, "handler changing from %H to %H", m_handler, handler ); m_handler = handler; reschedule(); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/FragActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/FragActivity.java index fd0030918..894654676 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/FragActivity.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/FragActivity.java @@ -92,7 +92,7 @@ // isPortrait ); // m_isPortrait = isPortrait; // if ( isPortrait != (rect.width() <= rect.height()) ) { -// DbgUtils.logdf( "FragActivity.onConfigurationChanged(): isPortrait:" +// Log.df( "FragActivity.onConfigurationChanged(): isPortrait:" // + " %b; width: %d; height: %d", // isPortrait, rect.width(), rect.height() ); // } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GCMIntentService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GCMIntentService.java index 067456fc9..a7a592972 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GCMIntentService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GCMIntentService.java @@ -40,13 +40,13 @@ public class GCMIntentService extends GCMBaseIntentService { @Override protected void onError( Context context, String error ) { - DbgUtils.logd( TAG, "onError(%s)", error ); + Log.d( TAG, "onError(%s)", error ); } @Override protected void onRegistered( Context context, String regId ) { - DbgUtils.logd( TAG, "onRegistered(%s)", regId ); + Log.d( TAG, "onRegistered(%s)", regId ); DevID.setGCMDevID( context, regId ); notifyRelayService( context, true ); } @@ -54,7 +54,7 @@ public class GCMIntentService extends GCMBaseIntentService { @Override protected void onUnregistered( Context context, String regId ) { - DbgUtils.logd( TAG, "onUnregistered(%s)", regId ); + Log.d( TAG, "onUnregistered(%s)", regId ); DevID.clearGCMDevID( context ); RelayService.devIDChanged(); notifyRelayService( context, false ); @@ -63,13 +63,13 @@ public class GCMIntentService extends GCMBaseIntentService { @Override protected void onMessage( Context context, Intent intent ) { - DbgUtils.logd( TAG, "onMessage()" ); + Log.d( TAG, "onMessage()" ); notifyRelayService( context, true ); String value; boolean ignoreIt = XWApp.GCM_IGNORED; if ( ignoreIt ) { - DbgUtils.logd( TAG, "received GCM but ignoring it" ); + Log.d( TAG, "received GCM but ignoring it" ); } else { value = intent.getStringExtra( "checkUpdates" ); if ( null != value && Boolean.parseBoolean( value ) ) { @@ -96,7 +96,7 @@ public class GCMIntentService extends GCMBaseIntentService { RelayService.processGameMsgs( context, connname, strs64 ); } } catch (org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } } @@ -130,10 +130,10 @@ public class GCMIntentService extends GCMBaseIntentService { GCMRegistrar.register( app, BuildConfig.GCM_SENDER_ID ); } } catch ( UnsupportedOperationException uoe ) { - DbgUtils.logw( TAG, "Device can't do GCM." ); + Log.w( TAG, "Device can't do GCM." ); } catch ( Exception whatever ) { // funky devices could do anything - DbgUtils.logex( TAG, whatever ); + Log.ex( TAG, whatever ); } } } 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 c8f683bb0..2d682d356 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 @@ -165,7 +165,7 @@ public class GameConfigDelegate extends DelegateBase { Dialog dialog = null; final DlgID dlgID = alert.getDlgID(); - DbgUtils.logd( TAG, "makeDialog(%s)", dlgID.toString() ); + Log.d( TAG, "makeDialog(%s)", dlgID.toString() ); DialogInterface.OnClickListener dlpos; AlertDialog.Builder ab; @@ -347,7 +347,7 @@ public class GameConfigDelegate extends DelegateBase private void setPlayerSettings( final View playerView ) { - DbgUtils.logd( TAG, "setPlayerSettings()" ); + Log.d( TAG, "setPlayerSettings()" ); boolean isServer = ! localOnlyGame(); // Independent of other hide/show logic, these guys are @@ -414,7 +414,7 @@ public class GameConfigDelegate extends DelegateBase Utils.setChecked( playerView, R.id.robot_check, lp.isRobot() ); Utils.setChecked( playerView, R.id.remote_check, ! lp.isLocal ); - DbgUtils.logd( TAG, "setPlayerSettings() DONE" ); + Log.d( TAG, "setPlayerSettings() DONE" ); } private void getPlayerSettings( DialogInterface di ) @@ -763,7 +763,7 @@ public class GameConfigDelegate extends DelegateBase } break; default: - DbgUtils.logw( TAG, "unknown v: " + view.toString() ); + Log.w( TAG, "unknown v: " + view.toString() ); Assert.assertFalse( BuildConfig.DEBUG ); } } @@ -782,7 +782,7 @@ public class GameConfigDelegate extends DelegateBase private void saveAndClose( boolean forceNew ) { - DbgUtils.logi( TAG, "saveAndClose(forceNew=%b)", forceNew ); + Log.i( TAG, "saveAndClose(forceNew=%b)", forceNew ); applyChanges( forceNew ); finishAndLaunch(); @@ -1033,8 +1033,8 @@ public class GameConfigDelegate extends DelegateBase setting = 2; break; default: - DbgUtils.logw( TAG, "setSmartnessSpinner got %d from getRobotSmartness()", - m_gi.getRobotSmartness() ); + Log.w( TAG, "setSmartnessSpinner got %d from getRobotSmartness()", + m_gi.getRobotSmartness() ); Assert.fail(); } m_smartnessSpinner.setSelection( setting ); @@ -1075,7 +1075,7 @@ public class GameConfigDelegate extends DelegateBase private void adjustPlayersLabel() { - DbgUtils.logi( TAG, "adjustPlayersLabel()" ); + Log.i( TAG, "adjustPlayersLabel()" ); String label; if ( localOnlyGame() ) { label = getString( R.string.players_label_standalone ); 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 f8c09ec90..24afddcdb 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 @@ -459,8 +459,7 @@ public class GameListItem extends LinearLayout try { elem = s_queue.take(); } catch ( InterruptedException ie ) { - DbgUtils.logw( TAG, "interrupted; killing " - + "s_thumbThread" ); + Log.w( TAG, "interrupted; killing s_thumbThread" ); break; } Activity activity = elem.m_item.m_activity; 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 a509f78f2..6524d8732 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 @@ -56,8 +56,8 @@ public class GameLock { m_isForWrite = isForWrite; m_lockCount = 0; if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "GameLock(rowid:%d,isForWrite:%b)=>" - + "this: %H", rowid, isForWrite, this ); + Log.i( TAG, "GameLock(rowid:%d,isForWrite:%b)=>this: %H", + rowid, isForWrite, this ); DbgUtils.printStack( TAG ); } } @@ -92,20 +92,19 @@ public class GameLock { } } else if ( this == owner && ! m_isForWrite ) { if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "tryLock(): incrementing lock count" ); + Log.i( TAG, "tryLock(): incrementing lock count" ); } Assert.assertTrue( 0 == m_lockCount ); ++m_lockCount; gotIt = true; owner = null; } else if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "tryLock(): rowid %d already held by lock %H", - m_rowid, owner ); + Log.i( TAG, "tryLock(): rowid %d already held by lock %H", + m_rowid, owner ); } } if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "tryLock %H (rowid=%d) => %b", - this, m_rowid, gotIt ); + Log.i( TAG, "tryLock %H (rowid=%d) => %b", this, m_rowid, gotIt ); } return owner; } @@ -125,8 +124,8 @@ public class GameLock { long sleptTime = 0; if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "lock %H (rowid:%d, maxMillis=%d)", this, m_rowid, - maxMillis ); + Log.i( TAG, "lock %H (rowid:%d, maxMillis=%d)", this, m_rowid, + maxMillis ); } for ( ; ; ) { @@ -136,11 +135,11 @@ public class GameLock { break; } if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "lock() %H failed; sleeping", this ); + Log.i( TAG, "lock() %H failed; sleeping", this ); if ( 0 == sleptTime || sleptTime + SLEEP_TIME >= ASSERT_TIME ) { - DbgUtils.logi( TAG, "lock %H seeking stack:", curOwner ); + Log.i( TAG, "lock %H seeking stack:", curOwner ); DbgUtils.printStack( TAG, curOwner.m_lockTrace ); - DbgUtils.logi( TAG, "lock %H seeking stack:", this ); + Log.i( TAG, "lock %H seeking stack:", this ); DbgUtils.printStack( TAG ); } } @@ -148,12 +147,12 @@ public class GameLock { Thread.sleep( SLEEP_TIME ); // milliseconds sleptTime += SLEEP_TIME; } catch( InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); break; } if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "lock() %H awake; " + Log.i( TAG, "lock() %H awake; " + "sleptTime now %d millis", this, sleptTime ); } @@ -163,7 +162,7 @@ public class GameLock { throw new GameLockedException(); } else if ( sleptTime >= ASSERT_TIME ) { if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "lock %H overlocked", this ); + Log.i( TAG, "lock %H overlocked", this ); } Assert.fail(); } @@ -189,8 +188,7 @@ public class GameLock { --m_lockCount; if ( DEBUG_LOCKS ) { - DbgUtils.logi( TAG, "unlock: this: %H (rowid:%d) unlocked", - this, m_rowid ); + Log.i( TAG, "unlock: this: %H (rowid:%d) unlocked", this, m_rowid ); } } } @@ -205,7 +203,7 @@ public class GameLock { { boolean result = m_isForWrite && 1 == m_lockCount; if ( !result ) { - DbgUtils.logw( TAG, "canWrite(): %H, returning false", this ); + Log.w( TAG, "canWrite(): %H, returning false", this ); } return result; } 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 22b0f439a..74d1f2e38 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 @@ -73,7 +73,7 @@ public class GameUtils { public static class NoSuchGameException extends RuntimeException { public NoSuchGameException() { - DbgUtils.logi( TAG, "NoSuchGameException()"); + Log.i( TAG, "NoSuchGameException()"); } } @@ -161,7 +161,7 @@ public class GameUtils { Utils.cancelNotification( context, (int)rowidIn ); success = true; } else { - DbgUtils.logw( TAG, "resetGame: unable to open rowid %d", rowidIn ); + Log.w( TAG, "resetGame: unable to open rowid %d", rowidIn ); } return success; } @@ -218,7 +218,7 @@ public class GameUtils { try { lock = new GameLock( rowid, false ).lock( maxMillis ); } catch ( GameLock.GameLockedException gle ) { - DbgUtils.logex( TAG, gle ); + Log.ex( TAG, gle ); } } @@ -262,8 +262,7 @@ public class GameUtils { lockSrc.unlock(); } } else { - DbgUtils.logd( TAG, "dupeGame: unable to open rowid %d", - rowidIn ); + Log.d( TAG, "dupeGame: unable to open rowid %d", rowidIn ); } return rowid; } @@ -286,7 +285,7 @@ public class GameUtils { lock.unlock(); success = true; } else { - DbgUtils.logw( TAG, "deleteGame: unable to delete rowid %d", rowid ); + Log.w( TAG, "deleteGame: unable to delete rowid %d", rowid ); success = false; } return success; @@ -354,14 +353,14 @@ public class GameUtils { GamePtr gamePtr = null; if ( null == stream ) { - DbgUtils.logw( TAG, "loadMakeGame: no saved game!"); + Log.w( TAG, "loadMakeGame: no saved game!"); } else { XwJNI.gi_from_stream( gi, stream ); String[] dictNames = gi.dictNames(); DictUtils.DictPairs pairs = DictUtils.openDicts( context, dictNames ); if ( pairs.anyMissing( dictNames ) ) { - DbgUtils.logw( TAG, "loadMakeGame() failing: dicts %s unavailable", - TextUtils.join( ",", dictNames ) ); + Log.w( TAG, "loadMakeGame() failing: dicts %s unavailable", + TextUtils.join( ",", dictNames ) ); } else { String langName = gi.langName( context ); gamePtr = XwJNI.initFromStream( rowid, stream, gi, dictNames, @@ -442,8 +441,8 @@ public class GameUtils { long oldest = s_sendTimes[s_sendTimes.length - 1]; long age = now - oldest; force = RESEND_INTERVAL_SECS < age; - DbgUtils.logd( TAG, "resendAllIf(): based on last send age of %d sec, doit = %b", - age, force ); + Log.d( TAG, "resendAllIf(): based on last send age of %d sec, doit = %b", + age, force ); } if ( force ) { @@ -522,7 +521,7 @@ public class GameUtils { public static long makeNewMultiGame( Context context, NetLaunchInfo nli, MultiMsgSink sink, UtilCtxt util ) { - DbgUtils.logd( TAG, "makeNewMultiGame(nli=%s)", nli.toString() ); + Log.d( TAG, "makeNewMultiGame(nli=%s)", nli.toString() ); CommsAddrRec addr = nli.makeAddrRec( context ); return makeNewMultiGame( context, sink, util, DBUtils.GROUPID_UNSPEC, @@ -797,7 +796,7 @@ public class GameUtils { } allHere = 0 == missingSet.size(); } else { - DbgUtils.logw( TAG, "gameDictsHere: game has no dicts!" ); + Log.w( TAG, "gameDictsHere: game has no dicts!" ); } if ( null != missingNames ) { missingNames[0] = @@ -998,7 +997,7 @@ public class GameUtils { lock.unlock(); } else { - DbgUtils.logw( TAG, "replaceDicts: unable to open rowid %d", rowid ); + Log.w( TAG, "replaceDicts: unable to open rowid %d", rowid ); } return success; } // replaceDicts @@ -1084,7 +1083,7 @@ public class GameUtils { do { rint = Utils.nextRandomInt(); } while ( 0 == rint ); - DbgUtils.logi( TAG, "newGameID()=>%X (%d)", rint, rint ); + Log.i( TAG, "newGameID()=>%X (%d)", rint, rint ); return rint; } @@ -1120,8 +1119,8 @@ public class GameUtils { Utils.postNotification( context, intent, title, msg, (int)rowid ); } } else { - DbgUtils.logd( TAG, "postMoveNotification(): posting nothing for lack" - + " of brm" ); + Log.d( TAG, "postMoveNotification(): posting nothing for lack" + + " of brm" ); } } @@ -1192,7 +1191,7 @@ public class GameUtils { fos.close(); result = file; } catch ( Exception ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } return result; @@ -1238,11 +1237,11 @@ public class GameUtils { int nSent = XwJNI.comms_resendAll( gamePtr, true, m_filter, false ); gamePtr.release(); - DbgUtils.logd( TAG, "ResendTask.doInBackground(): sent %d " - + "messages for rowid %d", nSent, rowid ); + Log.d( TAG, "ResendTask.doInBackground(): sent %d " + + "messages for rowid %d", nSent, rowid ); } else { - DbgUtils.logd( TAG, "ResendTask.doInBackground(): loadMakeGame()" - + " failed for rowid %d", rowid ); + Log.d( TAG, "ResendTask.doInBackground(): loadMakeGame()" + + " failed for rowid %d", rowid ); } lock.unlock(); } else { @@ -1252,9 +1251,8 @@ public class GameUtils { false, false ); jniThread.release(); } else { - DbgUtils.logw( TAG, - "ResendTask.doInBackground: unable to unlock %d", - rowid ); + Log.w( TAG, "ResendTask.doInBackground: unable to unlock %d", + rowid ); } } } 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 94d23cd86..349fe0f60 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 @@ -155,8 +155,8 @@ public class GamesListDelegate extends ListDelegateBase alist.addAll( children ); if ( BuildConfig.DEBUG && ggi.m_count != children.size() ) { - DbgUtils.loge( TAG, "m_count: %d != size: %d", - ggi.m_count, children.size() ); + Log.e( TAG, "m_count: %d != size: %d", + ggi.m_count, children.size() ); Assert.fail(); } } @@ -295,7 +295,7 @@ public class GamesListDelegate extends ListDelegateBase } } if ( -1 == posn ) { - DbgUtils.logd( TAG, "getGroupPosition: group %d not found", groupID ); + Log.d( TAG, "getGroupPosition: group %d not found", groupID ); } } return posn; @@ -358,8 +358,8 @@ public class GamesListDelegate extends ListDelegateBase boolean changed = false; int newID = fieldToID( newField ); if ( -1 == newID ) { - DbgUtils.logd( TAG, "setField(): unable to match" - + " fieldName %s", newField ); + Log.d( TAG, "setField(): unable to match fieldName %s", + newField ); } else if ( m_fieldID != newID ) { m_fieldID = newID; // return true so caller will do onContentChanged. @@ -454,7 +454,7 @@ public class GamesListDelegate extends ListDelegateBase private ArrayList removeRange( ArrayList list, int start, int len ) { - DbgUtils.logd( TAG, "removeRange(start=%d, len=%d)", start, len ); + Log.d( TAG, "removeRange(start=%d, len=%d)", start, len ); ArrayList result = new ArrayList(len); for ( int ii = 0; ii < len; ++ii ) { result.add( list.remove( start ) ); @@ -1422,7 +1422,7 @@ public class GamesListDelegate extends ListDelegateBase switch ( requestCode ) { case REQUEST_LANG_GL: if ( !cancelled ) { - DbgUtils.logd( TAG, "lang need met" ); + Log.d( TAG, "lang need met" ); if ( checkWarnNoDict( m_missingDictRowId ) ) { launchGameIf(); } @@ -1552,7 +1552,7 @@ public class GamesListDelegate extends ListDelegateBase Assert.assertTrue( m_menuPrepared ); } else { - DbgUtils.logd( TAG, "onPrepareOptionsMenu: incomplete so bailing" ); + Log.d( TAG, "onPrepareOptionsMenu: incomplete so bailing" ); } return m_menuPrepared; } // onPrepareOptionsMenu @@ -1668,8 +1668,8 @@ public class GamesListDelegate extends ListDelegateBase AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo; View targetView = info.targetView; - DbgUtils.logd( TAG, "onCreateContextMenu(t=%s)", - targetView.getClass().getSimpleName() ); + Log.d( TAG, "onCreateContextMenu(t=%s)", + targetView.getClass().getSimpleName() ); if ( targetView instanceof GameListItem ) { item = (GameListItem)targetView; id = R.menu.games_list_game_menu; @@ -2474,7 +2474,7 @@ public class GamesListDelegate extends ListDelegateBase private void launchGame( long rowid, boolean invited ) { if ( DBUtils.ROWID_NOTFOUND == rowid ) { - DbgUtils.logd( TAG, "launchGame(): dropping bad rowid" ); + Log.d( TAG, "launchGame(): dropping bad rowid" ); } else if ( ! m_launchedGames.contains( rowid ) ) { m_launchedGames.add( rowid ); if ( m_adapter.inExpandedGroup( rowid ) ) { @@ -2520,7 +2520,7 @@ public class GamesListDelegate extends ListDelegateBase launchGame( rowid ); } } catch ( GameLock.GameLockedException gle ) { - DbgUtils.logex( TAG, gle ); + Log.ex( TAG, gle ); finish(); } } 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 0b49fcc0b..ff518f1bf 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 @@ -81,7 +81,7 @@ abstract class InviteDelegate extends ListDelegateBase result = str1.equals( pair.str1 ) && ((null == str2 && null == pair.str2) || str2.equals( pair.str2 ) ); - DbgUtils.logd( TAG, "%s.equals(%s) => %b", str1, pair.str1, result ); + Log.d( TAG, "%s.equals(%s) => %b", str1, pair.str1, result ); } return result; } 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 0cf39f6b0..7bdbbd446 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 @@ -237,7 +237,7 @@ public class LookupAlertView extends LinearLayout try { context.startActivity( intent ); } catch ( android.content.ActivityNotFoundException anfe ) { - DbgUtils.logex( TAG, anfe ); + Log.ex( TAG, anfe ); } } // lookupWord 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 566cd3c1a..625c3f856 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 @@ -156,10 +156,9 @@ public class MainActivity extends XWActivity break; } String name = frag.getClass().getSimpleName(); - DbgUtils.logd( TAG, "popIntoView(): popping %d: %s", top, name ); + Log.d( TAG, "popIntoView(): popping %d: %s", top, name ); fm.popBackStackImmediate(); - DbgUtils.logd( TAG, "popIntoView(): DONE popping %s", - name ); + Log.d( TAG, "popIntoView(): DONE popping %s", name ); } } @@ -182,14 +181,14 @@ public class MainActivity extends XWActivity frag.getDelegate().handleNewIntent( intent ); } } else { - DbgUtils.logd( TAG, "no fragment for child %s indx %d", - child.getClass().getSimpleName(), ii ); + Log.d( TAG, "no fragment for child %s indx %d", + child.getClass().getSimpleName(), ii ); } } if ( BuildConfig.DEBUG && !handled ) { // DbgUtils.showf( this, "dropping intent %s", intent.toString() ); - DbgUtils.logd( TAG, "dropping intent %s", intent.toString() ); + Log.d( TAG, "dropping intent %s", intent.toString() ); // DbgUtils.printStack(); // setIntent( intent ); -- look at handling this in onPostResume()? m_newIntent = intent; @@ -216,8 +215,8 @@ public class MainActivity extends XWActivity if ( null != frag ) { frag.onActivityResult( requestCode.ordinal(), resultCode, data ); } else { - DbgUtils.logd( TAG, "dispatchOnActivityResult(): can't dispatch %s", - requestCode.toString() ); + Log.d( TAG, "dispatchOnActivityResult(): can't dispatch %s", + requestCode.toString() ); } } @@ -309,15 +308,15 @@ public class MainActivity extends XWActivity { // make sure the right-most are visible int fragCount = getSupportFragmentManager().getBackStackEntryCount(); - DbgUtils.logi( TAG, "onBackStackChanged(); count now %d", fragCount ); + Log.i( TAG, "onBackStackChanged(); count now %d", fragCount ); if ( 0 == fragCount ) { finish(); } else { if ( fragCount == m_root.getChildCount() - 1 ) { View child = m_root.getChildAt( fragCount ); if ( LOG_IDS ) { - DbgUtils.logi( TAG, "onBackStackChanged(): removing view with id %x", - child.getId() ); + Log.i( TAG, "onBackStackChanged(): removing view with id %x", + child.getId() ); } m_root.removeView( child ); } @@ -327,7 +326,7 @@ public class MainActivity extends XWActivity if ( null != m_pendingResult ) { Fragment target = m_pendingResult.getTarget(); if ( null != target ) { - DbgUtils.logi( TAG,"onBackStackChanged(): calling onActivityResult()" ); + Log.i( TAG,"onBackStackChanged(): calling onActivityResult()" ); target.onActivityResult( m_pendingResult.m_request, m_pendingResult.m_result, m_pendingResult.m_data ); @@ -374,7 +373,7 @@ public class MainActivity extends XWActivity } else { result = 1; } - // DbgUtils.logd( TAG, "maxPanes() => %d", result ); + // Log.d( TAG, "maxPanes() => %d", result ); return result; } @@ -400,7 +399,7 @@ public class MainActivity extends XWActivity if ( null != frag ) { frag.setTitle(); } else { - DbgUtils.logd( TAG, "trySetTitle(): no fragment found" ); + Log.d( TAG, "trySetTitle(): no fragment found" ); } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MountEventReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MountEventReceiver.java index 73531c50c..03929db9c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MountEventReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MountEventReceiver.java @@ -39,7 +39,7 @@ public class MountEventReceiver extends BroadcastReceiver { @Override public void onReceive( Context context, Intent intent ) { - DbgUtils.logi( TAG, "onReceive(%s)", intent.getAction() ); + Log.i( TAG, "onReceive(%s)", intent.getAction() ); synchronized( s_procs ) { do { if ( s_procs.isEmpty() ) { 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 cdc0f41bb..a74cd1322 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 @@ -109,10 +109,10 @@ public class MultiMsgSink implements TransportProcs { Assert.fail(); break; } - DbgUtils.logi( TAG, "transportSend(): sent %d via %s", + Log.i( TAG, "transportSend(): sent %d via %s", nSent, typ.toString() ); if ( 0 < nSent ) { - DbgUtils.logd( TAG, "transportSend: adding %s", msgNo ); + Log.d( TAG, "transportSend: adding %s", msgNo ); m_sentSet.add( msgNo ); } @@ -139,7 +139,7 @@ public class MultiMsgSink implements TransportProcs { relayID, buf ); boolean success = buf.length == nSent; if ( success ) { - DbgUtils.logd( TAG, "relayNoConnProc: adding %s", msgNo ); + Log.d( TAG, "relayNoConnProc: adding %s", msgNo ); m_sentSet.add( msgNo ); } return success; 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 9d5f7a3f9..40a0b1256 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 @@ -194,7 +194,7 @@ public class MultiService { if ( downloaded ) { int ordinal = intent.getIntExtra( OWNER, -1 ); if ( -1 == ordinal ) { - DbgUtils.logw( TAG, "unexpected OWNER" ); + Log.w( TAG, "unexpected OWNER" ); } else { DictFetchOwner owner = DictFetchOwner.values()[ordinal]; switch ( owner ) { 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 dcbbb0bd9..8ca8ccf79 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 @@ -178,7 +178,7 @@ public class NagTurnReceiver extends BroadcastReceiver { al.add(value); } } catch ( Exception ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } if ( 0 < al.size() ) { 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 4a91c0d91..8d33b5f0d 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 @@ -207,7 +207,7 @@ public class NetLaunchInfo { } calcValid(); } catch ( Exception e ) { - DbgUtils.loge( TAG, "unable to parse \"%s\"", data.toString() ); + Log.e( TAG, "unable to parse \"%s\"", data.toString() ); } } calcValid(); @@ -289,7 +289,7 @@ public class NetLaunchInfo { int result = gameID; if ( 0 == result ) { Assert.assertNotNull( inviteID ); - DbgUtils.logi( TAG, "gameID(): looking at inviteID: %s", inviteID ); + Log.i( TAG, "gameID(): looking at inviteID: %s", inviteID ); result = Integer.parseInt( inviteID, 16 ); // DbgUtils.logf( "gameID(): gameID -1 so substituting %d", result ); gameID = result; @@ -351,7 +351,7 @@ public class NetLaunchInfo { result = obj.toString(); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } // DbgUtils.logf( "makeLaunchJSON() => %s", result ); return result; @@ -442,7 +442,7 @@ public class NetLaunchInfo { } } catch ( JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } removeUnsupported( supported ); @@ -495,7 +495,7 @@ public class NetLaunchInfo { Uri result = ub.build(); if ( BuildConfig.DEBUG ) { // Test... - DbgUtils.logi( TAG, "testing %s...", result.toString() ); + Log.i( TAG, "testing %s...", result.toString() ); NetLaunchInfo instance = new NetLaunchInfo( context, result ); Assert.assertTrue( instance.isValid() ); } @@ -518,7 +518,7 @@ public class NetLaunchInfo { btAddress = got[1]; m_addrs.add( CommsConnType.COMMS_CONN_BT ); } else { - DbgUtils.logw( TAG, "addBTInfo(): no BT info available" ); + Log.w( TAG, "addBTInfo(): no BT info available" ); } } 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 02000cf75..f52361c70 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 @@ -84,7 +84,7 @@ public class NetStateCache { boolean netAvail = getIsConnected( context ); if ( netAvail ) { - DbgUtils.logi( TAG, "netAvail(): second-guessing successful!!!" ); + Log.i( TAG, "netAvail(): second-guessing successful!!!" ); s_netAvail = true; if ( null != s_receiver ) { s_receiver.notifyStateChanged( context ); @@ -94,7 +94,7 @@ public class NetStateCache { } boolean result = s_netAvail || s_onSDKSim; - DbgUtils.logd( TAG, "netAvail() => %b", result ); + Log.d( TAG, "netAvail() => %b", result ); return result; } @@ -124,7 +124,7 @@ public class NetStateCache { if ( null != ni && ni.isConnectedOrConnecting() ) { result = true; } - DbgUtils.logi( TAG, "NetStateCache.getConnected() => %b", result ); + Log.i( TAG, "NetStateCache.getConnected() => %b", result ); return result; } @@ -165,8 +165,8 @@ public class NetStateCache { boolean connectedReal = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); if ( connectedReal != connectedCached ) { - DbgUtils.logw( TAG, "connected: cached: %b; actual: %b", - connectedCached, connectedReal ); + Log.w( TAG, "connected: cached: %b; actual: %b", + connectedCached, connectedReal ); } } } @@ -194,7 +194,7 @@ public class NetStateCache { NetworkInfo ni = (NetworkInfo)intent. getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); NetworkInfo.State state = ni.getState(); - DbgUtils.logd( TAG, "onReceive(state=%s)", state.toString() ); + Log.d( TAG, "onReceive(state=%s)", state.toString() ); boolean netAvail; switch ( state ) { @@ -215,8 +215,8 @@ public class NetStateCache { s_netAvail = netAvail; // keep current in case we're asked notifyStateChanged( context ); } else { - DbgUtils.logd( TAG, "onReceive: no change; " - + "doing nothing; s_netAvail=%b", s_netAvail ); + Log.d( TAG, "onReceive: no change; doing nothing;" + + " s_netAvail=%b", s_netAvail ); } } } @@ -240,8 +240,7 @@ public class NetStateCache { Assert.assertTrue( mLastStateSent != s_netAvail ); mLastStateSent = s_netAvail; - DbgUtils.logi( TAG, "notifyStateChanged(%b)", - s_netAvail ); + Log.i( TAG, "notifyStateChanged(%b)", s_netAvail ); synchronized( s_ifs ) { Iterator iter = s_ifs.iterator(); 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 dba2c1519..70e59bb71 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 @@ -72,9 +72,9 @@ public class NetUtils { socket.setSoTimeout( timeoutMillis ); } catch ( java.net.UnknownHostException uhe ) { - DbgUtils.logex( TAG, uhe ); + Log.ex( TAG, uhe ); } catch( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } return socket; } @@ -129,7 +129,7 @@ public class NetUtils { DBUtils.clearObits( m_context, m_obits ); } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } } @@ -193,13 +193,13 @@ public class NetUtils { } if ( 0 != dis.available() ) { msgs = null; - DbgUtils.loge( TAG, "format error: bytes left over in stream" ); + Log.e( TAG, "format error: bytes left over in stream" ); } socket.close(); } } catch( Exception npe ) { - DbgUtils.logex( TAG, npe ); + Log.ex( TAG, npe ); } return msgs; } // queryRelay @@ -225,10 +225,10 @@ public class NetUtils { result = (HttpURLConnection)new URL(url).openConnection(); } catch ( java.net.MalformedURLException mue ) { Assert.assertNull( result ); - DbgUtils.logex( TAG, mue ); + Log.ex( TAG, mue ); } catch ( java.io.IOException ioe ) { Assert.assertNull( result ); - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } return result; } @@ -273,12 +273,12 @@ public class NetUtils { } result = new String( bas.toByteArray() ); } else { - DbgUtils.logw( TAG, "runConn: responseCode: %d", responseCode ); + Log.w( TAG, "runConn: responseCode: %d", responseCode ); } } catch ( java.net.ProtocolException pe ) { - DbgUtils.logex( TAG, pe ); + Log.ex( TAG, pe ); } catch( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -299,7 +299,7 @@ public class NetUtils { } result = TextUtils.join( "&", pairs ); } catch ( java.io.UnsupportedEncodingException uee ) { - DbgUtils.logex( TAG, uee ); + Log.ex( TAG, uee ); } return result; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OnBootReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OnBootReceiver.java index bbfc71a66..1e3594c69 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OnBootReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OnBootReceiver.java @@ -32,7 +32,7 @@ public class OnBootReceiver extends BroadcastReceiver { { if ( null != intent && null != intent.getAction() && intent.getAction().equals( Intent.ACTION_BOOT_COMPLETED ) ) { - DbgUtils.logd( TAG, "got ACTION_BOOT_COMPLETED" ); + Log.d( TAG, "got ACTION_BOOT_COMPLETED" ); startTimers( context ); } } 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 0ff48c311..0bfe53cb2 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 @@ -102,7 +102,7 @@ public class Perms23 { public void asyncQuery( Activity activity, PermCbck cbck ) { - DbgUtils.logd( TAG, "asyncQuery(%s)", m_perms.toString() ); + Log.d( TAG, "asyncQuery(%s)", m_perms.toString() ); boolean haveAll = true; boolean shouldShow = false; Set needShow = new HashSet(); @@ -135,12 +135,12 @@ public class Perms23 { cbck.onPermissionResult( map ); } } else if ( 0 < needShow.size() && null != m_onShow ) { - // DbgUtils.logd( TAG, "calling onShouldShowRationale()" ); + // Log.d( TAG, "calling onShouldShowRationale()" ); m_onShow.onShouldShowRationale( needShow ); } else { String[] permsArray = askStrings.toArray( new String[askStrings.size()] ); int code = register( cbck ); - // DbgUtils.logd( TAG, "calling requestPermissions on %s", + // Log.d( TAG, "calling requestPermissions on %s", // activity.getClass().getSimpleName() ); ActivityCompat.requestPermissions( activity, permsArray, code ); } @@ -227,7 +227,7 @@ public class Perms23 { final Action action, final DlgClickNotify cbck, Object... params ) { - // DbgUtils.logd( TAG, "tryGetPerms(%s)", perm.toString() ); + // Log.d( TAG, "tryGetPerms(%s)", perm.toString() ); Context context = XWApp.getContext(); String msg = LocUtils.getString( context, rationaleId ); tryGetPerms( delegate, perm, msg, action, cbck, params ); @@ -237,14 +237,14 @@ public class Perms23 { String rationaleMsg, final Action action, final DlgClickNotify cbck, Object... params ) { - // DbgUtils.logd( TAG, "tryGetPerms(%s)", perm.toString() ); + // Log.d( TAG, "tryGetPerms(%s)", perm.toString() ); new QueryInfo( delegate, action, perm, rationaleMsg, cbck, params ) .doIt( true ); } public static void onGotPermsAction( boolean positive, Object[] params ) { - // DbgUtils.logd( TAG, "onGotPermsAction(button=%d)", button ); + // Log.d( TAG, "onGotPermsAction(button=%d)", button ); QueryInfo info = (QueryInfo)params[0]; info.handleButton( positive ); } @@ -253,7 +253,7 @@ public class Perms23 { public static void gotPermissionResult( Context context, int code, String[] perms, int[] granteds ) { - // DbgUtils.logd( TAG, "gotPermissionResult(%s)", perms.toString() ); + // Log.d( TAG, "gotPermissionResult(%s)", perms.toString() ); Map result = new HashMap(); for ( int ii = 0; ii < perms.length; ++ii ) { Perm perm = Perm.getFor( perms[ii] ); @@ -268,7 +268,7 @@ public class Perms23 { true ); } - // DbgUtils.logd( TAG, "calling %s.onPermissionResult(%s, %b)", + // Log.d( TAG, "calling %s.onPermissionResult(%s, %b)", // record.cbck.getClass().getSimpleName(), perm.toString(), // granted ); } 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 045343475..a8b0eea5a 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 @@ -361,7 +361,7 @@ public class PrefsDelegate extends DelegateBase } catch ( NullPointerException ex ) { // This is happening hiding key_enable_sms, but the hide still // works! - // DbgUtils.logex( TAG, ex ); + // Log.ex( TAG, ex ); } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RefreshNamesTask.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RefreshNamesTask.java index 6e43110ce..eb07c981f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RefreshNamesTask.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RefreshNamesTask.java @@ -69,7 +69,7 @@ public class RefreshNamesTask extends AsyncTask { protected String[] doInBackground( Void...unused ) { ArrayList names = new ArrayList(); - DbgUtils.logi( TAG, "doInBackground()" ); + Log.i( TAG, "doInBackground()" ); try { Socket socket = NetUtils.makeProxySocket( m_context, 15000 ); @@ -89,7 +89,7 @@ public class RefreshNamesTask extends AsyncTask { new DataInputStream(socket.getInputStream()); short len = dis.readShort(); short nRooms = dis.readShort(); - DbgUtils.logi( TAG, "doInBackground(): got %d rooms", nRooms ); + Log.i( TAG, "doInBackground(): got %d rooms", nRooms ); // Can't figure out how to read a null-terminated string // from DataInputStream so parse it myself. @@ -103,16 +103,16 @@ public class RefreshNamesTask extends AsyncTask { ++index; } String name = new String( bytes, lastIndex, index - lastIndex ); - DbgUtils.logi( TAG, "got public room name: %s", name ); + Log.i( TAG, "got public room name: %s", name ); int indx = name.lastIndexOf( "/" ); indx = name.lastIndexOf( "/", indx-1 ); names.add( name.substring(0, indx ) ); } } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } - DbgUtils.logi( TAG, "doInBackground() returning" ); + Log.i( TAG, "doInBackground() returning" ); return names.toArray( new String[names.size()] ); } @@ -123,7 +123,7 @@ public class RefreshNamesTask extends AsyncTask { @Override protected void onPostExecute( String[] result ) { - DbgUtils.logi( TAG, "onPostExecute()" ); + Log.i( TAG, "onPostExecute()" ); ArrayAdapter adapter = new ArrayAdapter( m_context, android.R.layout.simple_spinner_item, @@ -138,6 +138,6 @@ public class RefreshNamesTask extends AsyncTask { m_nnf.NoNameFound(); } - DbgUtils.logi( TAG, "onPostExecute() done" ); + Log.i( TAG, "onPostExecute() done" ); } } 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 8e27a2393..1393e2c14 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 @@ -555,12 +555,12 @@ public class RelayInviteDelegate extends InviteDelegate { JSONObject params = new JSONObject(); params.put( "relayIDs", ids ); params.put( "me", DevID.getRelayDevIDInt( m_activity ) ); - DbgUtils.logi( TAG, "sending to server: %s", params.toString() ); + Log.i( TAG, "sending to server: %s", params.toString() ); HttpURLConnection conn = NetUtils.makeHttpConn( m_context, "opponentIDsFor" ); if ( null != conn ) { String str = NetUtils.runConn( conn, params ); - DbgUtils.logi( TAG, "got json from server: %s", str ); + Log.i( TAG, "got json from server: %s", str ); reply = new JSONObject( str ); } @@ -584,7 +584,7 @@ public class RelayInviteDelegate extends InviteDelegate { } } catch ( org.json.JSONException je ) { - DbgUtils.logex( TAG, je ); + Log.ex( TAG, je ); } stopProgress(); @@ -594,7 +594,7 @@ public class RelayInviteDelegate extends InviteDelegate { @Override protected void onPostExecute( Set devIDs ) { if ( null == devIDs ) { - DbgUtils.logw( TAG, "onPostExecute: no results from server?" ); + Log.w( TAG, "onPostExecute: no results from server?" ); } else { m_devIDRecs = new ArrayList(devIDs.size()); Iterator iter = devIDs.iterator(); 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 8b87e3855..a0e6bd014 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 @@ -143,8 +143,8 @@ public class RelayService extends XWService public static void gcmConfirmed( Context context, boolean confirmed ) { if ( s_gcmWorking != confirmed ) { - DbgUtils.logi( TAG, "gcmConfirmed(): changing " - + "s_gcmWorking to %b", confirmed ); + Log.i( TAG, "gcmConfirmed(): changing s_gcmWorking to %b", + confirmed ); s_gcmWorking = confirmed; } @@ -160,7 +160,7 @@ public class RelayService extends XWService { boolean enabled = ! XWPrefs .getPrefsBoolean( context, R.string.key_disable_relay, false ); - DbgUtils.logd( TAG, "relayEnabled() => %b", enabled ); + Log.d( TAG, "relayEnabled() => %b", enabled ); return enabled; } @@ -180,7 +180,7 @@ public class RelayService extends XWService public static void startService( Context context ) { - DbgUtils.logi( TAG, "startService()" ); + Log.i( TAG, "startService()" ); Intent intent = getIntentTo( context, MsgCmds.UDP_CHANGED ); context.startService( intent ); } @@ -218,7 +218,7 @@ public class RelayService extends XWService public static int sendPacket( Context context, long rowid, byte[] msg ) { - DbgUtils.logd( TAG, "sendPacket(len=%d)", msg.length ); + Log.d( TAG, "sendPacket(len=%d)", msg.length ); int result = -1; if ( NetStateCache.netAvail( context ) ) { Intent intent = getIntentTo( context, MsgCmds.SEND ) @@ -227,7 +227,7 @@ public class RelayService extends XWService context.startService( intent ); result = msg.length; } else { - DbgUtils.logw( TAG, "sendPacket: network down" ); + Log.w( TAG, "sendPacket: network down" ); } return result; } @@ -254,8 +254,8 @@ public class RelayService extends XWService private void receiveInvitation( int srcDevID, NetLaunchInfo nli ) { - DbgUtils.logd( TAG, "receiveInvitation: got nli from %d: %s", srcDevID, - nli.toString() ); + Log.d( TAG, "receiveInvitation: got nli from %d: %s", srcDevID, + nli.toString() ); if ( checkNotDupe( nli ) ) { makeOrNotify( nli ); } @@ -306,16 +306,16 @@ public class RelayService extends XWService // Exists to get incoming data onto the main thread private static void postData( Context context, long rowid, byte[] msg ) { - DbgUtils.logd( TAG, "postData(): packet of " - + "length %d for token %d", msg.length, rowid ); + Log.d( TAG, "postData(): packet of length %d for token %d", + msg.length, rowid ); if ( DBUtils.haveGame( context, rowid ) ) { Intent intent = getIntentTo( context, MsgCmds.RECEIVE ) .putExtra( ROWID, rowid ) .putExtra( BINBUFFER, msg ); context.startService( intent ); } else { - DbgUtils.logw( TAG, "postData(): Dropping message for " - + "rowid %d: not on device", rowid ); + Log.w( TAG, "postData(): Dropping message for rowid %d:" + + " not on device", rowid ); } } @@ -364,7 +364,7 @@ public class RelayService extends XWService m_handler = new Handler(); m_onInactivity = new Runnable() { public void run() { - DbgUtils.logd( TAG, "m_onInactivity fired" ); + Log.d( TAG, "m_onInactivity fired" ); if ( !shouldMaintainConnection() ) { NetStateCache.unregister( RelayService.this, RelayService.this ); @@ -388,8 +388,7 @@ public class RelayService extends XWService cmd = null; } if ( null != cmd ) { - DbgUtils.logd( TAG, "onStartCommand(): cmd=%s", - cmd.toString() ); + Log.d( TAG, "onStartCommand(): cmd=%s", cmd.toString() ); switch( cmd ) { case PROCESS_GAME_MSGS: String[] relayIDs = new String[1]; @@ -449,7 +448,7 @@ public class RelayService extends XWService break; case TIMER_FIRED: if ( !NetStateCache.netAvail( this ) ) { - DbgUtils.logw( TAG, "not connecting: no network" ); + Log.w( TAG, "not connecting: no network" ); } else if ( startFetchThreadIf() ) { // do nothing } else if ( registerWithRelayIfNot() ) { @@ -531,11 +530,11 @@ public class RelayService extends XWService private void stopFetchThreadIf() { while ( null != m_fetchThread ) { - DbgUtils.logw( TAG, "2: m_fetchThread NOT NULL; WHAT TO DO???" ); + Log.w( TAG, "2: m_fetchThread NOT NULL; WHAT TO DO???" ); try { Thread.sleep( 20 ); } catch( java.lang.InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); } } } @@ -550,7 +549,7 @@ public class RelayService extends XWService connectSocket(); // block until this is done startWriteThread(); - DbgUtils.logi( TAG, "read thread running" ); + Log.i( TAG, "read thread running" ); byte[] buf = new byte[1024]; for ( ; ; ) { DatagramPacket packet = @@ -565,16 +564,15 @@ public class RelayService extends XWService break; } } - DbgUtils.logi( TAG, "read thread exiting" ); + Log.i( TAG, "read thread exiting" ); } }, getClass().getName() ); m_UDPReadThread.start(); } else { - DbgUtils.logi( TAG, "m_UDPReadThread not null and assumed to " - + "be running" ); + Log.i( TAG, "m_UDPReadThread not null and assumed to be running" ); } } else { - DbgUtils.logi( TAG, "startUDPThreadsIfNot(): UDP disabled" ); + Log.i( TAG, "startUDPThreadsIfNot(): UDP disabled" ); } } // startUDPThreadsIfNot @@ -589,17 +587,17 @@ public class RelayService extends XWService InetAddress addr = InetAddress.getByName( host ); m_UDPSocket.connect( addr, port ); // remember this address - DbgUtils.logd( TAG, "connectSocket(%s:%d): m_UDPSocket" - + " now %H", host, port, m_UDPSocket ); + Log.d( TAG, "connectSocket(%s:%d): m_UDPSocket now %H", + host, port, m_UDPSocket ); } catch( java.net.SocketException se ) { - DbgUtils.logex( TAG, se ); + Log.ex( TAG, se ); Assert.fail(); } catch( java.net.UnknownHostException uhe ) { - DbgUtils.logex( TAG, uhe ); + Log.ex( TAG, uhe ); } } else { Assert.assertTrue( m_UDPSocket.isConnected() ); - DbgUtils.logi( TAG, "m_UDPSocket not null" ); + Log.i( TAG, "m_UDPSocket not null" ); } } @@ -608,18 +606,18 @@ public class RelayService extends XWService if ( null == m_UDPWriteThread ) { m_UDPWriteThread = new Thread( null, new Runnable() { public void run() { - DbgUtils.logi( TAG, "write thread starting" ); + Log.i( TAG, "write thread starting" ); for ( ; ; ) { PacketData outData; try { outData = m_queue.take(); } catch ( InterruptedException ie ) { - DbgUtils.logw( TAG, "write thread killed" ); + Log.w( TAG, "write thread killed" ); break; } if ( null == outData || 0 == outData.getLength() ) { - DbgUtils.logi( TAG, "stopping write thread" ); + Log.i( TAG, "stopping write thread" ); break; } @@ -627,37 +625,37 @@ public class RelayService extends XWService DatagramPacket outPacket = outData.assemble(); m_UDPSocket.send( outPacket ); int pid = outData.m_packetID; - DbgUtils.logd( TAG, "Sent udp packet, cmd=%s, id=%d," - + " of length %d", - outData.m_cmd.toString(), - pid, outPacket.getLength()); + Log.d( TAG, "Sent udp packet, cmd=%s, id=%d," + + " of length %d", + outData.m_cmd.toString(), + pid, outPacket.getLength()); synchronized( s_packetsSent ) { s_packetsSent.add( pid ); } resetExitTimer(); ConnStatusHandler.showSuccessOut(); } catch ( java.net.SocketException se ) { - DbgUtils.logex( TAG, se ); - DbgUtils.logi( TAG, "Restarting threads to force" - + " new socket" ); + Log.ex( TAG, se ); + Log.i( TAG, "Restarting threads to force" + + " new socket" ); m_handler.post( new Runnable() { public void run() { stopUDPThreadsIf(); } } ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } catch ( NullPointerException npe ) { - DbgUtils.logw( TAG, "network problem; dropping packet" ); + Log.w( TAG, "network problem; dropping packet" ); } } - DbgUtils.logi( TAG, "write thread exiting" ); + Log.i( TAG, "write thread exiting" ); } }, getClass().getName() ); m_UDPWriteThread.start(); } else { - DbgUtils.logi( TAG, "m_UDPWriteThread not null and assumed to " - + "be running" ); + Log.i( TAG, "m_UDPWriteThread not null and assumed to " + + "be running" ); } } @@ -667,11 +665,11 @@ public class RelayService extends XWService // can't add null m_queue.add( new PacketData() ); try { - DbgUtils.logd( TAG, "joining m_UDPWriteThread" ); + Log.d( TAG, "joining m_UDPWriteThread" ); m_UDPWriteThread.join(); - DbgUtils.logd( TAG, "SUCCESSFULLY joined m_UDPWriteThread" ); + Log.d( TAG, "SUCCESSFULLY joined m_UDPWriteThread" ); } catch( java.lang.InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); } m_UDPWriteThread = null; m_queue.clear(); @@ -681,7 +679,7 @@ public class RelayService extends XWService try { m_UDPReadThread.join(); } catch( java.lang.InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); } m_UDPReadThread = null; m_UDPSocket = null; @@ -700,12 +698,12 @@ public class RelayService extends XWService if ( !skipAck ) { sendAckIf( header ); } - DbgUtils.logd( TAG, "gotPacket(): cmd=%s", header.m_cmd.toString() ); + Log.d( TAG, "gotPacket(): cmd=%s", header.m_cmd.toString() ); switch ( header.m_cmd ) { case XWPDEV_UNAVAIL: int unavail = dis.readInt(); - DbgUtils.logi( TAG, "relay unvailable for another %d seconds", - unavail ); + Log.i( TAG, "relay unvailable for another %d seconds", + unavail ); String str = getVLIString( dis ); postEvent( MultiEvent.RELAY_ALERT, str ); break; @@ -718,7 +716,7 @@ public class RelayService extends XWService break; case XWPDEV_BADREG: str = getVLIString( dis ); - DbgUtils.logi( TAG, "bad relayID \"%s\" reported", str ); + Log.i( TAG, "bad relayID \"%s\" reported", str ); DevID.clearRelayDevID( this ); s_registered = false; registerWithRelay(); @@ -726,9 +724,8 @@ public class RelayService extends XWService case XWPDEV_REGRSP: str = getVLIString( dis ); short maxIntervalSeconds = dis.readShort(); - DbgUtils.logd( TAG, "got relayid %s (%d), maxInterval %d", str, - Integer.parseInt( str, 16 ), - maxIntervalSeconds ); + Log.d( TAG, "got relayid %s (%d), maxInterval %d", str, + Integer.parseInt( str, 16 ), maxIntervalSeconds ); setMaxIntervalSeconds( maxIntervalSeconds ); DevID.setRelayDevID( this, str ); s_registered = true; @@ -765,7 +762,7 @@ public class RelayService extends XWService NetLaunchInfo nli = XwJNI.nliFromStream( nliData ); intent.putExtra( INVITE_FROM, srcDevID ); String asStr = nli.toString(); - DbgUtils.logd( TAG, "got invitation: %s", asStr ); + Log.d( TAG, "got invitation: %s", asStr ); intent.putExtra( NLI_DATA, asStr ); startService( intent ); break; @@ -778,12 +775,12 @@ public class RelayService extends XWService // DbgUtils.logf( "RelayService: got invite: %s", nliData ); // break; default: - DbgUtils.logw( TAG, "gotPacket(): Unhandled cmd" ); + Log.w( TAG, "gotPacket(): Unhandled cmd" ); break; } } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } if ( resetBackoff ) { @@ -810,7 +807,7 @@ public class RelayService extends XWService boolean registered = null != relayID; should = !registered; } - DbgUtils.logd( TAG, "shouldRegister()=>%b", should ); + Log.d( TAG, "shouldRegister()=>%b", should ); return should; } @@ -827,8 +824,8 @@ public class RelayService extends XWService long now = Utils.getCurSeconds(); long interval = now - s_regStartTime; if ( interval < REG_WAIT_INTERVAL ) { - DbgUtils.logi( TAG, "registerWithRelay: skipping because only %d " - + "seconds since last start", interval ); + Log.i( TAG, "registerWithRelay: skipping because only %d " + + "seconds since last start", interval ); } else { String relayID = DevID.getRelayDevID( this ); DevIDType[] typa = new DevIDType[1]; @@ -848,8 +845,8 @@ public class RelayService extends XWService writeVLIString( out, devid ); } - DbgUtils.logd( TAG, "registering devID \"%s\" (type=%s)", devid, - typ.toString() ); + Log.d( TAG, "registering devID \"%s\" (type=%s)", devid, + typ.toString() ); out.writeShort( BuildConfig.CLIENT_VERS_RELAY ); writeVLIString( out, BuildConfig.GIT_REV ); @@ -860,7 +857,7 @@ public class RelayService extends XWService postPacket( bas, XWRelayReg.XWPDEV_REG ); s_regStartTime = now; } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } } @@ -884,7 +881,7 @@ public class RelayService extends XWService postPacket( bas, reg ); } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -908,7 +905,7 @@ public class RelayService extends XWService out.write( msg, 0, msg.length ); postPacket( bas, XWRelayReg.XWPDEV_MSG ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -924,22 +921,22 @@ public class RelayService extends XWService out.write( msg, 0, msg.length ); postPacket( bas, XWRelayReg.XWPDEV_MSGNOCONN ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } private void sendInvitation( int srcDevID, int destDevID, String relayID, String nliStr ) { - DbgUtils.logd( TAG, "sendInvitation(%d->%d/%s [%s])", srcDevID, destDevID, - relayID, nliStr ); + Log.d( TAG, "sendInvitation(%d->%d/%s [%s])", srcDevID, destDevID, + relayID, nliStr ); NetLaunchInfo nli = new NetLaunchInfo( this, nliStr ); byte[] nliData = XwJNI.nliToStream( nli ); if ( BuildConfig.DEBUG ) { NetLaunchInfo tmp = XwJNI.nliFromStream( nliData ); - DbgUtils.logd( TAG, "sendInvitation: compare these: %s vs %s", - nli.toString(), tmp.toString() ); + Log.d( TAG, "sendInvitation: compare these: %s vs %s", + nli.toString(), tmp.toString() ); } ByteArrayOutputStream bas = new ByteArrayOutputStream(); @@ -958,7 +955,7 @@ public class RelayService extends XWService out.write( nliData, 0, nliData.length ); postPacket( bas, XWRelayReg.XWPDEV_INVITE ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -971,7 +968,7 @@ public class RelayService extends XWService un2vli( header.m_packetID, out ); postPacket( bas, XWRelayReg.XWPDEV_ACK ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } } @@ -984,13 +981,13 @@ public class RelayService extends XWService if ( XWPDevProto.XWPDEV_PROTO_VERSION_1.ordinal() == proto ) { int packetID = vli2un( dis ); if ( 0 != packetID ) { - DbgUtils.logd( TAG, "readHeader(): got packetID %d", packetID ); + Log.d( TAG, "readHeader(): got packetID %d", packetID ); } byte ordinal = dis.readByte(); XWRelayReg cmd = XWRelayReg.values()[ordinal]; result = new PacketHeader( cmd, packetID ); } else { - DbgUtils.logw( TAG, "bad proto: %d", proto ); + Log.w( TAG, "bad proto: %d", proto ); } return result; } @@ -1115,7 +1112,7 @@ public class RelayService extends XWService if ( msgLen + thisLen > MAX_BUF ) { // Need to deal with this case by sending multiple // packets. It WILL happen. - DbgUtils.logw( TAG, "dropping send for lack of space; FIX ME!!" ); + Log.w( TAG, "dropping send for lack of space; FIX ME!!" ); Assert.fail(); break; } @@ -1145,7 +1142,7 @@ public class RelayService extends XWService socket.close(); } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } return null; } // doInBackground @@ -1157,7 +1154,7 @@ public class RelayService extends XWService if ( null != msgHash ) { new AsyncSender( context, msgHash ).execute(); } else { - DbgUtils.logw( TAG, "sendToRelay: null msgs" ); + Log.w( TAG, "sendToRelay: null msgs" ); } } // sendToRelay @@ -1221,11 +1218,10 @@ public class RelayService extends XWService if ( s_packetsSent.contains( packetID ) ) { s_packetsSent.remove( packetID ); } else { - DbgUtils.logw( TAG, "Weird: got ack %d but never sent", packetID ); + Log.w( TAG, "Weird: got ack %d but never sent", packetID ); } - DbgUtils.logd( TAG, "noteAck(): Got ack for %d; " - + "there are %d unacked packets", - packetID, s_packetsSent.size() ); + Log.d( TAG, "noteAck(): Got ack for %d; there are %d unacked packets", + packetID, s_packetsSent.size() ); } } @@ -1242,7 +1238,7 @@ public class RelayService extends XWService private void startThreads() { - DbgUtils.logd( TAG, "startThreads()" ); + Log.d( TAG, "startThreads()" ); if ( !relayEnabled( this ) || !NetStateCache.netAvail( this ) ) { stopThreads(); } else if ( XWApp.UDP_ENABLED ) { @@ -1257,7 +1253,7 @@ public class RelayService extends XWService private void stopThreads() { - DbgUtils.logd( TAG, "stopThreads()" ); + Log.d( TAG, "stopThreads()" ); stopFetchThreadIf(); stopUDPThreadsIf(); } @@ -1288,7 +1284,7 @@ public class RelayService extends XWService for ( int count = 0; !done; ++count ) { nRead = is.read( buf ); if ( 1 != nRead ) { - DbgUtils.logw( TAG, "vli2un: unable to read from stream" ); + Log.w( TAG, "vli2un: unable to read from stream" ); break; } int byt = buf[0]; @@ -1316,7 +1312,7 @@ public class RelayService extends XWService private void setMaxIntervalSeconds( int maxIntervalSeconds ) { - DbgUtils.logd( TAG, "IGNORED: setMaxIntervalSeconds(%d); " + Log.d( TAG, "IGNORED: setMaxIntervalSeconds(%d); " + "using -1 instead", maxIntervalSeconds ); maxIntervalSeconds = -1; if ( m_maxIntervalSeconds != maxIntervalSeconds ) { @@ -1338,7 +1334,7 @@ public class RelayService extends XWService result = figureBackoffSeconds(); } - DbgUtils.logd( TAG, "getMaxIntervalSeconds() => %d", result ); + Log.d( TAG, "getMaxIntervalSeconds() => %d", result ); return result; } @@ -1379,7 +1375,7 @@ public class RelayService extends XWService long interval = Utils.getCurSeconds() - m_lastGamePacketReceived; result = interval < MAX_KEEPALIVE_SECS; } - DbgUtils.logd( TAG, "shouldMaintainConnection=>%b", result ); + Log.d( TAG, "shouldMaintainConnection=>%b", result ); return result; } @@ -1409,7 +1405,7 @@ public class RelayService extends XWService diff = s_curNextTimer - now; } Assert.assertTrue( diff < Integer.MAX_VALUE ); - DbgUtils.logd( TAG, "figureBackoffSeconds() => %d", diff ); + Log.d( TAG, "figureBackoffSeconds() => %d", diff ); result = (int)diff; } return result; @@ -1460,14 +1456,14 @@ public class RelayService extends XWService try { m_packetID = nextPacketID( m_cmd ); DataOutputStream out = new DataOutputStream( bas ); - DbgUtils.logd( TAG, "makeHeader(): building packet with cmd %s", - m_cmd.toString() ); + Log.d( TAG, "makeHeader(): building packet with cmd %s", + m_cmd.toString() ); out.writeByte( XWPDevProto.XWPDEV_PROTO_VERSION_1.ordinal() ); un2vli( m_packetID, out ); out.writeByte( m_cmd.ordinal() ); m_header = bas.toByteArray(); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } 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 6b3d4dabd..3539800dc 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 @@ -313,7 +313,7 @@ public class SMSInviteDelegate extends InviteDelegate { try { phones.put( rec.m_phone, rec.m_name ); } catch ( JSONException ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } XWPrefs.setSMSPhones( m_activity, phones ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSReceiver.java index 55d478481..a754892cb 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSReceiver.java @@ -48,7 +48,7 @@ public class SMSReceiver extends BroadcastReceiver { byte[] body = sms.getUserData(); SMSService.handleFrom( context, body, phone ); } catch ( NullPointerException npe ) { - DbgUtils.logex( TAG, npe ); + Log.ex( TAG, npe ); } } } 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 5804c3a3a..480ee0f63 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 @@ -166,7 +166,7 @@ public class SMSService extends XWService { s_phoneInfo = new SMSPhoneInfo( isPhone, number, isGSM ); } catch ( SecurityException se ) { - DbgUtils.loge( TAG, "got SecurityException" ); + Log.e( TAG, "got SecurityException" ); } } return s_phoneInfo; @@ -204,7 +204,7 @@ public class SMSService extends XWService { Intent intent = getIntentTo( context, SMSAction.INVITE ); intent.putExtra( PHONE, phone ); String asString = nli.toString(); - DbgUtils.logw( TAG, "inviteRemote(%s, '%s')", phone, asString ); + Log.w( TAG, "inviteRemote(%s, '%s')", phone, asString ); intent.putExtra( GAMEDATA_STR, asString ); context.startService( intent ); } @@ -221,7 +221,7 @@ public class SMSService extends XWService { context.startService( intent ); nSent = binmsg.length; } else { - DbgUtils.logi( TAG, "sendPacket: dropping because SMS disabled" ); + Log.i( TAG, "sendPacket: dropping because SMS disabled" ); } return nSent; } @@ -258,7 +258,7 @@ public class SMSService extends XWService { if ( hashRead == hashCode ) { result = tmp; } else { - DbgUtils.logw( TAG, "fromPublicFmt: hash code mismatch" ); + Log.w( TAG, "fromPublicFmt: hash code mismatch" ); } } catch( Exception e ) { } @@ -382,7 +382,7 @@ public class SMSService extends XWService { private void inviteRemote( String phone, String nliData ) { - DbgUtils.logi( TAG, "inviteRemote()" ); + Log.i( TAG, "inviteRemote()" ); ByteArrayOutputStream bas = new ByteArrayOutputStream( 128 ); DataOutputStream dos = new DataOutputStream( bas ); try { @@ -391,7 +391,7 @@ public class SMSService extends XWService { send( SMS_CMD.INVITE, bas.toByteArray(), phone ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -405,7 +405,7 @@ public class SMSService extends XWService { send( SMS_CMD.ACK, bas.toByteArray(), phone ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -420,7 +420,7 @@ public class SMSService extends XWService { send( SMS_CMD.DEATH, bas.toByteArray(), phone ); s_sentDied.add( gameID ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } } @@ -438,7 +438,7 @@ public class SMSService extends XWService { nSent = bytes.length; } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } return nSent; } @@ -489,15 +489,15 @@ public class SMSService extends XWService { start = end; } } else { - DbgUtils.logw( TAG, "breakAndEncode(): msg count %d too large; dropping", - count ); + Log.w( TAG, "breakAndEncode(): msg count %d too large; dropping", + count ); } return result; } private void receive( SMS_CMD cmd, byte[] data, String phone ) { - DbgUtils.logi( TAG, "receive(cmd=%s)", cmd.toString() ); + Log.i( TAG, "receive(cmd=%s)", cmd.toString() ); DataInputStream dis = new DataInputStream( new ByteArrayInputStream(data) ); try { @@ -516,7 +516,7 @@ public class SMSService extends XWService { nli.gameID() ); } } else { - DbgUtils.logw( TAG, "invalid nli from: %s", nliData ); + Log.w( TAG, "invalid nli from: %s", nliData ); } break; case DATA: @@ -535,11 +535,11 @@ public class SMSService extends XWService { gameID ); break; default: - DbgUtils.logw( TAG, "unexpected cmd %s", cmd.toString() ); + Log.w( TAG, "unexpected cmd %s", cmd.toString() ); break; } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } } @@ -555,8 +555,8 @@ public class SMSService extends XWService { postEvent( MultiEvent.SMS_RECEIVE_OK ); } else { // Will see this when don't have SMS permission - DbgUtils.logw( TAG, "receiveBuffer(): bogus message from" - + " phone %s", senderPhone ); + Log.w( TAG, "receiveBuffer(): bogus message from phone %s", + senderPhone ); } } @@ -607,12 +607,12 @@ public class SMSService extends XWService { gotPort = dis.readShort(); } if ( SMS_PROTO_VERSION < proto ) { - DbgUtils.logw( TAG, "SMSService.disAssemble: bad proto %d from %s;" - + " dropping", proto, senderPhone ); + Log.w( TAG, "SMSService.disAssemble: bad proto %d from %s;" + + " dropping", proto, senderPhone ); postEvent( MultiEvent.BAD_PROTO_SMS, senderPhone ); } else if ( gotPort != myPort ) { - DbgUtils.logd( TAG, "disAssemble(): received on port %d" - + " but expected %d", gotPort, myPort ); + Log.d( TAG, "disAssemble(): received on port %d" + + " but expected %d", gotPort, myPort ); } else { SMS_CMD cmd = SMS_CMD.values()[dis.readByte()]; byte[] rest = new byte[dis.available()]; @@ -621,10 +621,10 @@ public class SMSService extends XWService { success = true; } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } catch ( ArrayIndexOutOfBoundsException oob ) { // enum this older code doesn't know about; drop it - DbgUtils.logw( TAG, "disAssemble: dropping message with too-new enum" ); + Log.w( TAG, "disAssemble: dropping message with too-new enum" ); } return success; } @@ -678,22 +678,22 @@ public class SMSService extends XWService { for ( byte[] fragment : fragments ) { mgr.sendDataMessage( phone, null, nbsPort, fragment, sent, delivery ); - DbgUtils.logi( TAG, "sendBuffers(): sent %d byte fragment", - fragment.length ); + Log.i( TAG, "sendBuffers(): sent %d byte fragment", + fragment.length ); } success = true; } catch ( IllegalArgumentException iae ) { - DbgUtils.logw( TAG, "sendBuffers(%s): %s", phone, iae.toString() ); + Log.w( TAG, "sendBuffers(%s): %s", phone, iae.toString() ); } catch ( NullPointerException npe ) { Assert.fail(); // shouldn't be trying to do this!!! } catch ( java.lang.SecurityException se ) { postEvent( MultiEvent.SMS_SEND_FAILED_NOPERMISSION ); } catch ( Exception ee ) { - DbgUtils.logex( TAG, ee ); + Log.ex( TAG, ee ); } } } else { - DbgUtils.logi( TAG, "dropping because SMS disabled" ); + Log.i( TAG, "dropping because SMS disabled" ); } if ( showToasts( this ) && success && (0 == (s_nSent % 5)) ) { @@ -729,7 +729,7 @@ public class SMSService extends XWService { break; case SmsManager.RESULT_ERROR_NO_SERVICE: default: - DbgUtils.logw( TAG, "FAILURE!!!" ); + Log.w( TAG, "FAILURE!!!" ); postEvent( MultiEvent.SMS_SEND_FAILED ); break; } @@ -742,7 +742,7 @@ public class SMSService extends XWService { public void onReceive( Context context, Intent intent ) { if ( Activity.RESULT_OK != getResultCode() ) { - DbgUtils.logw( TAG, "SMS delivery result: FAILURE" ); + Log.w( TAG, "SMS delivery result: FAILURE" ); } } }; @@ -762,7 +762,7 @@ public class SMSService extends XWService { } } } - DbgUtils.logi( TAG, "matchKeyIf(%s) => %s", phone, result ); + Log.i( TAG, "matchKeyIf(%s) => %s", phone, result ); return result; } 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 82db00724..4469176f5 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 @@ -65,7 +65,7 @@ public class TilePickView extends LinearLayout { m_listner = lstn; m_pendingTiles = (ArrayList)bundle.getSerializable( NEW_TILES ); if ( null == m_pendingTiles ) { - DbgUtils.logd( TAG, "creating new m_pendingTiles" ); + Log.d( TAG, "creating new m_pendingTiles" ); m_pendingTiles = new ArrayList(); } 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 a9c434148..884f431aa 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 @@ -97,8 +97,8 @@ public class Toolbar implements BoardContainer.SizeChangeListener { m_onClickListeners.put( index, new View.OnClickListener() { @Override public void onClick( View view ) { - DbgUtils.logi( TAG, "setListener(): click on %s with action %s", - view.toString(), action.toString() ); + Log.i( TAG, "setListener(): click on %s with action %s", + view.toString(), action.toString() ); m_dlgDlgt.makeNotAgainBuilder( msgID, prefsKey, action ) .show(); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/UpdateCheckReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/UpdateCheckReceiver.java index 1f8053a86..6a6a60344 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/UpdateCheckReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/UpdateCheckReceiver.java @@ -119,7 +119,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { try { versionCode = pm.getPackageInfo( packageName, 0 ).versionCode; } catch ( PackageManager.NameNotFoundException nnfe ) { - DbgUtils.logex( TAG, nnfe ); + Log.ex( TAG, nnfe ); versionCode = 0; } @@ -143,7 +143,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { params.put( k_APP, appParams ); params.put( k_DEVID, XWPrefs.getDevID( context ) ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } } @@ -158,7 +158,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { params.put( k_DICTS, dictParams ); params.put( k_DEVID, XWPrefs.getDevID( context ) ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } } @@ -168,7 +168,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { try { params.put( k_XLATEINFO, xlationUpdate ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } } @@ -177,12 +177,11 @@ public class UpdateCheckReceiver extends BroadcastReceiver { params.put( k_STRINGSHASH, BuildConfig.STRINGS_HASH ); params.put( k_NAME, packageName ); params.put( k_AVERS, versionCode ); - DbgUtils.logd( TAG, "current update: %s", - params.toString() ); + Log.d( TAG, "current update: %s", params.toString() ); new UpdateQueryTask( context, params, fromUI, pm, packageName, dals ).execute(); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } } } @@ -225,7 +224,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { params.put( k_MD5SUM, sum ); params.put( k_INDEX, index ); } catch( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } return params; } @@ -365,11 +364,11 @@ public class UpdateCheckReceiver extends BroadcastReceiver { } } } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); - DbgUtils.logw( TAG, "sent: \"%s\"", params.toString() ); - DbgUtils.logw( TAG, "received: \"%s\"", jstr ); + Log.ex( TAG, jse ); + Log.w( TAG, "sent: \"%s\"", params.toString() ); + Log.w( TAG, "received: \"%s\"", jstr ); } catch ( PackageManager.NameNotFoundException nnfe ) { - DbgUtils.logex( TAG, nnfe ); + Log.ex( TAG, nnfe ); } if ( !gotOne && m_fromUI ) { 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 de99b2182..e456f83cd 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 @@ -117,7 +117,7 @@ public class Utils { SMSService.SMSPhoneInfo info = SMSService.getPhoneInfo( context ); result = null != info && info.isPhone && info.isGSM; } - DbgUtils.logd( TAG, "isGSMPhone() => %b", result ); + Log.d( TAG, "isGSMPhone() => %b", result ); return result; } @@ -137,7 +137,7 @@ public class Utils { result = TelephonyManager.PHONE_TYPE_GSM == type; } } - DbgUtils.logd( TAG, "deviceSupportsSMS() => %b", result ); + Log.d( TAG, "deviceSupportsSMS() => %b", result ); return result; } @@ -153,7 +153,7 @@ public class Utils { try { Toast.makeText( context, msg, Toast.LENGTH_SHORT).show(); } catch ( java.lang.RuntimeException re ) { - DbgUtils.logex( TAG, re ); + Log.ex( TAG, re ); } } @@ -442,7 +442,7 @@ public class Utils { .versionCode; s_appVersion = new Integer( version ); } catch ( Exception e ) { - DbgUtils.logex( TAG, e ); + Log.ex( TAG, e ); } } return null == s_appVersion? 0 : s_appVersion; 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 df5c2c451..bf9280bc2 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 @@ -184,7 +184,7 @@ public class WiDirService extends XWService { public static void init( Context context ) { - DbgUtils.logd( TAG, "init()" ); + Log.d( TAG, "init()" ); s_enabled = XWPrefs.getPrefsBoolean( context, R.string.key_enable_p2p, false ); @@ -197,13 +197,13 @@ public class WiDirService extends XWService { s_peersSet.add( mac ); } } - DbgUtils.logd( TAG, "loaded saved peers: %s", s_peersSet.toString() ); + Log.d( TAG, "loaded saved peers: %s", s_peersSet.toString() ); try { ChannelListener listener = new ChannelListener() { @Override public void onChannelDisconnected() { - DbgUtils.logd( TAG, "onChannelDisconnected()"); + Log.d( TAG, "onChannelDisconnected()"); } }; sChannel = getMgr().initialize( context, Looper.getMainLooper(), @@ -246,8 +246,7 @@ public class WiDirService extends XWService { sMacAddress = DBUtils.getStringFor( context, MAC_ADDR_KEY, null ); } } - DbgUtils.logd( TAG, "getMyMacAddress() => %s", - sMacAddress ); + Log.d( TAG, "getMyMacAddress() => %s", sMacAddress ); // Assert.assertNotNull(sMacAddress); return sMacAddress; } @@ -286,16 +285,16 @@ public class WiDirService extends XWService { public static void inviteRemote( Context context, String macAddr, NetLaunchInfo nli ) { - DbgUtils.logd( TAG, "inviteRemote(%s)", macAddr ); + Log.d( TAG, "inviteRemote(%s)", macAddr ); Assert.assertNotNull( macAddr ); String nliString = nli.toString(); - DbgUtils.logd( TAG, "inviteRemote(%s)", nliString ); + Log.d( TAG, "inviteRemote(%s)", nliString ); boolean[] forwarding = { false }; BiDiSockWrap wrap = getForSend( macAddr, forwarding ); if ( null == wrap ) { - DbgUtils.loge( TAG, "inviteRemote: no socket for %s", macAddr ); + Log.e( TAG, "inviteRemote: no socket for %s", macAddr ); } else { XWPacket packet = new XWPacket( XWPacket.CMD.INVITE ) .put( KEY_SRC, getMyMacAddress() ) @@ -311,7 +310,7 @@ public class WiDirService extends XWService { public static int sendPacket( Context context, String macAddr, int gameID, byte[] buf ) { - DbgUtils.logd( TAG, "sendPacket(len=%d,addr=%s)", buf.length, macAddr ); + Log.d( TAG, "sendPacket(len=%d,addr=%s)", buf.length, macAddr ); int nSent = -1; boolean[] forwarding = { false }; @@ -329,7 +328,7 @@ public class WiDirService extends XWService { wrap.send( packet ); nSent = buf.length; } else { - DbgUtils.logd( TAG, "sendPacket: no socket for %s", macAddr ); + Log.d( TAG, "sendPacket: no socket for %s", macAddr ); } return nSent; } @@ -339,7 +338,7 @@ public class WiDirService extends XWService { if ( enabled() && sHavePermission ) { if ( initListeners( activity ) ) { activity.registerReceiver( sReceiver, sIntentFilter ); - DbgUtils.logd( TAG, "activityResumed() done" ); + Log.d( TAG, "activityResumed() done" ); startDiscovery(); } } @@ -353,9 +352,9 @@ public class WiDirService extends XWService { try { activity.unregisterReceiver( sReceiver ); } catch ( IllegalArgumentException iae ) { - DbgUtils.logex( TAG, iae ); + Log.ex( TAG, iae ); } - DbgUtils.logd( TAG, "activityPaused() done" ); + Log.d( TAG, "activityPaused() done" ); // Examples seem to kick discovery off once and that's it // sDiscoveryStarted = false; @@ -385,7 +384,7 @@ public class WiDirService extends XWService { sIface = new BiDiSockWrap.Iface() { public void gotPacket( BiDiSockWrap socket, byte[] bytes ) { - DbgUtils.logd( TAG, "wrapper got packet!!!" ); + Log.d( TAG, "wrapper got packet!!!" ); updateStatusIn( true ); processPacket( socket, bytes ); } @@ -393,8 +392,8 @@ public class WiDirService extends XWService { public void connectStateChanged( BiDiSockWrap wrap, boolean nowConnected ) { - DbgUtils.logd( TAG, "connectStateChanged(connected=%b)", - nowConnected ); + Log.d( TAG, "connectStateChanged(connected=%b)", + nowConnected ); if ( nowConnected ) { wrap.send( new XWPacket( XWPacket.CMD.PING ) .put( KEY_NAME, sDeviceName ) @@ -402,8 +401,8 @@ public class WiDirService extends XWService { } else { int sizeBefore = sSocketWrapMap.size(); sSocketWrapMap.values().remove( wrap ); - DbgUtils.logd( TAG, "removed wrap; had %d, now have %d", - sizeBefore, sSocketWrapMap.size() ); + Log.d( TAG, "removed wrap; had %d, now have %d", + sizeBefore, sSocketWrapMap.size() ); if ( 0 == sSocketWrapMap.size() ) { updateStatusIn( false ); updateStatusOut( false ); @@ -412,7 +411,7 @@ public class WiDirService extends XWService { } public void onWriteSuccess( BiDiSockWrap wrap ) { - DbgUtils.logd( TAG, "onWriteSuccess()" ); + Log.d( TAG, "onWriteSuccess()" ); updateStatusOut( true ); } }; @@ -420,10 +419,10 @@ public class WiDirService extends XWService { sGroupListener = new GroupInfoListener() { public void onGroupInfoAvailable( WifiP2pGroup group ) { if ( null == group ) { - DbgUtils.logd( TAG, "onGroupInfoAvailable(null)!" ); + Log.d( TAG, "onGroupInfoAvailable(null)!" ); } else { - DbgUtils.logd( TAG, "onGroupInfoAvailable(owner: %b)!", - group.isGroupOwner() ); + Log.d( TAG, "onGroupInfoAvailable(owner: %b)!", + group.isGroupOwner() ); Assert.assertTrue( sAmGroupOwner == group.isGroupOwner() ); if ( sAmGroupOwner ) { Collection devs = group.getClientList(); @@ -433,18 +432,18 @@ public class WiDirService extends XWService { sUserMap.put( macAddr, dev.deviceName ); BiDiSockWrap wrap = sSocketWrapMap.get( macAddr ); if ( null == wrap ) { - DbgUtils.logd( TAG, - "groupListener: no socket for %s", - macAddr ); + Log.d( TAG, + "groupListener: no socket for %s", + macAddr ); } else { - DbgUtils.logd( TAG, "socket for %s connected: %b", - macAddr, wrap.isConnected() ); + Log.d( TAG, "socket for %s connected: %b", + macAddr, wrap.isConnected() ); } } } } } - DbgUtils.logd( TAG, "thread count: %d", Thread.activeCount() ); + Log.d( TAG, "thread count: %d", Thread.activeCount() ); new Handler().postDelayed( new Runnable() { @Override public void run() { @@ -464,7 +463,7 @@ public class WiDirService extends XWService { sReceiver = new WFDBroadcastReceiver( mgr, sChannel ); succeeded = true; } catch ( SecurityException se ) { - DbgUtils.logd( TAG, "disabling wifi; no permissions" ); + Log.d( TAG, "disabling wifi; no permissions" ); sEnabled = false; } } else { @@ -519,8 +518,8 @@ public class WiDirService extends XWService { private void schedule( int waitSeconds ) { - DbgUtils.logd( TAG, "scheduling %s in %d seconds", - m_curState.toString(), waitSeconds ); + Log.d( TAG, "scheduling %s in %d seconds", + m_curState.toString(), waitSeconds ); m_handler.removeCallbacks( this ); // remove any others m_handler.postDelayed( this, waitSeconds * 1000 ); } @@ -530,8 +529,7 @@ public class WiDirService extends XWService { public void onSuccess() { m_lastSucceeded = true; m_lastGoodState = m_curState; - DbgUtils.logd( TAG, "onSuccess(): state %s done", - m_curState.toString() ); + Log.d( TAG, "onSuccess(): state %s done", m_curState.toString() ); m_curState = State.values()[m_curState.ordinal() + 1]; schedule( 0 ); } @@ -555,19 +553,18 @@ public class WiDirService extends XWService { break; case WifiP2pManager.BUSY: if ( ! sEnabled ) { - DbgUtils.logd( TAG, "onFailure(): no wifi," - + " so stopping machine" ); + Log.d( TAG, "onFailure(): no wifi, so stopping machine" ); break; } else if ( 8 < count ) { - DbgUtils.logd( TAG, "too many errors; restarting machine" ); + Log.d( TAG, "too many errors; restarting machine" ); m_curState = State.START; } schedule( 10 ); codeStr = "BUSY"; break; } - DbgUtils.logd( TAG, "onFailure(%s): state %s failed (count=%d)", - codeStr, m_curState.toString(), count ); + Log.d( TAG, "onFailure(%s): state %s failed (count=%d)", + codeStr, m_curState.toString(), count ); } @Override @@ -614,8 +611,8 @@ public class WiDirService extends XWService { break; case DONE: - DbgUtils.logd( TAG, "machine done; should I try connecting to: %s?", - s_peersSet.toString() ); + Log.d( TAG, "machine done; should I try connecting to: %s?", + s_peersSet.toString() ); // m_curState = State.START; // schedule( /*5 * */ 60 ); break; @@ -650,9 +647,9 @@ public class WiDirService extends XWService { WifiP2pDevice srcDevice) { // Service has been discovered. My app? if ( instanceName.equalsIgnoreCase( SERVICE_NAME ) ) { - DbgUtils.logd( TAG, "onBonjourServiceAvailable " - + instanceName + " with name " - + srcDevice.deviceName ); + Log.d( TAG, "onBonjourServiceAvailable " + + instanceName + " with name " + + srcDevice.deviceName ); tryConnect( srcDevice ); } } @@ -664,13 +661,13 @@ public class WiDirService extends XWService { public void onDnsSdTxtRecordAvailable( String domainName, Map map, WifiP2pDevice device ) { - DbgUtils.logd( TAG, - "onDnsSdTxtRecordAvailable(avail: %s, port: %s; name: %s)", - map.get("AVAILABLE"), map.get("PORT"), map.get("NAME")); + Log.d( TAG, + "onDnsSdTxtRecordAvailable(avail: %s, port: %s; name: %s)", + map.get("AVAILABLE"), map.get("PORT"), map.get("NAME")); } }; mgr.setDnsSdResponseListeners( sChannel, srl, trl ); - DbgUtils.logd( TAG, "setDiscoveryListeners done" ); + Log.d( TAG, "setDiscoveryListeners done" ); } } @@ -682,8 +679,7 @@ public class WiDirService extends XWService { long now = Utils.getCurSeconds(); result = 3 >= now - when; } - DbgUtils.logd( TAG, "connectPending(%s)=>%b", - macAddress, result ); + Log.d( TAG, "connectPending(%s)=>%b", macAddress, result ); return result; } @@ -696,16 +692,15 @@ public class WiDirService extends XWService { { final String macAddress = device.deviceAddress; if ( sAmGroupOwner ) { - DbgUtils.logd( TAG, "tryConnect(%s): dropping because group owner", - macAddress ); + Log.d( TAG, "tryConnect(%s): dropping because group owner", + macAddress ); } else if ( sSocketWrapMap.containsKey(macAddress) && sSocketWrapMap.get(macAddress).isConnected() ) { - DbgUtils.logd( TAG, "tryConnect(%s): already connected", - macAddress ); + Log.d( TAG, "tryConnect(%s): already connected", macAddress ); } else if ( connectPending( macAddress ) ) { // Do nothing } else { - DbgUtils.logd( TAG, "trying to connect to %s", macAddress ); + Log.d( TAG, "trying to connect to %s", macAddress ); WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = macAddress; config.wps.setup = WpsInfo.PBC; @@ -713,12 +708,12 @@ public class WiDirService extends XWService { getMgr().connect( sChannel, config, new ActionListener() { @Override public void onSuccess() { - DbgUtils.logd( TAG, "onSuccess(): %s", "connect_xx" ); + Log.d( TAG, "onSuccess(): %s", "connect_xx" ); notePending( macAddress ); } @Override public void onFailure(int reason) { - DbgUtils.logd( TAG, "onFailure(%d): %s", reason, "connect_xx"); + Log.d( TAG, "onFailure(%d): %s", reason, "connect_xx"); } } ); } @@ -727,7 +722,7 @@ public class WiDirService extends XWService { private static void connectToOwner( InetAddress addr ) { BiDiSockWrap wrap = new BiDiSockWrap( addr, OWNER_PORT, sIface ); - DbgUtils.logd( TAG, "connectToOwner(%s)", addr.toString() ); + Log.d( TAG, "connectToOwner(%s)", addr.toString() ); wrap.connect(); } @@ -738,9 +733,8 @@ public class WiDirService extends XWService { if ( null != macAddress ) { // this has fired. Sockets close and re-open? sSocketWrapMap.put( macAddress, wrap ); - DbgUtils.logd( TAG, - "storeByAddress(); storing wrap for %s", - macAddress ); + Log.d( TAG, "storeByAddress(); storing wrap for %s", + macAddress ); GameUtils.resendAllIf( XWApp.getContext(), CommsConnType.COMMS_CONN_P2P, @@ -750,7 +744,7 @@ public class WiDirService extends XWService { private void handleGotMessage( Intent intent ) { - DbgUtils.logd( TAG, "handleGotMessage(%s)", intent.toString() ); + Log.d( TAG, "handleGotMessage(%s)", intent.toString() ); int gameID = intent.getIntExtra( KEY_GAMEID, 0 ); byte[] data = XwJNI.base64Decode( intent.getStringExtra( KEY_DATA ) ); String macAddress = intent.getStringExtra( KEY_RETADDR ); @@ -766,7 +760,7 @@ public class WiDirService extends XWService { private void handleGotInvite( Intent intent ) { - DbgUtils.logd( TAG, "handleGotInvite()" ); + Log.d( TAG, "handleGotInvite()" ); String nliData = intent.getStringExtra( KEY_NLI ); NetLaunchInfo nli = new NetLaunchInfo( this, nliData ); String returnMac = intent.getStringExtra( KEY_SRC ); @@ -814,10 +808,10 @@ public class WiDirService extends XWService { Context context = XWApp.getContext(); Intent intent = null; String asStr = new String(bytes); - DbgUtils.logd( TAG, "got string: %s", asStr ); + Log.d( TAG, "got string: %s", asStr ); XWPacket packet = new XWPacket( asStr ); // JSONObject asObj = new JSONObject( asStr ); - DbgUtils.logd( TAG, "got packet: %s", packet.toString() ); + Log.d( TAG, "got packet: %s", packet.toString() ); final XWPacket.CMD cmd = packet.getCommand(); switch ( cmd ) { case PING: @@ -898,7 +892,7 @@ public class WiDirService extends XWService { } packet.put( KEY_MAP, array ); } catch ( JSONException ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } } @@ -915,7 +909,7 @@ public class WiDirService extends XWService { sUserMap.put( mac, name ); } } catch ( JSONException ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } updateListeners(); @@ -974,7 +968,7 @@ public class WiDirService extends XWService { if ( forwarded ) { forwardPacket( bytes, destAddr ); } else { - DbgUtils.logd( TAG, "addr mismatch: %s vs %s", destAddr, sMacAddress ); + Log.d( TAG, "addr mismatch: %s vs %s", destAddr, sMacAddress ); } } return forwarded; @@ -982,16 +976,16 @@ public class WiDirService extends XWService { private static void forwardPacket( byte[] bytes, String destAddr ) { - DbgUtils.logd( TAG, "forwardPacket(mac=%s)", destAddr ); + Log.d( TAG, "forwardPacket(mac=%s)", destAddr ); if ( sAmGroupOwner ) { BiDiSockWrap wrap = sSocketWrapMap.get( destAddr ); if ( null != wrap && wrap.isConnected() ) { wrap.send( bytes ); } else { - DbgUtils.loge( TAG, "no working socket for %s", destAddr ); + Log.e( TAG, "no working socket for %s", destAddr ); } } else { - DbgUtils.loge( TAG, "can't forward; not group owner (any more?)" ); + Log.e( TAG, "can't forward; not group owner (any more?)" ); } } @@ -1000,22 +994,22 @@ public class WiDirService extends XWService { sAmServer = true; sAcceptThread = new Thread( new Runnable() { public void run() { - DbgUtils.logd( TAG, "accept thread starting" ); + Log.d( TAG, "accept thread starting" ); boolean done = false; try { sServerSock = new ServerSocket( OWNER_PORT ); while ( !done ) { - DbgUtils.logd( TAG, "calling accept()" ); + Log.d( TAG, "calling accept()" ); Socket socket = sServerSock.accept(); - DbgUtils.logd( TAG, "accept() returned!!" ); + Log.d( TAG, "accept() returned!!" ); new BiDiSockWrap( socket, sIface ); } } catch ( IOException ioe ) { - DbgUtils.loge( TAG, ioe.toString() ); + Log.e( TAG, ioe.toString() ); sAmServer = false; done = true; } - DbgUtils.logd( TAG, "accept thread exiting" ); + Log.d( TAG, "accept thread exiting" ); } } ); sAcceptThread.start(); @@ -1023,13 +1017,13 @@ public class WiDirService extends XWService { private static void stopAcceptThread() { - DbgUtils.logd( TAG, "stopAcceptThread()" ); + Log.d( TAG, "stopAcceptThread()" ); if ( null != sAcceptThread ) { if ( null != sServerSock ) { try { sServerSock.close(); } catch ( IOException ioe ) { - DbgUtils.logex( TAG, ioe ); + Log.ex( TAG, ioe ); } sServerSock = null; } @@ -1052,7 +1046,7 @@ public class WiDirService extends XWService { // See if we need to forward through group owner instead if ( null == wrap && !sAmGroupOwner && 1 == sSocketWrapMap.size() ) { wrap = sSocketWrapMap.values().iterator().next(); - DbgUtils.logd( TAG, "forwarding to %s through group owner", macAddr ); + Log.d( TAG, "forwarding to %s through group owner", macAddr ); forwarding[0] = true; } @@ -1070,8 +1064,8 @@ public class WiDirService extends XWService { newSet.add( macAddress ); } - DbgUtils.logd( TAG, "updatePeersList(): old set: %s; new set: %s", - s_peersSet.toString(), newSet.toString() ); + Log.d( TAG, "updatePeersList(): old set: %s; new set: %s", + s_peersSet.toString(), newSet.toString() ); s_peersSet = newSet; DBUtils.setStringFor( XWApp.getContext(), PEERS_LIST_KEY, @@ -1094,12 +1088,12 @@ public class WiDirService extends XWService { public void onReceive( Context context, Intent intent ) { if ( enabled() ) { String action = intent.getAction(); - DbgUtils.logd( TAG, "got intent: " + intent.toString() ); + Log.d( TAG, "got intent: " + intent.toString() ); if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) { int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1); sEnabled = state == WifiP2pManager.WIFI_P2P_STATE_ENABLED; - DbgUtils.logd( TAG, "WifiP2PEnabled: %b", sEnabled ); + Log.d( TAG, "WifiP2PEnabled: %b", sEnabled ); if ( sEnabled ) { startDiscovery(); } @@ -1110,13 +1104,13 @@ public class WiDirService extends XWService { NetworkInfo networkInfo = (NetworkInfo)intent .getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO); if ( networkInfo.isConnected() ) { - DbgUtils.logd( TAG, "network %s connected", + Log.d( TAG, "network %s connected", networkInfo.toString() ); mManager.requestConnectionInfo(mChannel, this ); } else { // here - DbgUtils.logd( TAG, "network %s NOT connected", - networkInfo.toString() ); + Log.d( TAG, "network %s NOT connected", + networkInfo.toString() ); } } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) { // Respond to this device's wifi state changing @@ -1127,8 +1121,8 @@ public class WiDirService extends XWService { synchronized( sUserMap ) { sUserMap.put( sMacAddress, sDeviceName ); } - DbgUtils.logd( TAG, "Got my MAC Address: %s and name: %s", - sMacAddress, sDeviceName ); + Log.d( TAG, "Got my MAC Address: %s and name: %s", sMacAddress, + sDeviceName ); String stored = DBUtils.getStringFor( context, MAC_ADDR_KEY, null ); Assert.assertTrue( null == stored || stored.equals(sMacAddress) ); @@ -1140,8 +1134,7 @@ public class WiDirService extends XWService { .getIntExtra( WifiP2pManager.EXTRA_DISCOVERY_STATE, -1 ); Assert.assertTrue( running == 2 || running == 1 ); // remove soon sDiscoveryRunning = 2 == running; - DbgUtils.logd( TAG, "discovery changed: running: %b", - sDiscoveryRunning ); + Log.d( TAG, "discovery changed: running: %b", sDiscoveryRunning ); } } } @@ -1153,13 +1146,13 @@ public class WiDirService extends XWService { // InetAddress from WifiP2pInfo struct. InetAddress groupOwnerAddress = info.groupOwnerAddress; String hostAddress = groupOwnerAddress.getHostAddress(); - DbgUtils.logd( TAG, "onConnectionInfoAvailable(%s); addr: %s", - info.toString(), hostAddress ); + Log.d( TAG, "onConnectionInfoAvailable(%s); addr: %s", + info.toString(), hostAddress ); // After the group negotiation, we can determine the group owner. if (info.groupFormed ) { sAmGroupOwner = info.isGroupOwner; - DbgUtils.logd( TAG, "am %sgroup owner", sAmGroupOwner ? "" : "NOT " ); + Log.d( TAG, "am %sgroup owner", sAmGroupOwner ? "" : "NOT " ); DbgUtils.showf( "Joining WiFi P2p group as %s", sAmGroupOwner ? "owner" : "guest" ); if ( info.isGroupOwner ) { @@ -1179,13 +1172,13 @@ public class WiDirService extends XWService { @Override public void onPeersAvailable( WifiP2pDeviceList peerList ) { - DbgUtils.logd( TAG, "got list of %d peers", - peerList.getDeviceList().size() ); + Log.d( TAG, "got list of %d peers", + peerList.getDeviceList().size() ); updatePeersList( peerList ); for ( WifiP2pDevice device : peerList.getDeviceList() ) { - // DbgUtils.logd( TAG, "not connecting to: %s", device.toString() ); + // Log.d( TAG, "not connecting to: %s", device.toString() ); tryConnect( device ); } // Out with the old, in with the new. 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 81b07f496..d3d9188cc 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 @@ -48,7 +48,7 @@ public class XWActivity extends FragmentActivity protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt ) { if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logi( TAG, "onCreate(this=%H)", this ); + Log.i( TAG, "onCreate(this=%H)", this ); } super.onCreate( savedInstanceState ); m_dlgt = dlgt; @@ -67,7 +67,7 @@ public class XWActivity extends FragmentActivity protected void onSaveInstanceState( Bundle outState ) { if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logi( TAG, "onSaveInstanceState(this=%H)", this ); + Log.i( TAG, "onSaveInstanceState(this=%H)", this ); } m_dlgt.onSaveInstanceState( outState ); super.onSaveInstanceState( outState ); @@ -77,7 +77,7 @@ public class XWActivity extends FragmentActivity protected void onPause() { if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logi( TAG, "onPause(this=%H)", this ); + Log.i( TAG, "onPause(this=%H)", this ); } m_dlgt.onPause(); super.onPause(); @@ -88,7 +88,7 @@ public class XWActivity extends FragmentActivity protected void onResume() { if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logi( TAG, "onResume(this=%H)", this ); + Log.i( TAG, "onResume(this=%H)", this ); } super.onResume(); WiDirWrapper.activityResumed( this ); @@ -99,7 +99,7 @@ public class XWActivity extends FragmentActivity protected void onPostResume() { if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logi( TAG, "onPostResume(this=%H)", this ); + Log.i( TAG, "onPostResume(this=%H)", this ); } super.onPostResume(); } @@ -108,7 +108,7 @@ public class XWActivity extends FragmentActivity protected void onStart() { if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logi( TAG, "%s.onStart(this=%H)", this ); + Log.i( TAG, "%s.onStart(this=%H)", this ); } super.onStart(); m_dlgt.onStart(); @@ -118,7 +118,7 @@ public class XWActivity extends FragmentActivity protected void onStop() { if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logi( TAG, "%s.onStop(this=%H)", this ); + Log.i( TAG, "%s.onStop(this=%H)", this ); } m_dlgt.onStop(); super.onStop(); @@ -128,7 +128,7 @@ public class XWActivity extends FragmentActivity protected void onDestroy() { if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logi( TAG, "onDestroy(this=%H)", this ); + Log.i( TAG, "onDestroy(this=%H)", this ); } m_dlgt.onDestroy(); super.onDestroy(); 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 176abadfa..4748d71b5 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 @@ -68,8 +68,7 @@ public class XWApp extends Application { // This one line should always get logged even if logging is // off -- because logging is on by default until logEnable is // called. - DbgUtils.logi( TAG, "onCreate(); git_rev=%s", - getString( R.string.git_rev ) ); + Log.i( TAG, "onCreate(); git_rev=%s", getString( R.string.git_rev ) ); DbgUtils.logEnable( this ); ConnStatusHandler.loadState( this ); @@ -99,7 +98,7 @@ public class XWApp extends Application { @Override public void onTerminate() { - DbgUtils.logi( TAG, "onTerminate() called" ); + Log.i( TAG, "onTerminate() called" ); XwJNI.cleanGlobals(); super.onTerminate(); } 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 7c6e76beb..a4c139077 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 @@ -84,7 +84,7 @@ abstract class XWFragment extends Fragment implements Delegator { @Override public void onSaveInstanceState( Bundle outState ) { - DbgUtils.logd( TAG, "%s.onCreate() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onCreate() called", getClass().getSimpleName() ); Assert.assertNotNull( m_parentName ); outState.putString( PARENT_NAME, m_parentName ); m_dlgt.onSaveInstanceState( outState ); @@ -93,7 +93,7 @@ abstract class XWFragment extends Fragment implements Delegator { protected void onCreate( DelegateBase dlgt, Bundle sis ) { - DbgUtils.logd( TAG, "%s.onCreate() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onCreate() called", getClass().getSimpleName() ); super.onCreate( sis ); if ( null != sis ) { m_parentName = sis.getString( PARENT_NAME ); @@ -108,7 +108,7 @@ abstract class XWFragment extends Fragment implements Delegator { // @Override // public void onAttach( Activity activity ) // { - // DbgUtils.logdf( "%s.onAttach() called", + // Log.df( "%s.onAttach() called", // this.getClass().getSimpleName() ); // super.onAttach( activity ); // } @@ -117,7 +117,7 @@ abstract class XWFragment extends Fragment implements Delegator { public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState ) { - DbgUtils.logd( TAG, "%s.onCreateView() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onCreateView() called", getClass().getSimpleName() ); sActiveFrags.add(this); return m_dlgt.inflateView( inflater, container ); } @@ -125,7 +125,7 @@ abstract class XWFragment extends Fragment implements Delegator { @Override public void onActivityCreated( Bundle savedInstanceState ) { - DbgUtils.logd( TAG, "%s.onActivityCreated() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onActivityCreated() called", getClass().getSimpleName() ); m_dlgt.init( savedInstanceState ); super.onActivityCreated( savedInstanceState ); if ( m_hasOptionsMenu ) { @@ -136,7 +136,7 @@ abstract class XWFragment extends Fragment implements Delegator { @Override public void onPause() { - DbgUtils.logd( TAG, "%s.onPause() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onPause() called", getClass().getSimpleName() ); m_dlgt.onPause(); super.onPause(); } @@ -144,7 +144,7 @@ abstract class XWFragment extends Fragment implements Delegator { @Override public void onResume() { - DbgUtils.logd( TAG, "%s.onResume() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onResume() called", getClass().getSimpleName() ); super.onResume(); m_dlgt.onResume(); } @@ -152,7 +152,7 @@ abstract class XWFragment extends Fragment implements Delegator { @Override public void onStart() { - DbgUtils.logd( TAG, "%s.onStart() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onStart() called", getClass().getSimpleName() ); super.onStart(); m_dlgt.onStart(); } @@ -160,7 +160,7 @@ abstract class XWFragment extends Fragment implements Delegator { @Override public void onStop() { - DbgUtils.logd( TAG, "%s.onStop() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onStop() called", getClass().getSimpleName() ); m_dlgt.onStop(); super.onStop(); } @@ -168,7 +168,7 @@ abstract class XWFragment extends Fragment implements Delegator { @Override public void onDestroy() { - DbgUtils.logd( TAG, "%s.onDestroy() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onDestroy() called", getClass().getSimpleName() ); m_dlgt.onDestroy(); sActiveFrags.remove( this ); super.onDestroy(); @@ -177,7 +177,7 @@ abstract class XWFragment extends Fragment implements Delegator { @Override public void onActivityResult( int requestCode, int resultCode, Intent data ) { - DbgUtils.logd( TAG, "%s.onActivityResult() called", getClass().getSimpleName() ); + Log.d( TAG, "%s.onActivityResult() called", getClass().getSimpleName() ); m_dlgt.onActivityResult( RequestCode.values()[requestCode], resultCode, data ); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPacket.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPacket.java index 1c397f2a0..a4111047e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPacket.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPacket.java @@ -49,7 +49,7 @@ public class XWPacket { m_obj.put( KEY_CMD, cmd.ordinal() ); } } catch ( JSONException ex ) { - DbgUtils.logd( TAG, ex.toString() ); + Log.d( TAG, ex.toString() ); } } @@ -58,7 +58,7 @@ public class XWPacket { try { m_obj = new JSONObject( str ); } catch ( JSONException ex ) { - DbgUtils.logd( TAG, ex.toString() ); + Log.d( TAG, ex.toString() ); } } @@ -85,7 +85,7 @@ public class XWPacket { try { m_obj.put( key, value ); } catch ( JSONException ex ) { - DbgUtils.logd( TAG, ex.toString() ); + Log.d( TAG, ex.toString() ); } return this; } @@ -95,7 +95,7 @@ public class XWPacket { try { m_obj.put( key, value ); } catch ( JSONException ex ) { - DbgUtils.logd( TAG, ex.toString() ); + Log.d( TAG, ex.toString() ); } return this; } @@ -105,7 +105,7 @@ public class XWPacket { try { m_obj.put( key, value ); } catch ( JSONException ex ) { - DbgUtils.logd( TAG, ex.toString() ); + Log.d( TAG, ex.toString() ); } return this; } 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 d4933c84a..7a30c2e15 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 @@ -268,13 +268,13 @@ public class XWPrefs { try { obj.put( number, "" ); // null removes any entry } catch ( JSONException ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } } } - // DbgUtils.logd( TAG, "getSMSPhones() => %s", obj.toString() ); + // Log.d( TAG, "getSMSPhones() => %s", obj.toString() ); return obj; } 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 92559b32c..63605df6b 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 @@ -65,8 +65,8 @@ class XWService extends Service { if ( null != s_srcMgr ) { s_srcMgr.postEvent( event, args ); } else { - DbgUtils.logd( TAG, "postEvent(): dropping %s event", - event.toString() ); + Log.d( TAG, "postEvent(): dropping %s event", + event.toString() ); } } @@ -82,7 +82,7 @@ class XWService extends Service { s_seen.add( inviteID ); } } - DbgUtils.logd( TAG, "checkNotDupe(%s) => %b", inviteID, !isDupe ); + Log.d( TAG, "checkNotDupe(%s) => %b", inviteID, !isDupe ); return !isDupe; } 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 93873601f..ab92524f9 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 @@ -26,13 +26,13 @@ import android.text.TextUtils; import junit.framework.Assert; import org.eehouse.android.xw4.BTService; -import org.eehouse.android.xw4.WiDirService; -import org.eehouse.android.xw4.WiDirWrapper; -import org.eehouse.android.xw4.DbgUtils; import org.eehouse.android.xw4.GameUtils; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.SMSService; import org.eehouse.android.xw4.Utils; +import org.eehouse.android.xw4.WiDirService; +import org.eehouse.android.xw4.WiDirWrapper; import org.eehouse.android.xw4.XWPrefs; import org.eehouse.android.xw4.loc.LocUtils; @@ -319,8 +319,8 @@ public class CommsAddrRec { || ip_relay_port != other.ip_relay_port; break; default: - DbgUtils.logw( TAG, "changesMatter: not handling case: %s", - conType.toString() ); + Log.w( TAG, "changesMatter: not handling case: %s", + conType.toString() ); break; } } 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 ce3554634..f13f5607c 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 @@ -24,9 +24,9 @@ import android.content.Context; import junit.framework.Assert; -import org.eehouse.android.xw4.DbgUtils; import org.eehouse.android.xw4.DictLangCache; import org.eehouse.android.xw4.DictUtils; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.loc.LocUtils; import org.json.JSONObject; @@ -164,7 +164,7 @@ public class CurGameInfo implements Serializable { ; jsonData = obj.toString(); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } return jsonData; @@ -182,7 +182,7 @@ public class CurGameInfo implements Serializable { int tmp = obj.optInt( PHONIES, phoniesAction.ordinal() ); phoniesAction = XWPhoniesChoice.values()[tmp]; } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } } } 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 5921487b7..5562a6e98 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,7 +28,7 @@ import java.io.Serializable; import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils; -import org.eehouse.android.xw4.DbgUtils; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.Utils; import org.eehouse.android.xw4.XWApp; @@ -416,9 +416,9 @@ public class GameSummary implements Serializable { } m_extras = asObj.toString(); } catch( org.json.JSONException ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } - DbgUtils.logi( TAG, "putStringExtra(%s,%s) => %s", key, value, m_extras ); + Log.i( TAG, "putStringExtra(%s,%s) => %s", key, value, m_extras ); } public String getStringExtra( String key ) @@ -432,10 +432,10 @@ public class GameSummary implements Serializable { result = null; } } catch( org.json.JSONException ex ) { - DbgUtils.logex( TAG, ex ); + Log.ex( TAG, ex ); } } - DbgUtils.logi( TAG, "getStringExtra(%s) => %s", key, result ); + Log.i( TAG, "getStringExtra(%s) => %s", key, result ); return result; } @@ -453,7 +453,7 @@ public class GameSummary implements Serializable { break; } } - // DbgUtils.logd( TAG, "hasRematchInfo() => %b", found ); + // Log.d( TAG, "hasRematchInfo() => %b", found ); return found; } 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 71b3c61f6..2a3b2fa0b 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 @@ -36,6 +36,7 @@ import org.eehouse.android.xw4.DbgUtils; import org.eehouse.android.xw4.DictUtils; import org.eehouse.android.xw4.GameLock; import org.eehouse.android.xw4.GameUtils; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.XWPrefs; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; @@ -184,8 +185,8 @@ public class JNIThread extends Thread { if ( BuildConfig.DEBUG ) { Iterator iter = m_queue.iterator(); while ( iter.hasNext() ) { - DbgUtils.logi( TAG, "removing %s from queue", - iter.next().m_cmd.toString() ); + Log.i( TAG, "removing %s from queue", + iter.next().m_cmd.toString() ); } } m_queue.clear(); @@ -215,7 +216,7 @@ public class JNIThread extends Thread { // Assert.assertNull( m_jniGamePtr ); // fired!! if ( null != m_jniGamePtr ) { - DbgUtils.logd( TAG, "configure(): m_jniGamePtr not null; that ok?" ); + Log.d( TAG, "configure(): m_jniGamePtr not null; that ok?" ); } m_jniGamePtr = null; if ( null != stream ) { @@ -259,7 +260,7 @@ public class JNIThread extends Thread { join(); // Assert.assertFalse( isAlive() ); } catch ( java.lang.InterruptedException ie ) { - DbgUtils.logex( TAG, ie ); + Log.ex( TAG, ie ); } m_lock.unlock(); } @@ -376,7 +377,7 @@ public class JNIThread extends Thread { // PENDING: once certain this is true, stop saving the full array and // instead save the hash. Also, update it after each save. if ( hashesEqual ) { - DbgUtils.logd( TAG, "save_jni(): no change in game; can skip saving" ); + Log.d( TAG, "save_jni(): no change in game; can skip saving" ); } else { // Don't need this!!!! this only runs on the run() thread synchronized( this ) { @@ -431,7 +432,7 @@ public class JNIThread extends Thread { try { elem = m_queue.take(); } catch ( InterruptedException ie ) { - DbgUtils.logw( TAG, "interrupted; killing thread" ); + Log.w( TAG, "interrupted; killing thread" ); break; } boolean draw = false; @@ -703,7 +704,7 @@ public class JNIThread extends Thread { case CMD_NONE: // ignored break; default: - DbgUtils.logw( TAG, "dropping cmd: %s", elem.m_cmd.toString() ); + Log.w( TAG, "dropping cmd: %s", elem.m_cmd.toString() ); Assert.fail(); } @@ -722,7 +723,7 @@ public class JNIThread extends Thread { XwJNI.comms_stop( m_jniGamePtr ); save_jni(); } else { - DbgUtils.logw( TAG, "run(): exiting without saving" ); + Log.w( TAG, "run(): exiting without saving" ); } m_jniGamePtr.release(); m_jniGamePtr = null; @@ -750,8 +751,7 @@ public class JNIThread extends Thread { { m_queue.add( new QueueElem( cmd, true, args ) ); if ( m_stopped && ! JNICmd.CMD_NONE.equals(cmd) ) { - DbgUtils.logw( TAG, "adding %s to stopped thread!!!", - cmd.toString() ); + Log.w( TAG, "adding %s to stopped thread!!!", cmd.toString() ); DbgUtils.printStack( TAG ); } } @@ -769,8 +769,8 @@ public class JNIThread extends Thread { private void retain_sync() { ++m_refCount; - DbgUtils.logi( TAG, "retain_sync(rowid=%d): m_refCount raised to %d", - m_rowid, m_refCount ); + Log.i( TAG, "retain_sync(rowid=%d): m_refCount raised to %d", + m_rowid, m_refCount ); } public JNIThread retain() @@ -792,8 +792,8 @@ public class JNIThread extends Thread { stop = true; } } - DbgUtils.logi( TAG, "release(rowid=%d): m_refCount dropped to %d", - m_rowid, m_refCount ); + Log.i( TAG, "release(rowid=%d): m_refCount dropped to %d", + m_rowid, m_refCount ); if ( stop ) { waitToStop( true ); 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 d58868b7b..ad18a7e10 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 @@ -25,7 +25,7 @@ import android.content.Context; import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils; -import org.eehouse.android.xw4.DbgUtils; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.Utils; import java.io.ByteArrayInputStream; @@ -71,7 +71,7 @@ public class JNIUtilsImpl implements JNIUtils { try { isr = new InputStreamReader( bais, isUTF8? "UTF8" : "ISO8859_1" ); } catch( java.io.UnsupportedEncodingException uee ) { - DbgUtils.logi( TAG, "splitFaces: %s", uee.toString() ); + Log.i( TAG, "splitFaces: %s", uee.toString() ); isr = new InputStreamReader( bais ); } @@ -85,7 +85,7 @@ public class JNIUtilsImpl implements JNIUtils { try { chr = isr.read(); } catch ( java.io.IOException ioe ) { - DbgUtils.logw( TAG, ioe.toString() ); + Log.w( TAG, ioe.toString() ); } if ( -1 == chr ) { addFace( faces, face ); @@ -148,7 +148,7 @@ public class JNIUtilsImpl implements JNIUtils { } digest = md.digest(); } catch ( java.security.NoSuchAlgorithmException nsae ) { - DbgUtils.logex( TAG, nsae ); + Log.ex( TAG, nsae ); } return Utils.digestToString( digest ); } 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 df519cf09..6574be93c 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 @@ -25,8 +25,8 @@ import android.telephony.PhoneNumberUtils; import junit.framework.Assert; -import org.eehouse.android.xw4.DbgUtils; import org.eehouse.android.xw4.DevID; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.XWApp; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet; @@ -207,7 +207,7 @@ public class UtilCtxtImpl implements UtilCtxt { break; default: - DbgUtils.logw( TAG, "no such stringCode: %d", stringCode ); + Log.w( TAG, "no such stringCode: %d", stringCode ); } String result = (0 == id) ? "" : LocUtils.getString( m_context, id ); 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 4548e84cb..a629856a0 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,7 +24,7 @@ import android.graphics.Rect; import junit.framework.Assert; -import org.eehouse.android.xw4.DbgUtils; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.NetLaunchInfo; import org.eehouse.android.xw4.Utils; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; @@ -52,8 +52,8 @@ public class XwJNI { public synchronized GamePtr retain() { ++m_refCount; - DbgUtils.logd( TAG, "retain(this=%H, rowid=%d): refCount now %d", - this, m_rowid, m_refCount ); + Log.d( TAG, "retain(this=%H, rowid=%d): refCount now %d", + this, m_rowid, m_refCount ); return this; } @@ -62,8 +62,8 @@ public class XwJNI { public synchronized void release() { --m_refCount; - DbgUtils.logd( TAG, "release(this=%H, rowid=%d): refCount now %d", - this, m_rowid, m_refCount ); + Log.d( TAG, "release(this=%H, rowid=%d): refCount now %d", + this, m_rowid, m_refCount ); if ( 0 == m_refCount ) { if ( 0 != m_ptr ) { if ( !haveEnv( getJNI().m_ptr ) ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocDelegate.java index 9173705b0..573bf50c5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocDelegate.java @@ -30,9 +30,9 @@ import android.widget.ListView; import android.widget.Spinner; import android.widget.TextView; -import org.eehouse.android.xw4.DbgUtils; import org.eehouse.android.xw4.Delegator; import org.eehouse.android.xw4.ListDelegateBase; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; public class LocDelegate extends ListDelegateBase @@ -81,7 +81,7 @@ public class LocDelegate extends ListDelegateBase protected void onWindowFocusChanged( boolean hasFocus ) { if ( hasFocus && null != m_lastItem ) { - DbgUtils.logi( TAG, "updating LocListItem instance %H", m_lastItem ); + Log.i( TAG, "updating LocListItem instance %H", m_lastItem ); m_lastItem.update(); m_lastItem = null; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDs.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDs.java index 5090b4770..e4fc361a6 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDs.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDs.java @@ -22,7 +22,7 @@ package org.eehouse.android.xw4.loc; import android.content.Context; -import org.eehouse.android.xw4.DbgUtils; +import org.eehouse.android.xw4.Log; import java.util.HashMap; @@ -36,7 +36,7 @@ public class LocIDs extends LocIDsData { int result = LocIDsData.NOT_FOUND; if ( null != key && getS_MAP(context).containsKey( key ) ) { // Assert.assertNotNull( LocIDsData.S_MAP ); - DbgUtils.logw( TAG, "calling get with key %s", key ); + Log.w( TAG, "calling get with key %s", key ); result = getS_MAP( context ).get( key ); // NPE } return result; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocSearcher.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocSearcher.java index 7a41c54ca..30bfdd182 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocSearcher.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocSearcher.java @@ -22,7 +22,7 @@ package org.eehouse.android.xw4.loc; import android.content.Context; -import org.eehouse.android.xw4.DbgUtils; +import org.eehouse.android.xw4.Log; import java.util.ArrayList; @@ -134,7 +134,7 @@ public class LocSearcher { } else { Pair[] usePairs = null != m_lastTerm && term.contains(m_lastTerm) ? m_matchingPairs : m_filteredPairs; - DbgUtils.logi( TAG, "start: searching %d pairs", usePairs.length ); + Log.i( TAG, "start: searching %d pairs", usePairs.length ); ArrayList matches = new ArrayList(); for ( Pair pair : usePairs ) { if ( pair.matches( term ) ) { 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 e6b998889..5dabdb80f 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 @@ -46,6 +46,7 @@ import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils; import org.eehouse.android.xw4.DbgUtils; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.Utils; import org.eehouse.android.xw4.XWApp; @@ -307,8 +308,8 @@ public class LocUtils { int quantity ) { if ( XWApp.LOCUTILS_ENABLED ) { - DbgUtils.logw( TAG, "getQuantityString(%d): punting on locutils stuff for" - + " now. FIXME", quantity ); + Log.w( TAG, "getQuantityString(%d): punting on locutils stuff for" + + " now. FIXME", quantity ); } String result = context.getResources().getQuantityString( id, quantity ); return result; @@ -318,8 +319,8 @@ public class LocUtils { int quantity, Object... params ) { if ( XWApp.LOCUTILS_ENABLED ) { - DbgUtils.logw( TAG, "getQuantityString(%d): punting on locutils stuff for" - + " now. FIXME", quantity ); + Log.w( TAG, "getQuantityString(%d): punting on locutils stuff for" + + " now. FIXME", quantity ); } String result = context.getResources() .getQuantityString( id, quantity, params ); @@ -414,7 +415,7 @@ public class LocUtils { .put( k_LOCALE, locale ) .put( k_XLATEVERS, version ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } } return result; @@ -440,9 +441,9 @@ public class LocUtils { String locale = entry.getString( k_LOCALE ); String newVersion = entry.getString( k_NEW ); JSONArray pairs = entry.getJSONArray( k_PAIRS ); - DbgUtils.logi( TAG, "addXlations: locale %s: got pairs of len %d," - + " version %s", locale, - pairs.length(), newVersion ); + Log.i( TAG, "addXlations: locale %s: got pairs of len %d," + + " version %s", locale, + pairs.length(), newVersion ); int len = pairs.length(); Map newXlations = @@ -464,7 +465,7 @@ public class LocUtils { s_xlationsBlessed = null; loadXlations( context ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( TAG, jse ); + Log.ex( TAG, jse ); } } return nAdded; @@ -599,9 +600,8 @@ public class LocUtils { DBUtils.getXlations( context, getCurLocale( context ) ); s_xlationsLocal = (Map)asObjs[0]; s_xlationsBlessed = (Map)asObjs[1]; - DbgUtils.logi( TAG, "loadXlations: got %d local strings, %d blessed strings", - s_xlationsLocal.size(), - s_xlationsBlessed.size() ); + Log.i( TAG, "loadXlations: got %d local strings, %d blessed strings", + s_xlationsLocal.size(), s_xlationsBlessed.size() ); } } @@ -762,7 +762,7 @@ public class LocUtils { String locale = getCurLocale( context ); String msg = String.format( "Dropping bad translations for %s", locale ); Utils.showToast( context, msg ); - DbgUtils.logw( TAG, msg ); + Log.w( TAG, msg ); DBUtils.dropXLations( context, locale ); DBUtils.setStringFor( context, localeKey(locale), "" ); diff --git a/xwords4/android/scripts/mk_xml.py b/xwords4/android/scripts/mk_xml.py index a02f5ef99..706b0e9b0 100755 --- a/xwords4/android/scripts/mk_xml.py +++ b/xwords4/android/scripts/mk_xml.py @@ -98,7 +98,7 @@ import android.content.Context; import junit.framework.Assert; import org.eehouse.android.xw4.R; -import org.eehouse.android.xw4.DbgUtils; +import org.eehouse.android.xw4.Log; public class %s { private static final String TAG = %s.class.getSimpleName(); @@ -130,11 +130,11 @@ public class %s { if ( strs[ii].equals( fromCtxt ) ) { ++nMatches; } else { - DbgUtils.logi( TAG, "unequal strings: \\"%%s\\" vs \\"%%s\\"", - strs[ii], fromCtxt ); + Log.i( TAG, "unequal strings: \\"%%s\\" vs \\"%%s\\"", + strs[ii], fromCtxt ); } } - DbgUtils.logi( TAG, "checkStrings: %%d of %%d strings matched", nMatches, strs.length ); + Log.i( TAG, "checkStrings: %%d of %%d strings matched", nMatches, strs.length ); """ func += " }"