Merge remote-tracking branch 'sf/android_branch' into android_branch

This commit is contained in:
Eric House 2016-10-25 06:14:33 -07:00
commit c3c2795f67
72 changed files with 562 additions and 533 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ xwords_4.4.0.0*
gcm_loop.shelf
nohup.out
/xwords4/android/XWords4-dbg/src/xw4dbg/assets/gitvers.txt
/xwords4/linux/xwgames.sqldb

View file

@ -92,10 +92,11 @@ LOCAL_LDLIBS := -L${SYSROOT}/usr/lib -llog -lz
include $(BUILD_SHARED_LIBRARY)
ifneq ($(shell which ccache),)
TARGET_CC = ccache $(TOOLCHAIN_PREFIX)gcc
TARGET_CXX = ccache $(TOOLCHAIN_PREFIX)g++
endif
# This recipe doesn't work with clang. Fix if using gcc again
# ifneq ($(shell which ccache),)
# TARGET_CC = ccache $(TOOLCHAIN_PREFIX)gcc
# TARGET_CXX = ccache $(TOOLCHAIN_PREFIX)g++
# endif
COMMON_SRC_FILES :=
COMMON_PATH :=

View file

@ -33,8 +33,8 @@ public class BTReceiver extends BroadcastReceiver {
{
if ( XWApp.BTSUPPORTED ) {
String action = intent.getAction();
DbgUtils.logdf( "BTReceiver.onReceive(action=%s, intent=%s)",
action, intent.toString() );
DbgUtils.logd( getClass(), "BTReceiver.onReceive(action=%s, intent=%s)",
action, intent.toString() );
if ( action.equals( BluetoothDevice.ACTION_ACL_CONNECTED ) ) {
BTService.startService( context );

View file

@ -301,7 +301,7 @@ public class BTService extends XWService {
}
if ( -1 == nSent ) {
DbgUtils.logf( "BTService.enqueueFor(): can't send to %s",
DbgUtils.logi( BTService.class, "enqueueFor(): can't send to %s",
targetAddr.bt_hostName );
}
return nSent;
@ -328,13 +328,13 @@ public class BTService extends XWService {
? BluetoothAdapter.getDefaultAdapter() : null;
if ( null != adapter && adapter.isEnabled() ) {
m_adapter = adapter;
DbgUtils.logf( "BTService.onCreate(); bt name = %s; bt addr = %s",
DbgUtils.logi( getClass(), "onCreate(); bt name = %s; bt addr = %s",
adapter.getName(), adapter.getAddress() );
initAddrs();
startListener();
startSender();
} else {
DbgUtils.logf( "not starting threads: BT not available" );
DbgUtils.logw( getClass(), "not starting threads: BT not available" );
stopSelf();
}
}
@ -348,11 +348,11 @@ public class BTService extends XWService {
if ( -1 == ordinal ) {
// Drop it
} else if ( null == m_sender ) {
DbgUtils.logf( "exiting: m_queue is null" );
DbgUtils.logw( getClass(), "exiting: m_queue is null" );
stopSelf();
} else {
BTAction cmd = BTAction.values()[ordinal];
DbgUtils.logf( "BTService.onStartCommand; cmd=%s", cmd.toString() );
DbgUtils.logi( getClass(), "onStartCommand; cmd=%s", cmd.toString() );
switch( cmd ) {
case CLEAR:
String[] btAddrs = intent.getStringArrayExtra( CLEAR_KEY );
@ -365,7 +365,7 @@ public class BTService extends XWService {
case INVITE:
String jsonData = intent.getStringExtra( GAMEDATA_KEY );
NetLaunchInfo nli = new NetLaunchInfo( this, jsonData );
DbgUtils.logf( "onStartCommand: nli: %s", nli.toString() );
DbgUtils.logi( getClass(), "onStartCommand: nli: %s", nli.toString() );
String btAddr = intent.getStringExtra( ADDR_KEY );
m_sender.add( new BTQueueElem( BTCmd.INVITE, nli, btAddr ) );
break;
@ -465,7 +465,7 @@ public class BTService extends XWService {
break;
default:
DbgUtils.logf( "unexpected msg %s", cmd.toString());
DbgUtils.loge( getClass(), "unexpected msg %s", cmd.toString());
break;
}
updateStatusIn( true );
@ -479,7 +479,7 @@ public class BTService extends XWService {
sendBadProto( socket );
}
} catch ( IOException ioe ) {
DbgUtils.logf( "trying again..." );
DbgUtils.logw( getClass(), "trying again..." );
logIOE( ioe);
continue;
}
@ -583,7 +583,7 @@ public class BTService extends XWService {
os.flush();
socket.close();
} else {
DbgUtils.logf( "receiveMessages: read only %d of %d bytes",
DbgUtils.loge( getClass(), "receiveMessages: read only %d of %d bytes",
nRead, len );
}
} catch ( IOException ioe ) {
@ -685,7 +685,7 @@ public class BTService extends XWService {
try {
elem = m_queue.poll( timeout, TimeUnit.SECONDS );
} catch ( InterruptedException ie ) {
DbgUtils.logf( "BTService: interrupted; killing thread" );
DbgUtils.logw( getClass(), "interrupted; killing thread" );
break;
}
@ -812,7 +812,7 @@ public class BTService extends XWService {
outStream.writeShort( nliData.length );
outStream.write( nliData, 0, nliData.length );
}
DbgUtils.logf( "<eeh>sending invite for %d players", elem.m_nPlayersH );
DbgUtils.logi( getClass(), "<eeh>sending invite for %d players", elem.m_nPlayersH );
outStream.flush();
DataInputStream inStream =
@ -855,7 +855,7 @@ public class BTService extends XWService {
MultiEvent evt;
if ( success ) {
evt = MultiEvent.MESSAGE_DROPPED;
DbgUtils.logf( "BTService.sendMsg: dropping message %s because game %X dead",
DbgUtils.logw( getClass(), "sendMsg: dropping message %s because game %X dead",
elem.m_cmd, elem.m_gameID );
} else {
evt = MultiEvent.MESSAGE_REFUSED;
@ -1050,7 +1050,7 @@ public class BTService extends XWService {
try {
m_listener.join( 100 );
} catch ( InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
}
m_listener = null;
}
@ -1061,7 +1061,7 @@ public class BTService extends XWService {
try {
m_sender.join( 100 );
} catch ( InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
}
m_sender = null;
}
@ -1133,10 +1133,10 @@ public class BTService extends XWService {
dos = new DataOutputStream( socket.getOutputStream() );
dos.writeByte( BT_PROTO );
dos.writeByte( cmd.ordinal() );
DbgUtils.logf( "connect() to %s successful", name );
DbgUtils.logi( getClass(), "connect() to %s successful", name );
} catch ( IOException ioe ) {
dos = null;
DbgUtils.logf( "BTService.connect() to %s failed", name );
DbgUtils.logw( getClass(), "BTService.connect() to %s failed", name );
// logIOE( ioe );
}
return dos;
@ -1144,7 +1144,7 @@ public class BTService extends XWService {
private void logIOE( IOException ioe )
{
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
++s_errCount;
// if ( 0 == s_errCount % 10 ) {
sendResult( MultiEvent.BT_ERR_COUNT, s_errCount );
@ -1181,13 +1181,13 @@ public class BTService extends XWService {
try {
Thread.sleep( millis );
} catch ( InterruptedException ie ) {
DbgUtils.logf( "killSocketIn: killed by owner" );
DbgUtils.logw( getClass(), "killSocketIn: killed by owner" );
return;
}
try {
socket.close();
} catch( IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
} );
@ -1204,7 +1204,7 @@ public class BTService extends XWService {
{
int nSent = -1;
if ( null == m_sender ) {
DbgUtils.logf( "sendViaBluetooth(): no send thread" );
DbgUtils.logw( getClass(), "sendViaBluetooth(): no send thread" );
} else {
String btAddr = getSafeAddr( addr );
if ( null != btAddr && 0 < btAddr.length() ) {
@ -1212,7 +1212,7 @@ public class BTService extends XWService {
gameID ) );
nSent = buf.length;
} else {
DbgUtils.logf( "sendViaBluetooth(): no addr for dev %s",
DbgUtils.logi( BTService.class, "sendViaBluetooth(): no addr for dev %s",
addr.bt_hostName );
}
}

View file

@ -182,7 +182,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
DbgUtils.assertOnUIThread();
if ( null == jniThread ) {
} else if ( ! jniThread.equals( m_jniThread ) ) {
DbgUtils.logf( "BoardCanvas changing threads" );
DbgUtils.logw( getClass(), "changing threads" );
}
m_jniThread = jniThread;
}

View file

@ -91,7 +91,7 @@ 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.logf( "measured %s; passed ht: %d; got back ht: %d",
DbgUtils.logi( getClass(), "measured %s; passed ht: %d; got back ht: %d",
child.toString(), m_toolsBounds.height(),
child.getMeasuredHeight() );

View file

@ -568,7 +568,7 @@ public class BoardDelegate extends DelegateBase
Bundle args = getArguments();
m_rowid = args.getLong( GameUtils.INTENT_KEY_ROWID, -1 );
DbgUtils.logf( "BoardDelegate.init(): opening rowid %d", m_rowid );
DbgUtils.logi( getClass(), "opening rowid %d", m_rowid );
m_haveInvited = args.getBoolean( GameUtils.INVITED, false );
m_overNotShown = true;
@ -703,7 +703,7 @@ public class BoardDelegate extends DelegateBase
@Override
public void orientationChanged()
{
DbgUtils.logdf( "BoardDelegate.orientationChanged()" );
DbgUtils.logd( getClass(), "BoardDelegate.orientationChanged()" );
initToolbar();
m_view.orientationChanged();
}
@ -957,7 +957,7 @@ public class BoardDelegate extends DelegateBase
break;
default:
DbgUtils.logf( "menuitem %d not handled", id );
DbgUtils.logw( getClass(), "menuitem %d not handled", id );
handled = false;
}
@ -976,7 +976,8 @@ public class BoardDelegate extends DelegateBase
{
boolean handled = false;
boolean positive = AlertDialog.BUTTON_POSITIVE == which;
DbgUtils.logdf("BoardDelegate.dlgButtonClicked(%s, %b)", action.toString(), positive );
DbgUtils.logd( getClass(), "BoardDelegate.dlgButtonClicked(%s, %b)",
action.toString(), positive );
if ( Action.ENABLE_RELAY_DO_OR == action ) {
handled = true;
@ -1179,7 +1180,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.logf( "failed to create game" );
DbgUtils.logw( getClass(), "failed to create game" );
break;
case NEWGAME_DUP_REJECTED:
if ( m_progressShown ) {
@ -1334,7 +1335,7 @@ public class BoardDelegate extends DelegateBase
nli.addSMSInfo( m_activity );
break;
default:
DbgUtils.logf( "Not doing NFC join for conn type %s",
DbgUtils.logw( getClass(), "Not doing NFC join for conn type %s",
typ.toString() );
}
}
@ -1556,7 +1557,7 @@ public class BoardDelegate extends DelegateBase
}
if ( null != toastStr ) {
DbgUtils.logf( "handleConndMessage(): toastStr: %s", toastStr );
DbgUtils.logi( getClass(), "handleConndMessage(): toastStr: %s", toastStr );
m_toastStr = toastStr;
if ( naMsg == 0 ) {
dlgButtonClicked( Action.SHOW_EXPL_ACTION,
@ -2161,7 +2162,7 @@ public class BoardDelegate extends DelegateBase
case COMMS_CONN_SMS:
break;
default:
DbgUtils.logf( "tickle: unexpected type %s",
DbgUtils.logw( getClass(), "tickle: unexpected type %s",
typ.toString() );
Assert.fail();
}
@ -2257,7 +2258,7 @@ public class BoardDelegate extends DelegateBase
int result = cancelResult;
// this has been true; dunno why
if ( DlgID.NONE != m_blockingDlgID ) {
DbgUtils.logf( "waitBlockingDialog: dropping dlgID %d b/c %d set",
DbgUtils.logw( getClass(), "waitBlockingDialog: dropping dlgID %d b/c %d set",
dlgID, m_blockingDlgID );
} else {
setBlockingThread();
@ -2273,12 +2274,12 @@ public class BoardDelegate extends DelegateBase
try {
m_forResultWait.acquire();
} catch ( java.lang.InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
if ( DlgID.NONE != m_blockingDlgID ) {
try {
dismissDialog( m_blockingDlgID );
} catch ( java.lang.IllegalArgumentException iae ) {
DbgUtils.loge( iae );
DbgUtils.logex( iae );
}
}
}
@ -2452,7 +2453,7 @@ public class BoardDelegate extends DelegateBase
RelayService.inviteRemote( m_activity, destDevID,
null, nli );
} catch (NumberFormatException nfi) {
DbgUtils.loge( nfi );
DbgUtils.logex( nfi );
}
break;
}
@ -2533,7 +2534,7 @@ public class BoardDelegate extends DelegateBase
if ( canPost ) {
m_handler.post( runnable );
} else {
DbgUtils.logf( "BoardDelegate.post(): dropping b/c handler null" );
DbgUtils.logw( getClass(), "post(): dropping b/c handler null" );
DbgUtils.printStack();
}
return canPost;
@ -2544,7 +2545,7 @@ public class BoardDelegate extends DelegateBase
if ( null != m_handler ) {
m_handler.postDelayed( runnable, when );
} else {
DbgUtils.logf( "postDelayed: dropping %d because handler null", when );
DbgUtils.logw( getClass(), "postDelayed: dropping %d because handler null", when );
}
}
@ -2553,7 +2554,7 @@ public class BoardDelegate extends DelegateBase
if ( null != m_handler ) {
m_handler.removeCallbacks( which );
} else {
DbgUtils.logf( "removeCallbacks: dropping %h because handler null",
DbgUtils.logw( getClass(), "removeCallbacks: dropping %h because handler null",
which );
}
}
@ -2685,7 +2686,7 @@ public class BoardDelegate extends DelegateBase
doRematchIf( activity, null, rowID, summary, gi, gamePtr );
gamePtr.release();
} else {
DbgUtils.logf( "setupRematchFor(): unable to lock game" );
DbgUtils.logw( BoardDelegate.class, "setupRematchFor(): unable to lock game" );
}
if ( null != thread ) {
@ -2755,7 +2756,7 @@ public class BoardDelegate extends DelegateBase
sendSMSInviteIf( (String)params[1], (NetLaunchInfo)params[0],
false );
} else {
DbgUtils.logf( "retrySMSInvites: tests failed" );
DbgUtils.logw( getClass(), "retrySMSInvites: tests failed" );
}
}
@ -2767,7 +2768,7 @@ public class BoardDelegate extends DelegateBase
private void handleViaThread( JNICmd cmd, Object... args )
{
if ( null == m_jniThread ) {
DbgUtils.logf( "BoardDelegate: not calling handle(%s)", cmd.toString() );
DbgUtils.logw( getClass(), "not calling handle(%s)", cmd.toString() );
DbgUtils.printStack();
} else {
m_jniThread.handle( cmd, args );

View file

@ -107,7 +107,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.logdf( "BoardView.onTouchEvent(): in white space" );
DbgUtils.logd( getClass(), "BoardView.onTouchEvent(): in white space" );
}
break;
case MotionEvent.ACTION_MOVE:
@ -140,7 +140,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
m_lastSpacing = MULTI_INACTIVE;
break;
default:
DbgUtils.logf( "onTouchEvent: unknown action: %d", action );
DbgUtils.logw( getClass(), "onTouchEvent: unknown action: %d", action );
break;
}
}
@ -158,7 +158,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.logdf( "BoardView.onMeasure: discarding m_dims" );
DbgUtils.logd( getClass(), "BoardView.onMeasure: discarding m_dims" );
if ( ++m_dimsTossCount < 4 ) {
m_dims = null;
m_layoutWidth = m_layoutHeight = 0;
@ -185,8 +185,8 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
width = minWidth;
}
setMeasuredDimension( width, height );
DbgUtils.logdf( "BoardView.onMeasure: calling setMeasuredDimension( width=%d, height=%d )",
width, height );
DbgUtils.logd( getClass(), "BoardView.onMeasure: calling setMeasuredDimension( width=%d, height=%d )",
width, height );
}
// @Override
@ -207,7 +207,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
ConnStatusHandler.draw( m_context, canvas, getResources(),
m_connTypes, m_isSolo );
} else {
DbgUtils.logdf( "BoardView.onDraw(): board not laid out yet" );
DbgUtils.logd( getClass(), "BoardView.onDraw(): board not laid out yet" );
}
}
}
@ -218,15 +218,15 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
final int height = getHeight();
boolean layoutDone = width == m_layoutWidth && height == m_layoutHeight;
if ( layoutDone ) {
DbgUtils.logdf( "layoutBoardOnce(): layoutDone true" );
DbgUtils.logd( getClass(), "layoutBoardOnce(): layoutDone true" );
} else if ( null == m_gi ) {
// nothing to do either
DbgUtils.logdf( "layoutBoardOnce(): no m_gi" );
DbgUtils.logd( getClass(), "layoutBoardOnce(): no m_gi" );
} else if ( null == m_jniThread ) {
// nothing to do either
DbgUtils.logdf( "layoutBoardOnce(): no m_jniThread" );
DbgUtils.logd( getClass(), "layoutBoardOnce(): no m_jniThread" );
} else if ( null == m_dims ) {
DbgUtils.logdf( "layoutBoardOnce(): null m_dims" );
DbgUtils.logd( getClass(), "layoutBoardOnce(): null m_dims" );
// m_canvas = null;
// need to synchronize??
Paint paint = new Paint();
@ -237,12 +237,13 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
int timerWidth = scratch.width();
int fontWidth =
Math.min(m_defaultFontHt, timerWidth / timerTxt.length());
DbgUtils.logdf( "layoutBoardOnce(): posting JNICmd.CMD_LAYOUT(w=%d, h=%d)", width, height );
DbgUtils.logd( getClass(), "layoutBoardOnce(): posting JNICmd.CMD_LAYOUT(w=%d, h=%d)",
width, height );
handle( JNIThread.JNICmd.CMD_LAYOUT, width, height,
fontWidth, m_defaultFontHt );
// We'll be back....
} else {
DbgUtils.logdf( "layoutBoardOnce(): DOING IT" );
DbgUtils.logd( getClass(), "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;
@ -276,7 +277,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
m_layoutHeight = height;
layoutDone = true;
}
DbgUtils.logdf( "BoardView.layoutBoardOnce()=>%b", layoutDone );
DbgUtils.logd( getClass(), "layoutBoardOnce()=>%b", layoutDone );
return layoutDone;
} // layoutBoardOnce
@ -289,7 +290,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
public void startHandling( Activity parent, JNIThread thread,
CommsConnTypeSet connTypes )
{
DbgUtils.logdf( "BoardView.startHandling(thread=%H)", thread );
DbgUtils.logd( getClass(), "startHandling(thread=%H)", thread );
m_parent = parent;
m_jniThread = thread;
m_jniGamePtr = thread.getGamePtr();
@ -339,7 +340,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
public void dimsChanged( BoardDims dims )
{
DbgUtils.logdf( "BoardView.dimsChanged(%s)", dims.toString() );
DbgUtils.logd( getClass(), "dimsChanged(%s)", dims.toString() );
m_dims = dims;
m_parent.runOnUiThread( new Runnable() {
public void run()
@ -404,7 +405,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
private void handle( JNIThread.JNICmd cmd, Object... args )
{
if ( null == m_jniThread ) {
DbgUtils.logf( "BoardView: not calling handle(%s)", cmd.toString() );
DbgUtils.logw( getClass(), "not calling handle(%s)", cmd.toString() );
DbgUtils.printStack();
} else {
m_jniThread.handle( cmd, args );

View file

@ -129,7 +129,7 @@ public class ChatDelegate extends DelegateBase {
super.onResume();
m_jniThreadRef = JNIThread.getRetained( m_rowid );
if ( null == m_jniThreadRef ) {
DbgUtils.logf( "ChatDelegate.onResume(): m_jniThreadRef null; exiting" );
DbgUtils.logw( getClass(), "onResume(): m_jniThreadRef null; exiting" );
finish();
} else {
s_visibleThis = this;

View file

@ -94,9 +94,9 @@ public class CommsTransport implements TransportProcs,
closeSocket();
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
} catch ( UnresolvedAddressException uae ) {
DbgUtils.logf( "bad address: name: %s; port: %s; exception: %s",
DbgUtils.logw( getClass(), "bad address: name: %s; port: %s; exception: %s",
m_useHost, m_relayAddr.ip_relay_port,
uae.toString() );
}
@ -124,7 +124,7 @@ public class CommsTransport implements TransportProcs,
try {
m_socketChannel = SocketChannel.open();
m_socketChannel.configureBlocking( false );
DbgUtils.logf( "connecting to %s:%d",
DbgUtils.logi( getClass(), "connecting to %s:%d",
m_useHost,
m_relayAddr.ip_relay_port );
InetSocketAddress isa = new
@ -132,7 +132,7 @@ public class CommsTransport implements TransportProcs,
m_relayAddr.ip_relay_port );
m_socketChannel.connect( isa );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
failed = true;
break outer_loop;
}
@ -149,14 +149,14 @@ public class CommsTransport implements TransportProcs,
// we get this when relay goes down. Need to notify!
failed = true;
closeSocket();
DbgUtils.logf( "exiting: %s", cce.toString() );
DbgUtils.logw( getClass(), "exiting: %s", cce.toString() );
break; // don't try again
} catch ( java.io.IOException ioe ) {
closeSocket();
DbgUtils.logf( "exiting: %s", ioe.toString() );
DbgUtils.logf( ioe.toString() );
DbgUtils.logw( getClass(), "exiting: %s", ioe.toString() );
DbgUtils.logw( getClass(), ioe.toString() );
} catch ( java.nio.channels.NoConnectionPendingException ncp ) {
DbgUtils.loge( ncp );
DbgUtils.logex( ncp );
closeSocket();
break;
}
@ -198,13 +198,13 @@ public class CommsTransport implements TransportProcs,
}
}
} catch ( java.io.IOException ioe ) {
DbgUtils.logf( "%s: cancelling key", ioe.toString() );
DbgUtils.logw( getClass(), "%s: cancelling key", ioe.toString() );
key.cancel();
failed = true;
break outer_loop;
} catch ( java.nio.channels.
NoConnectionPendingException ncp ) {
DbgUtils.loge( ncp );
DbgUtils.logex( ncp );
break outer_loop;
}
}
@ -260,7 +260,7 @@ public class CommsTransport implements TransportProcs,
try {
m_socketChannel.close();
} catch ( Exception e ) {
DbgUtils.logf( "closing socket: %s", e.toString() );
DbgUtils.logw( getClass(), "closing socket: %s", e.toString() );
}
m_socketChannel = null;
}
@ -341,7 +341,7 @@ public class CommsTransport implements TransportProcs,
try {
m_thread.join(100); // wait up to 1/10 second
} catch ( java.lang.InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
}
m_thread = null;
}
@ -355,8 +355,8 @@ public class CommsTransport implements TransportProcs,
public int transportSend( byte[] buf, String msgNo, CommsAddrRec addr,
CommsConnType conType, int gameID )
{
DbgUtils.logdf( "CommsTransport.transportSend(len=%d, typ=%s)",
buf.length, conType.toString() );
DbgUtils.logd( getClass(), "transportSend(len=%d, typ=%s)",
buf.length, conType.toString() );
int nSent = -1;
Assert.assertNotNull( addr );
Assert.assertTrue( addr.contains( conType ) );
@ -384,13 +384,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.logdf( "transportSend(%d)=>%d", buf.length, nSent );
DbgUtils.logd( getClass(), "transportSend(%d)=>%d", buf.length, nSent );
return nSent;
}
public void relayStatus( CommsRelayState newState )
{
DbgUtils.logf( "relayStatus called; state=%s", newState.toString() );
DbgUtils.logi( getClass(), "relayStatus called; state=%s", newState.toString() );
switch( newState ) {
case COMMS_RELAYSTATE_UNCONNECTED:

View file

@ -391,7 +391,7 @@ public class ConnStatusHandler {
// } catch ( java.lang.ClassNotFoundException cnfe ) {
// DbgUtils.logf( "loadState: %s", cnfe.toString() );
} catch ( Exception ex ) {
DbgUtils.loge( ex );
DbgUtils.logex( ex );
}
}
}
@ -510,7 +510,7 @@ public class ConnStatusHandler {
XWPrefs.setPrefsString( context, R.string.key_connstat_data,
as64 );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
s_needsSave = false;
}
@ -546,7 +546,7 @@ public class ConnStatusHandler {
&& NetStateCache.netAvail( context );
break;
default:
DbgUtils.logf( "ConnStatusHandler:connTypeEnabled: %s not handled",
DbgUtils.logw( ConnStatusHandler.class, "connTypeEnabled: %s not handled",
connType.toString() );
break;
}

View file

@ -259,7 +259,8 @@ public class DBHelper extends SQLiteOpenHelper {
@SuppressWarnings("fallthrough")
public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion )
{
DbgUtils.logf( false, "onUpgrade: old: %d; new: %d", oldVersion, newVersion );
DbgUtils.logi( getClass(), false, "onUpgrade: old: %d; new: %d",
oldVersion, newVersion );
boolean madeSumTable = false;
switch( oldVersion ) {

View file

@ -787,7 +787,7 @@ public class DBUtils {
db.close();
}
if ( null != result && 1 < result.length ) {
DbgUtils.logf( "getRowIDsFor(%x)=>length %d array", gameID,
DbgUtils.logi( DBUtils.class, "getRowIDsFor(%x)=>length %d array", gameID,
result.length );
}
return result;
@ -835,7 +835,7 @@ public class DBUtils {
int gameID = cursor.getInt( col );
col = cursor.getColumnIndex( DBHelper.REMOTEDEVS );
String devs = cursor.getString( col );
DbgUtils.logf( "gameid %d has remote[s] %s", gameID, devs );
DbgUtils.logi( DBUtils.class, "gameid %d has remote[s] %s", gameID, devs );
if ( null != devs && 0 < devs.length() ) {
for ( String dev : TextUtils.split( devs, "\n" ) ) {
@ -951,7 +951,7 @@ public class DBUtils {
long result = db.replaceOrThrow( DBHelper.TABLE_NAME_OBITS,
"", values );
} catch ( Exception ex ) {
DbgUtils.loge( ex );
DbgUtils.logex( ex );
}
db.close();
}
@ -1086,7 +1086,7 @@ public class DBUtils {
result = cursor.getBlob( cursor
.getColumnIndex(DBHelper.SNAPSHOT));
} else {
DbgUtils.logf( "DBUtils.loadGame: none for rowid=%d",
DbgUtils.loge( DBUtils.class, "loadGame: none for rowid=%d",
rowid );
}
cursor.close();
@ -1104,7 +1104,7 @@ public class DBUtils {
deleteGame( context, lock );
lock.unlock();
} else {
DbgUtils.logf( "deleteGame: unable to lock rowid %d", rowid );
DbgUtils.loge( DBUtils.class, "deleteGame: unable to lock rowid %d", rowid );
if ( BuildConfig.DEBUG ) {
Assert.fail();
}
@ -1195,15 +1195,15 @@ public class DBUtils {
HistoryPair[] result = null;
String oldHistory = getChatHistoryStr( context, rowid );
if ( null != oldHistory ) {
DbgUtils.logdf( "convertChatString(): got string: %s", oldHistory );
DbgUtils.logd( DBUtils.class, "convertChatString(): got string: %s", oldHistory );
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
ArrayList<HistoryPair> pairs = new ArrayList<HistoryPair>();
String localPrefix = LocUtils.getString( context, R.string.chat_local_id );
String rmtPrefix = LocUtils.getString( context, R.string.chat_other_id );
DbgUtils.logdf( "convertChatString(): prefixes: \"%s\" and \"%s\"", localPrefix, rmtPrefix );
DbgUtils.logd( DBUtils.class, "convertChatString(): prefixes: \"%s\" and \"%s\"", localPrefix, rmtPrefix );
String[] msgs = oldHistory.split( "\n" );
DbgUtils.logdf( "convertChatString(): split into %d", msgs.length );
DbgUtils.logd( DBUtils.class, "convertChatString(): split into %d", msgs.length );
int localPlayerIndx = -1;
int remotePlayerIndx = -1;
for ( int ii = playersLocal.length - 1; ii >= 0; --ii ) {
@ -1214,24 +1214,24 @@ public class DBUtils {
}
}
for ( String msg : msgs ) {
DbgUtils.logdf( "convertChatString(): msg: %s", msg );
DbgUtils.logd( DBUtils.class, "convertChatString(): msg: %s", msg );
int indx = -1;
String prefix = null;
if ( msg.startsWith( localPrefix ) ) {
DbgUtils.logdf( "convertChatString(): msg: %s starts with %s", msg, localPrefix );
DbgUtils.logd( DBUtils.class, "convertChatString(): msg: %s starts with %s", msg, localPrefix );
prefix = localPrefix;
indx = localPlayerIndx;
} else if ( msg.startsWith( rmtPrefix ) ) {
DbgUtils.logdf( "convertChatString(): msg: %s starts with %s", msg, rmtPrefix );
DbgUtils.logd( DBUtils.class, "convertChatString(): msg: %s starts with %s", msg, rmtPrefix );
prefix = rmtPrefix;
indx = remotePlayerIndx;
} else {
DbgUtils.logdf( "convertChatString(): msg: %s starts with neither", msg );
DbgUtils.logd( DBUtils.class, "convertChatString(): msg: %s starts with neither", msg );
}
if ( -1 != indx ) {
DbgUtils.logdf( "convertChatString(): removing substring %s; was: %s", prefix, msg );
DbgUtils.logd( DBUtils.class, "convertChatString(): removing substring %s; was: %s", prefix, msg );
msg = msg.substring( prefix.length(), msg.length() );
DbgUtils.logdf( "convertChatString(): removED substring; now %s", msg );
DbgUtils.logd( DBUtils.class, "convertChatString(): removED substring; now %s", msg );
valuess.add( cvForChat( rowid, msg, indx ) );
HistoryPair pair = new HistoryPair(msg, indx );
@ -1301,8 +1301,8 @@ public class DBUtils {
startAndEndOut[1] = Math.min( result.length(),
Integer.parseInt( parts[1] ) );
}
DbgUtils.logdf( "getCurChat(): => %s [%d,%d]", result,
startAndEndOut[0], startAndEndOut[1] );
DbgUtils.logd( DBUtils.class, "getCurChat(): => %s [%d,%d]", result,
startAndEndOut[0], startAndEndOut[1] );
return result;
}
@ -1823,7 +1823,7 @@ public class DBUtils {
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
valuess.add( cvForChat( rowid, msg, fromPlayer ) );
appendChatHistory( context, valuess );
DbgUtils.logf( "appendChatHistory: inserted \"%s\" from player %d",
DbgUtils.logi( DBUtils.class, "appendChatHistory: inserted \"%s\" from player %d",
msg, fromPlayer );
} // appendChatHistory
@ -1884,13 +1884,13 @@ public class DBUtils {
channelSrc.transferTo( 0, channelSrc.size(), channelDest );
success = true;
} catch( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
} finally {
try {
channelSrc.close();
channelDest.close();
} catch( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
return success;
@ -2248,7 +2248,7 @@ public class DBUtils {
try {
updateStmt.execute();
} catch ( Exception ex ) {
DbgUtils.loge( ex );
DbgUtils.logex( ex );
Assert.fail();
}
}
@ -2475,7 +2475,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.logf( false, "appendLog(): deleted %d rows", nGone );
DbgUtils.logi( DBUtils.class, false, "appendLog(): deleted %d rows", nGone );
}
db.close();
}
@ -2506,7 +2506,7 @@ public class DBUtils {
invalGroupsCache();
}
} catch( java.io.FileNotFoundException fnfe ) {
DbgUtils.loge( fnfe );
DbgUtils.logex( fnfe );
}
}
@ -2550,7 +2550,7 @@ public class DBUtils {
int result = updateRowImpl( db, table, rowid, values );
db.close();
if ( 0 == result ) {
DbgUtils.logf( "updateRow failed" );
DbgUtils.logw( DBUtils.class, "updateRow failed" );
}
}
}

View file

@ -38,6 +38,8 @@ public class DbgUtils {
private static final String TAG = BuildConstants.DBG_TAG;
private static boolean s_doLog = BuildConfig.DEBUG;
private enum LogType { ERROR, WARN, DEBUG, INFO };
private static Time s_time = new Time();
public static void logEnable( boolean enable )
@ -52,50 +54,43 @@ public class DbgUtils {
logEnable( on );
}
public static void logf( String msg )
{
logf( true, msg );
}
public static void logf( boolean persist, String msg )
private static void callLog( LogType lt, Class claz, String fmt, Object... args )
{
if ( s_doLog ) {
String time = "";
// No need for timestamp on marshmallow, as the OS provides it
if ( true /*Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1*/ ) {
s_time.setToNow();
time = s_time.format("[%H:%M:%S]-");
}
long id = Thread.currentThread().getId();
msg = time + id + "-" + msg;
Log.d( TAG, msg );
if ( persist && BuildConfig.DEBUG ) {
DBUtils.appendLog( TAG, msg );
String tag = claz.getSimpleName();
String msg = new Formatter().format( fmt, args ).toString();
switch( lt ) {
case DEBUG:
Log.d( tag, msg );
break;
}
}
} // logf
public static void logf( String format, Object... args )
{
logf( true, format, args );
}
public static void logf( boolean persist, String format, Object... args )
public static void logd( Class claz, String fmt, Object... args )
{
if ( s_doLog ) {
Formatter formatter = new Formatter();
logf( persist, formatter.format( format, args ).toString() );
}
} // logf
callLog( LogType.DEBUG, claz, fmt, args );
}
public static void logdf( String format, Object... args )
public static void loge( Class claz, String fmt, Object... args )
{
if ( s_doLog && BuildConfig.DEBUG ) {
Formatter formatter = new Formatter();
logf( formatter.format( format, args ).toString() );
}
} // logdf
callLog( LogType.ERROR, claz, fmt, args );
}
public static void logi( Class claz, String fmt, Object... args )
{
logi( claz, true, fmt, args );
}
public static void logi( Class claz, boolean persist, String fmt, Object... args )
{
callLog( LogType.INFO, claz, fmt, args );
}
public static void logw( Class claz, String fmt, Object... args )
{
callLog( LogType.WARN, claz, fmt, args );
}
public static void showf( Context context, String format, Object... args )
{
@ -109,9 +104,9 @@ public class DbgUtils {
showf( context, LocUtils.getString( context, formatid ), args );
} // showf
public static void loge( Exception exception )
public static void logex( Exception exception )
{
logf( "Exception: %s", exception.toString() );
logw( DbgUtils.class, "Exception: %s", exception.toString() );
printStack( exception.getStackTrace() );
}
@ -125,7 +120,7 @@ public class DbgUtils {
if ( s_doLog && null != trace ) {
// 2: skip printStack etc.
for ( int ii = 2; ii < trace.length; ++ii ) {
DbgUtils.logf( "ste %d: %s", ii, trace[ii].toString() );
DbgUtils.logi( DbgUtils.class, "ste %d: %s", ii, trace[ii].toString() );
}
}
}
@ -157,7 +152,7 @@ public class DbgUtils {
{
if ( s_doLog ) {
String dump = DatabaseUtils.dumpCursorToString( cursor );
logf( "cursor: %s", dump );
logi( DbgUtils.class, "cursor: %s", dump );
}
}

View file

@ -118,16 +118,14 @@ public class DelegateBase implements DlgClickNotify,
protected void onActivityResult( RequestCode requestCode, int resultCode,
Intent data )
{
DbgUtils.logf( "%s.onActivityResult(): subclass responsibility!!!",
getClass().getSimpleName() );
DbgUtils.logi( getClass(), "onActivityResult(): subclass responsibility!!!" );
}
protected void onStart()
{
Class clazz = getClass();
if ( s_instances.containsKey( clazz ) ) {
DbgUtils.logdf( "%s.onStart(): replacing curThis",
clazz.getSimpleName() );
DbgUtils.logd( getClass(), "onStart(): replacing curThis" );
}
s_instances.put( clazz, new WeakReference<DelegateBase>(this) );
}
@ -162,7 +160,7 @@ public class DelegateBase implements DlgClickNotify,
result = ref.get();
}
if ( this != result ) {
DbgUtils.logdf( "%s.curThis() => " + result, this.toString() );
DbgUtils.logd( getClass(), "%s.curThis() => " + result, this.toString() );
}
return result;
}
@ -424,7 +422,7 @@ public class DelegateBase implements DlgClickNotify,
try {
m_activity.dismissDialog( dlgID.ordinal() );
} catch ( Exception ex ) {
// DbgUtils.loge( ex );
// DbgUtils.logex( ex );
}
}
@ -572,14 +570,13 @@ public class DelegateBase implements DlgClickNotify,
protected boolean canHandleNewIntent( Intent intent )
{
DbgUtils.logdf( "%s.canHandleNewIntent() => false",
getClass().getSimpleName(), intent.toString() );
DbgUtils.logd( getClass(), "canHandleNewIntent() => false" );
return false;
}
protected void handleNewIntent( Intent intent ) {
DbgUtils.logdf( "%s.handleNewIntent(%s): not handling",
getClass().getSimpleName(), intent.toString() );
DbgUtils.logd( getClass(), "handleNewIntent(%s): not handling",
intent.toString() );
}
protected void runWhenActive( Runnable proc )
@ -597,7 +594,7 @@ public class DelegateBase implements DlgClickNotify,
switch( event ) {
case BT_ERR_COUNT:
int count = (Integer)args[0];
DbgUtils.logf( "Bluetooth error count: %d", count );
DbgUtils.logi( getClass(), "Bluetooth error count: %d", count );
break;
case BAD_PROTO_BT:
fmtId = R.string.bt_bad_proto_fmt;
@ -612,8 +609,8 @@ public class DelegateBase implements DlgClickNotify,
m_dlgDelegate.eventOccurred( event, args );
break;
default:
DbgUtils.logdf( "DelegateBase.eventOccurred(event=%s) (DROPPED)",
event.toString() );
DbgUtils.logd( getClass(), "eventOccurred(event=%s) (DROPPED)",
event.toString() );
break;
}
@ -674,7 +671,7 @@ public class DelegateBase implements DlgClickNotify,
Assert.fail();
break;
}
DbgUtils.logf( "DelegateBase.dlgButtonClicked(action=%s button=%s): UNHANDLED",
DbgUtils.logi( getClass(), "dlgButtonClicked(action=%s button=%s): UNHANDLED",
action.toString(), buttonName );
}
}

View file

@ -84,18 +84,18 @@ public class DevID {
s_relayDevID = asStr;
}
}
DbgUtils.logdf( "DevID.getRelayDevID() => %s", s_relayDevID );
DbgUtils.logd( DevID.class, "getRelayDevID() => %s", s_relayDevID );
return s_relayDevID;
}
public static void setRelayDevID( Context context, String devID )
{
DbgUtils.logdf( "DevID.setRelayDevID()" );
DbgUtils.logd( DevID.class, "setRelayDevID()" );
if ( BuildConfig.DEBUG ) {
String oldID = getRelayDevID( context );
if ( null != oldID && 0 < oldID.length()
&& ! devID.equals( oldID ) ) {
DbgUtils.logdf( "devID changing!!!: %s => %s", oldID, devID );
DbgUtils.logd( DevID.class, "devID changing!!!: %s => %s", oldID, devID );
}
}
DBUtils.setStringFor( context, DEVID_KEY, devID );
@ -107,7 +107,7 @@ public class DevID {
public static void clearRelayDevID( Context context )
{
DbgUtils.logf( "DevID.clearRelayDevID()" );
DbgUtils.logi( DevID.class, "clearRelayDevID()" );
DBUtils.setStringFor( context, DEVID_KEY, "" );
// DbgUtils.printStack();
}

View file

@ -258,7 +258,7 @@ public class DictBrowseDelegate extends DelegateBase
try {
super.finalize();
} catch ( java.lang.Throwable err ){
DbgUtils.logf( "%s", err.toString() );
DbgUtils.logi( getClass(), "%s", err.toString() );
}
}
@ -453,7 +453,7 @@ public class DictBrowseDelegate extends DelegateBase
DictUtils.DictLoc loc
= DictUtils.getDictLoc( delegator.getActivity(), name );
if ( null == loc ) {
DbgUtils.logf( "DictBrowseDelegate.launch(): DictLoc null; try again?" );
DbgUtils.logw( DictBrowseDelegate.class, "launch(): DictLoc null; try again?" );
} else {
launch( delegator, name, loc );
}

View file

@ -361,7 +361,7 @@ public class DictLangCache {
for ( DictAndLoc dal : dals ) {
String name = getLangName( context, dal.name );
if ( null == name || 0 == name.length() ) {
DbgUtils.logf( "bad lang name for dal name %s", dal.name );
DbgUtils.logw( DictLangCache.class, "bad lang name for dal name %s", dal.name );
// Assert.fail();
}
langs.add( name );
@ -473,7 +473,7 @@ public class DictLangCache {
// Tmp test that recovers from problem with new background download code
if ( null != info && 0 == info.langCode ) {
DbgUtils.logf( "getInfo: dropping info for %s b/c lang code wrong",
DbgUtils.logw( DictLangCache.class, "getInfo: dropping info for %s b/c lang code wrong",
dal.name );
info = null;
}
@ -493,10 +493,10 @@ public class DictLangCache {
DBUtils.dictsSetInfo( context, dal, info );
} else {
info = null;
DbgUtils.logf( "getInfo(): unable to open dict %s", dal.name );
DbgUtils.logi( DictLangCache.class,
"getInfo(): unable to open dict %s", dal.name );
}
}
return info;
}
}

View file

@ -192,9 +192,9 @@ public class DictUtils {
fis.close();
loc = DictLoc.INTERNAL;
} catch ( java.io.FileNotFoundException fnf ) {
// DbgUtils.loge( fnf );
// DbgUtils.logex( fnf );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -263,7 +263,7 @@ public class DictUtils {
success = DBUtils.copyFileStream( fos, fis );
} catch ( java.io.FileNotFoundException fnfe ) {
DbgUtils.loge( fnfe );
DbgUtils.logex( fnfe );
}
return success;
} // copyDict
@ -360,11 +360,11 @@ public class DictUtils {
bytes = new byte[len];
fis.read( bytes, 0, len );
fis.close();
DbgUtils.logf( "Successfully loaded %s", name );
DbgUtils.logi( DictUtils.class, "Successfully loaded %s", name );
} catch ( java.io.FileNotFoundException fnf ) {
// DbgUtils.loge( fnf );
// DbgUtils.logex( fnf );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -477,9 +477,9 @@ public class DictUtils {
invalDictList();
}
} catch ( java.io.FileNotFoundException fnf ) {
DbgUtils.loge( fnf );
DbgUtils.logex( fnf );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
tmpFile.delete();
}
}
@ -564,7 +564,7 @@ public class DictUtils {
AssetManager am = context.getAssets();
return am.list("");
} catch( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
return new String[0];
}
}
@ -589,7 +589,7 @@ public class DictUtils {
if ( !result.exists() ) {
result.mkdirs();
if ( !result.exists() ) {
DbgUtils.logf( "unable to create sd dir %s", packdir );
DbgUtils.logw( DictUtils.class, "unable to create sd dir %s", packdir );
result = null;
}
}

View file

@ -329,7 +329,7 @@ public class DictsDelegate extends ListDelegateBase
}
}
} else {
DbgUtils.logf( "No remote info for lang %s", langName );
DbgUtils.logw( getClass(), "No remote info for lang %s", langName );
}
}
@ -383,7 +383,7 @@ public class DictsDelegate extends ListDelegateBase
DictLoc fromLoc = (DictLoc)selItem.getCached();
String name = selItem.getText();
if ( fromLoc == toLoc ) {
DbgUtils.logf( "not moving %s: same loc", name );
DbgUtils.logw( getClass(), "not moving %s: same loc", name );
} else if ( DictUtils.moveDict( self.m_activity,
name, fromLoc,
toLoc ) ) {
@ -393,7 +393,7 @@ public class DictsDelegate extends ListDelegateBase
DBUtils.dictsMoveInfo( self.m_activity, name,
fromLoc, toLoc );
} else {
DbgUtils.logf( "moveDict(%s) failed", name );
DbgUtils.logw( getClass(), "moveDict(%s) failed", name );
}
}
}
@ -851,7 +851,7 @@ public class DictsDelegate extends ListDelegateBase
//////////////////////////////////////////////////////////////////////
public void cardMounted( boolean nowMounted )
{
DbgUtils.logf( "DictsActivity.cardMounted(%b)", nowMounted );
DbgUtils.logi( getClass(), "cardMounted(%b)", nowMounted );
// post so other SDCardNotifiee implementations get a chance
// to process first: avoid race conditions
post( new Runnable() {
@ -986,7 +986,7 @@ public class DictsDelegate extends ListDelegateBase
Assert.fail();
}
}
DbgUtils.logf( "countSelDicts() => {loc: %d; remote: %d}",
DbgUtils.logi( getClass(), "countSelDicts() => {loc: %d; remote: %d}",
results[SEL_LOCAL], results[SEL_REMOTE] );
return results;
}
@ -1149,7 +1149,7 @@ public class DictsDelegate extends ListDelegateBase
public void itemClicked( SelectableItem.LongClickHandler clicked,
GameSummary summary )
{
DbgUtils.logf( "itemClicked not implemented" );
DbgUtils.logi( getClass(), "itemClicked not implemented" );
}
public void itemToggled( SelectableItem.LongClickHandler toggled,
@ -1242,7 +1242,7 @@ public class DictsDelegate extends ListDelegateBase
}
} catch ( JSONException ex ) {
DbgUtils.loge( ex );
DbgUtils.logex( ex );
theOne = null;
}
}
@ -1340,7 +1340,7 @@ public class DictsDelegate extends ListDelegateBase
new HashSet<String>( Arrays.asList( m_langs ) );
// DictLangCache hits the DB hundreds of times below. Fix!
DbgUtils.logf( "Fix me I'm stupid" );
DbgUtils.logw( getClass(), "Fix me I'm stupid" );
try {
// DbgUtils.logf( "data: %s", jsonData );
JSONObject obj = new JSONObject( jsonData );
@ -1422,7 +1422,7 @@ public class DictsDelegate extends ListDelegateBase
success = true;
} catch ( JSONException ex ) {
DbgUtils.loge( ex );
DbgUtils.logex( ex );
}
}

View file

@ -582,7 +582,7 @@ public class DlgDelegate {
break;
default:
DbgUtils.logf( "eventOccurred: unhandled event %s", event.toString() );
DbgUtils.loge( getClass(), "eventOccurred: unhandled event %s", event.toString() );
}
if ( null != msg ) {
@ -994,8 +994,8 @@ public class DlgDelegate {
if ( null == oneBase ) {
iter.remove(); // no point in keeping it
} else if ( base.equals( oneBase ) ) {
DbgUtils.logdf( "removing alert %s for %s", dlgID.toString(),
oneBase.toString() );
DbgUtils.logd( DlgDelegate.class, "removing alert %s for %s", dlgID.toString(),
oneBase.toString() );
activity.removeDialog( dlgID.ordinal() );
iter.remove(); // no point in keeping this either
}

View file

@ -60,7 +60,7 @@ public class DualpaneDelegate extends DelegateBase {
{
MainActivity main = (MainActivity)m_activity;
main.dispatchNewIntent( intent );
DbgUtils.logf( "DualpaneDelegate.handleNewIntent()" );
DbgUtils.logi( getClass(), "handleNewIntent()" );
}
@Override
@ -68,7 +68,7 @@ public class DualpaneDelegate extends DelegateBase {
{
MainActivity main = (MainActivity)m_activity;
boolean handled = main.dispatchBackPressed();
DbgUtils.logf( "DualpaneDelegate.handleBackPressed() => %b", handled );
DbgUtils.logi( getClass(), "handleBackPressed() => %b", handled );
return handled;
}

View file

@ -137,11 +137,11 @@ public class DwnldDelegate extends ListDelegateBase {
}
is.close();
} catch ( java.net.URISyntaxException use ) {
DbgUtils.loge( use );
DbgUtils.logex( use );
} catch ( java.net.MalformedURLException mue ) {
DbgUtils.loge( mue );
DbgUtils.logex( mue );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
return null;
}
@ -217,9 +217,9 @@ public class DwnldDelegate extends ListDelegateBase {
fos.close();
success = !cancelled;
} catch ( java.io.FileNotFoundException fnf ) {
DbgUtils.loge( fnf );
DbgUtils.logex( fnf );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
if ( !success ) {

View file

@ -91,8 +91,8 @@ public class ExpiringDelegate {
}
}
DbgUtils.logdf( "ExpUpdater: ref had %d refs, now has %d expiringdelegate views",
sizeBefore, dlgts.size() );
DbgUtils.logd( getClass(), "ref had %d refs, now has %d expiringdelegate views",
sizeBefore, dlgts.size() );
for ( ExpiringDelegate dlgt : dlgts ) {
dlgt.timerFired();
@ -120,7 +120,7 @@ public class ExpiringDelegate {
private void setHandler( Handler handler )
{
if ( handler != m_handler ) {
DbgUtils.logdf( "handler changing from %H to %H",
DbgUtils.logd( getClass(), "handler changing from %H to %H",
m_handler, handler );
m_handler = handler;
reschedule();

View file

@ -39,13 +39,13 @@ public class GCMIntentService extends GCMBaseIntentService {
@Override
protected void onError( Context context, String error )
{
DbgUtils.logdf("GCMIntentService.onError(%s)", error );
DbgUtils.logd( getClass(), "onError(%s)", error );
}
@Override
protected void onRegistered( Context context, String regId )
{
DbgUtils.logdf( "GCMIntentService.onRegistered(%s)", regId );
DbgUtils.logd( getClass(), "onRegistered(%s)", regId );
DevID.setGCMDevID( context, regId );
notifyRelayService( context, true );
}
@ -53,7 +53,7 @@ public class GCMIntentService extends GCMBaseIntentService {
@Override
protected void onUnregistered( Context context, String regId )
{
DbgUtils.logdf( "GCMIntentService.onUnregistered(%s)", regId );
DbgUtils.logd( getClass(), "onUnregistered(%s)", regId );
DevID.clearGCMDevID( context );
RelayService.devIDChanged();
notifyRelayService( context, false );
@ -62,13 +62,13 @@ public class GCMIntentService extends GCMBaseIntentService {
@Override
protected void onMessage( Context context, Intent intent )
{
DbgUtils.logdf( "GCMIntentService.onMessage()" );
DbgUtils.logd( getClass(), "onMessage()" );
notifyRelayService( context, true );
String value;
boolean ignoreIt = XWApp.GCM_IGNORED;
if ( ignoreIt ) {
DbgUtils.logdf( "received GCM but ignoring it" );
DbgUtils.logd( getClass(), "received GCM but ignoring it" );
} else {
value = intent.getStringExtra( "checkUpdates" );
if ( null != value && Boolean.parseBoolean( value ) ) {
@ -95,7 +95,7 @@ public class GCMIntentService extends GCMBaseIntentService {
RelayService.processGameMsgs( context, connname, strs64 );
}
} catch (org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
}
@ -129,10 +129,10 @@ public class GCMIntentService extends GCMBaseIntentService {
GCMRegistrar.register( app, BuildConstants.GCM_SENDER_ID );
}
} catch ( UnsupportedOperationException uoe ) {
DbgUtils.logf( "Device can't do GCM." );
DbgUtils.logw( GCMIntentService.class, "Device can't do GCM." );
} catch ( Exception whatever ) {
// funky devices could do anything
DbgUtils.loge( whatever );
DbgUtils.logex( whatever );
}
}
}

View file

@ -229,7 +229,7 @@ public class GameConfigDelegate extends DelegateBase
self.showToast( R.string.forced_consistent );
self.loadPlayersList();
} else {
DbgUtils.logf( "GameConfigDelegate.onDismiss(): "
DbgUtils.logw( getClass(), "onDismiss(): "
+ "no visible self" );
}
}
@ -774,14 +774,13 @@ public class GameConfigDelegate extends DelegateBase
}
} else {
DbgUtils.logf( "unknown v: " + view.toString() );
DbgUtils.logw( getClass(), "unknown v: " + view.toString() );
}
} // onClick
private void saveAndClose( boolean forceNew )
{
DbgUtils.logf( "GameConfigDelegate.saveAndClose(forceNew=%b)",
forceNew );
DbgUtils.logi( getClass(), "saveAndClose(forceNew=%b)", forceNew );
applyChanges( forceNew );
finishAndLaunch();
@ -1031,7 +1030,7 @@ public class GameConfigDelegate extends DelegateBase
setting = 2;
break;
default:
DbgUtils.logf( "setSmartnessSpinner got %d from getRobotSmartness()",
DbgUtils.logw( getClass(), "setSmartnessSpinner got %d from getRobotSmartness()",
m_gi.getRobotSmartness() );
Assert.fail();
}
@ -1073,7 +1072,7 @@ public class GameConfigDelegate extends DelegateBase
private void adjustPlayersLabel()
{
DbgUtils.logf( "adjustPlayersLabel()" );
DbgUtils.logi( getClass(), "adjustPlayersLabel()" );
String label;
if ( localOnlyGame() ) {
label = getString( R.string.players_label_standalone );

View file

@ -455,7 +455,7 @@ public class GameListItem extends LinearLayout
try {
elem = s_queue.take();
} catch ( InterruptedException ie ) {
DbgUtils.logf( "interrupted; killing "
DbgUtils.logw( getClass(), "interrupted; killing "
+ "s_thumbThread" );
break;
}

View file

@ -55,7 +55,7 @@ public class GameLock {
m_isForWrite = isForWrite;
m_lockCount = 0;
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "GameLock.GameLock(rowid:%d,isForWrite:%b)=>"
DbgUtils.logi( getClass(), "GameLock(rowid:%d,isForWrite:%b)=>"
+ "this: %H", rowid, isForWrite, this );
DbgUtils.printStack();
}
@ -91,19 +91,19 @@ public class GameLock {
}
} else if ( this == owner && ! m_isForWrite ) {
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "tryLock(): incrementing lock count" );
DbgUtils.logi( getClass(), "tryLock(): incrementing lock count" );
}
Assert.assertTrue( 0 == m_lockCount );
++m_lockCount;
gotIt = true;
owner = null;
} else if ( DEBUG_LOCKS ) {
DbgUtils.logf( "tryLock(): rowid %d already held by lock %H",
DbgUtils.logi( getClass(), "tryLock(): rowid %d already held by lock %H",
m_rowid, owner );
}
}
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "GameLock.tryLock %H (rowid=%d) => %b",
DbgUtils.logi( getClass(), "tryLock %H (rowid=%d) => %b",
this, m_rowid, gotIt );
}
return owner;
@ -124,7 +124,7 @@ public class GameLock {
long sleptTime = 0;
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "lock %H (rowid:%d, maxMillis=%d)", this, m_rowid,
DbgUtils.logi( getClass(), "lock %H (rowid:%d, maxMillis=%d)", this, m_rowid,
maxMillis );
}
@ -135,11 +135,11 @@ public class GameLock {
break;
}
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "GameLock.lock() %H failed; sleeping", this );
DbgUtils.logi( getClass(), "lock() %H failed; sleeping", this );
if ( 0 == sleptTime || sleptTime + SLEEP_TIME >= ASSERT_TIME ) {
DbgUtils.logf( "lock %H seeking stack:", curOwner );
DbgUtils.logi( getClass(), "lock %H seeking stack:", curOwner );
DbgUtils.printStack( curOwner.m_lockTrace );
DbgUtils.logf( "lock %H seeking stack:", this );
DbgUtils.logi( getClass(), "lock %H seeking stack:", this );
DbgUtils.printStack();
}
}
@ -147,12 +147,12 @@ public class GameLock {
Thread.sleep( SLEEP_TIME ); // milliseconds
sleptTime += SLEEP_TIME;
} catch( InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
break;
}
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "GameLock.lock() %H awake; "
DbgUtils.logi( getClass(), "lock() %H awake; "
+ "sleptTime now %d millis", this, sleptTime );
}
@ -162,7 +162,7 @@ public class GameLock {
throw new GameLockedException();
} else if ( sleptTime >= ASSERT_TIME ) {
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "lock %H overlocked", this );
DbgUtils.logi( getClass(), "lock %H overlocked", this );
}
Assert.fail();
}
@ -188,7 +188,7 @@ public class GameLock {
--m_lockCount;
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "GameLock.unlock: this: %H (rowid:%d) unlocked",
DbgUtils.logi( getClass(), "unlock: this: %H (rowid:%d) unlocked",
this, m_rowid );
}
}
@ -204,7 +204,7 @@ public class GameLock {
{
boolean result = m_isForWrite && 1 == m_lockCount;
if ( !result ) {
DbgUtils.logf( "GameLock.canWrite(): %H, returning false", this );
DbgUtils.logw( getClass(), "canWrite(): %H, returning false", this );
}
return result;
}

View file

@ -72,8 +72,7 @@ public class GameUtils {
public static class NoSuchGameException extends RuntimeException {
public NoSuchGameException() {
super(); // superfluous
DbgUtils.logf( "creating NoSuchGameException");
DbgUtils.logi( getClass(), "NoSuchGameException()");
}
}
@ -168,7 +167,7 @@ public class GameUtils {
Utils.cancelNotification( context, (int)rowidIn );
success = true;
} else {
DbgUtils.logf( "resetGame: unable to open rowid %d", rowidIn );
DbgUtils.logw( GameUtils.class, "resetGame: unable to open rowid %d", rowidIn );
}
return success;
}
@ -225,7 +224,7 @@ public class GameUtils {
try {
lock = new GameLock( rowid, false ).lock( maxMillis );
} catch ( GameLock.GameLockedException gle ) {
DbgUtils.loge( gle );
DbgUtils.logex( gle );
}
}
@ -269,7 +268,8 @@ public class GameUtils {
lockSrc.unlock();
}
} else {
DbgUtils.logdf( "dupeGame: unable to open rowid %d", rowidIn );
DbgUtils.logd( GameUtils.class, "dupeGame: unable to open rowid %d",
rowidIn );
}
return rowid;
}
@ -292,7 +292,7 @@ public class GameUtils {
lock.unlock();
success = true;
} else {
DbgUtils.logf( "deleteGame: unable to delete rowid %d", rowid );
DbgUtils.logw( GameUtils.class, "deleteGame: unable to delete rowid %d", rowid );
success = false;
}
return success;
@ -355,13 +355,13 @@ public class GameUtils {
GamePtr gamePtr = null;
if ( null == stream ) {
DbgUtils.logf( "loadMakeGame: no saved game!");
DbgUtils.logw( GameUtils.class, "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.logf( "loadMakeGame() failing: dicts %s unavailable",
DbgUtils.logw( GameUtils.class, "loadMakeGame() failing: dicts %s unavailable",
TextUtils.join( ",", dictNames ) );
} else {
String langName = gi.langName();
@ -443,8 +443,8 @@ public class GameUtils {
long oldest = s_sendTimes[s_sendTimes.length - 1];
long age = now - oldest;
force = RESEND_INTERVAL_SECS < age;
DbgUtils.logdf( "resendAllIf(): based on last send age of %d sec, doit = %b",
age, force );
DbgUtils.logd( GameUtils.class, "resendAllIf(): based on last send age of %d sec, doit = %b",
age, force );
}
if ( force ) {
@ -523,7 +523,7 @@ public class GameUtils {
public static long makeNewMultiGame( Context context, NetLaunchInfo nli,
MultiMsgSink sink, UtilCtxt util )
{
DbgUtils.logdf( "makeNewMultiGame(nli=%s)", nli.toString() );
DbgUtils.logd( GameUtils.class, "makeNewMultiGame(nli=%s)", nli.toString() );
CommsAddrRec addr = nli.makeAddrRec( context );
return makeNewMultiGame( context, sink, util, DBUtils.GROUPID_UNSPEC,
@ -853,7 +853,7 @@ public class GameUtils {
}
allHere = 0 == missingSet.size();
} else {
DbgUtils.logf( "gameDictsHere: game has no dicts!" );
DbgUtils.logw( GameUtils.class, "gameDictsHere: game has no dicts!" );
}
if ( null != missingNames ) {
missingNames[0] =
@ -1054,7 +1054,7 @@ public class GameUtils {
lock.unlock();
} else {
DbgUtils.logf( "replaceDicts: unable to open rowid %d", rowid );
DbgUtils.logw( GameUtils.class, "replaceDicts: unable to open rowid %d", rowid );
}
return success;
} // replaceDicts
@ -1140,7 +1140,7 @@ public class GameUtils {
do {
rint = Utils.nextRandomInt();
} while ( 0 == rint );
DbgUtils.logf( "newGameID()=>%X (%d)", rint, rint );
DbgUtils.logi( GameUtils.class, "newGameID()=>%X (%d)", rint, rint );
return rint;
}
@ -1176,8 +1176,8 @@ public class GameUtils {
Utils.postNotification( context, intent, title, msg, (int)rowid );
}
} else {
DbgUtils.logdf( "postMoveNotification(): posting nothing for lack"
+ " of brm" );
DbgUtils.logd( GameUtils.class, "postMoveNotification(): posting nothing for lack"
+ " of brm" );
}
}
@ -1237,7 +1237,7 @@ public class GameUtils {
fos.close();
result = file;
} catch ( Exception ex ) {
DbgUtils.loge( ex );
DbgUtils.logex( ex );
}
}
return result;
@ -1283,15 +1283,16 @@ public class GameUtils {
int nSent = XwJNI.comms_resendAll( gamePtr, true,
m_filter, false );
gamePtr.release();
DbgUtils.logdf( "ResendTask.doInBackground(): sent %d "
+ "messages for rowid %d", nSent, rowid );
DbgUtils.logd( getClass(), "ResendTask.doInBackground(): sent %d "
+ "messages for rowid %d", nSent, rowid );
} else {
DbgUtils.logdf( "ResendTask.doInBackground(): loadMakeGame()"
+ " failed for rowid %d", rowid );
DbgUtils.logd( getClass(), "ResendTask.doInBackground(): loadMakeGame()"
+ " failed for rowid %d", rowid );
}
lock.unlock();
} else {
DbgUtils.logf( "ResendTask.doInBackground: unable to unlock %d",
DbgUtils.logw( ResendTask.class,
"ResendTask.doInBackground: unable to unlock %d",
rowid );
}
}

View file

@ -274,7 +274,7 @@ public class GamesListDelegate extends ListDelegateBase
}
}
if ( -1 == posn ) {
DbgUtils.logf( "getGroupPosition: group %d not found", groupID );
DbgUtils.logd( getClass(), "getGroupPosition: group %d not found", groupID );
}
return posn;
}
@ -336,7 +336,7 @@ public class GamesListDelegate extends ListDelegateBase
boolean changed = false;
int newID = fieldToID( newField );
if ( -1 == newID ) {
DbgUtils.logf( "GameListAdapter.setField(): unable to match"
DbgUtils.logd( getClass(), "setField(): unable to match"
+ " fieldName %s", newField );
} else if ( m_fieldID != newID ) {
m_fieldID = newID;
@ -432,7 +432,7 @@ public class GamesListDelegate extends ListDelegateBase
private ArrayList<Object> removeRange( ArrayList<Object> list,
int start, int len )
{
DbgUtils.logf( "removeRange(start=%d, len=%d)", start, len );
DbgUtils.logd( getClass(), "removeRange(start=%d, len=%d)", start, len );
ArrayList<Object> result = new ArrayList<Object>(len);
for ( int ii = 0; ii < len; ++ii ) {
result.add( list.remove( start ) );
@ -1338,7 +1338,7 @@ public class GamesListDelegate extends ListDelegateBase
switch ( requestCode ) {
case REQUEST_LANG_GL:
if ( !cancelled ) {
DbgUtils.logf( "lang need met" );
DbgUtils.logd( getClass(), "lang need met" );
if ( checkWarnNoDict( m_missingDictRowId ) ) {
launchGameIf();
}
@ -1467,7 +1467,7 @@ public class GamesListDelegate extends ListDelegateBase
Assert.assertTrue( m_menuPrepared );
} else {
DbgUtils.logf( "onPrepareOptionsMenu: incomplete so bailing" );
DbgUtils.logd( getClass(), "onPrepareOptionsMenu: incomplete so bailing" );
}
return m_menuPrepared;
} // onPrepareOptionsMenu
@ -1592,7 +1592,7 @@ public class GamesListDelegate extends ListDelegateBase
AdapterView.AdapterContextMenuInfo info
= (AdapterView.AdapterContextMenuInfo)menuInfo;
View targetView = info.targetView;
DbgUtils.logf( "onCreateContextMenu(t=%s)",
DbgUtils.logd( getClass(), "onCreateContextMenu(t=%s)",
targetView.getClass().getSimpleName() );
if ( targetView instanceof GameListItem ) {
item = (GameListItem)targetView;
@ -2373,7 +2373,7 @@ public class GamesListDelegate extends ListDelegateBase
private void launchGame( long rowid, boolean invited )
{
if ( DBUtils.ROWID_NOTFOUND == rowid ) {
DbgUtils.logdf( "launchGame(): dropping bad rowid" );
DbgUtils.logd( getClass(), "launchGame(): dropping bad rowid" );
} else if ( ! m_launchedGames.contains( rowid ) ) {
m_launchedGames.add( rowid );
if ( m_adapter.inExpandedGroup( rowid ) ) {
@ -2419,7 +2419,7 @@ public class GamesListDelegate extends ListDelegateBase
launchGame( rowid );
}
} catch ( GameLock.GameLockedException gle ) {
DbgUtils.loge( gle );
DbgUtils.logex( gle );
finish();
}
}

View file

@ -277,7 +277,7 @@ public class LookupAlert extends LinearLayout
private static void lookupWord( Context context, String word, String fmt )
{
if ( false ) {
DbgUtils.logf( "skipping lookupWord(%s)", word );
DbgUtils.logw( LookupAlert.class, "skipping lookupWord(%s)", word );
} else {
String langCode = s_langCodes[s_lang];
String dict_url = String.format( fmt, langCode, word );
@ -288,7 +288,7 @@ public class LookupAlert extends LinearLayout
try {
context.startActivity( intent );
} catch ( android.content.ActivityNotFoundException anfe ) {
DbgUtils.loge( anfe );
DbgUtils.logex( anfe );
}
}
} // lookupWord

View file

@ -122,13 +122,13 @@ public class MainActivity extends XWActivity
boolean isPortrait
= Configuration.ORIENTATION_PORTRAIT == newConfig.orientation;
DbgUtils.logf( "MainActivity.onConfigurationChanged(isPortrait=%b)",
DbgUtils.logi( getClass(), "onConfigurationChanged(isPortrait=%b)",
isPortrait );
m_isPortrait = isPortrait;
if ( isPortrait != (rect.width() <= rect.height()) ) {
DbgUtils.logdf( "FragActivity.onConfigurationChanged(): isPortrait:"
+ " %b; width: %d; height: %d",
isPortrait, rect.width(), rect.height() );
DbgUtils.logd( getClass(), "onConfigurationChanged(): isPortrait:"
+ " %b; width: %d; height: %d",
isPortrait, rect.width(), rect.height() );
}
int maxPanes = isPortrait? 1 : MAX_PANES_LANDSCAPE;
if ( m_maxPanes != maxPanes ) {
@ -184,10 +184,10 @@ public class MainActivity extends XWActivity
break;
}
String name = frag.getClass().getSimpleName();
DbgUtils.logdf( "MainActivity.popIntoView(): popping %d: %s", top, name );
DbgUtils.logd( getClass(), "popIntoView(): popping %d: %s", top, name );
fm.popBackStackImmediate();
DbgUtils.logdf( "MainActivity.popIntoView(): DONE popping %s",
name );
DbgUtils.logd( getClass(), "popIntoView(): DONE popping %s",
name );
}
}
@ -211,14 +211,14 @@ public class MainActivity extends XWActivity
frag.getDelegate().handleNewIntent( intent );
}
} else {
DbgUtils.logdf( "no fragment for child %s indx %d",
DbgUtils.logd( getClass(), "no fragment for child %s indx %d",
child.getClass().getSimpleName(), ii );
}
}
if ( BuildConfig.DEBUG && !handled ) {
// DbgUtils.showf( this, "dropping intent %s", intent.toString() );
DbgUtils.logdf( "dropping intent %s", intent.toString() );
DbgUtils.logd( getClass(), "dropping intent %s", intent.toString() );
// DbgUtils.printStack();
// setIntent( intent ); -- look at handling this in onPostResume()?
m_newIntent = intent;
@ -245,8 +245,8 @@ public class MainActivity extends XWActivity
if ( null != frag ) {
frag.onActivityResult( requestCode.ordinal(), resultCode, data );
} else {
DbgUtils.logdf( "dispatchOnActivityResult(): can't dispatch %s",
requestCode.toString() );
DbgUtils.logd( getClass(), "dispatchOnActivityResult(): can't dispatch %s",
requestCode.toString() );
}
}
@ -337,14 +337,14 @@ public class MainActivity extends XWActivity
{
// make sure the right-most are visible
int fragCount = getSupportFragmentManager().getBackStackEntryCount();
DbgUtils.logf( "MainActivity.onBackStackChanged(); count now %d", fragCount );
DbgUtils.logi( getClass(), "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.logf( "onBackStackChanged(): removing view with id %x",
DbgUtils.logi( getClass(), "onBackStackChanged(): removing view with id %x",
child.getId() );
}
m_root.removeView( child );
@ -355,7 +355,7 @@ public class MainActivity extends XWActivity
if ( null != m_pendingResult ) {
Fragment target = m_pendingResult.getTarget();
if ( null != target ) {
DbgUtils.logf( "onBackStackChanged(): calling onActivityResult()" );
DbgUtils.logi( getClass(),"onBackStackChanged(): calling onActivityResult()" );
target.onActivityResult( m_pendingResult.m_request,
m_pendingResult.m_result,
m_pendingResult.m_data );
@ -404,7 +404,7 @@ public class MainActivity extends XWActivity
int id = frame.getId();
Fragment frag = fm.findFragmentById( id );
if ( null == frag ) {
DbgUtils.logf( "tellOrienationChanged: NO FRAG at %d, id=%d", ii, id );
DbgUtils.logw( getClass(),"tellOrienationChanged: NO FRAG at %d, id=%d", ii, id );
} else if ( frag instanceof XWFragment ) {
((XWFragment)frag).getDelegate().orientationChanged();
}
@ -432,7 +432,7 @@ public class MainActivity extends XWActivity
for ( int ii = 0; ii < nPanes; ++ii ) {
View child = m_root.getChildAt( ii );
boolean visible = ii >= nPanes - m_maxPanes;
DbgUtils.logf( "pane %d: visible=%b", ii, visible );
DbgUtils.logi( getClass(), "pane %d: visible=%b", ii, visible );
child.setVisibility( visible ? View.VISIBLE : View.GONE );
setMenuVisibility( child, visible );
if ( visible ) {
@ -448,7 +448,7 @@ public class MainActivity extends XWActivity
if ( null != frag ) {
frag.setTitle();
} else {
DbgUtils.logdf( "trySetTitle(): no fragment for id %x",
DbgUtils.logd( getClass(), "trySetTitle(): no fragment for id %x",
view.getId() );
}
}
@ -498,7 +498,7 @@ public class MainActivity extends XWActivity
FragmentManager fm = getSupportFragmentManager();
int fragCount = fm.getBackStackEntryCount();
int containerCount = m_root.getChildCount();
DbgUtils.logf( "fragCount: %d; containerCount: %d", fragCount, containerCount );
DbgUtils.logi( getClass(), "fragCount: %d; containerCount: %d", fragCount, containerCount );
// Assert.assertTrue( fragCount == containerCount );
// Replace IF we're adding something of the same class at right OR if
@ -528,7 +528,7 @@ public class MainActivity extends XWActivity
int id = --m_nextID;
cont.setId( id );
if ( LOG_IDS ) {
DbgUtils.logf( "assigning id %x to view with name %s", id, newName );
DbgUtils.logi( getClass(), "assigning id %x to view with name %s", id, newName );
}
m_root.addView( cont, replace ? containerCount - 1 : containerCount );
@ -539,7 +539,7 @@ public class MainActivity extends XWActivity
setMenuVisibility( child, false );
DbgUtils.logf( "hiding %dth container", indx );
DbgUtils.logi( getClass(), "hiding %dth container", indx );
}
fm.beginTransaction()

View file

@ -38,7 +38,7 @@ public class MountEventReceiver extends BroadcastReceiver {
@Override
public void onReceive( Context context, Intent intent )
{
DbgUtils.logf( "MountEventReceiver.onReceive(%s)", intent.getAction() );
DbgUtils.logi( getClass(), "onReceive(%s)", intent.getAction() );
synchronized( s_procs ) {
do {
if ( s_procs.isEmpty() ) {

View file

@ -99,10 +99,10 @@ public class MultiMsgSink implements TransportProcs {
Assert.fail();
break;
}
DbgUtils.logf( "MultiMsgSink.transportSend(): sent %d via %s",
DbgUtils.logi( getClass(), "transportSend(): sent %d via %s",
nSent, typ.toString() );
if ( 0 < nSent ) {
DbgUtils.logdf( "MultiMsgSink.transportSend: adding %s", msgNo );
DbgUtils.logd( getClass(), "transportSend: adding %s", msgNo );
m_sentSet.add( msgNo );
}
@ -129,7 +129,7 @@ public class MultiMsgSink implements TransportProcs {
relayID, buf );
boolean success = buf.length == nSent;
if ( success ) {
DbgUtils.logdf( "MultiMsgSink.relayNoConnProc: adding %s", msgNo );
DbgUtils.logd( getClass(), "relayNoConnProc: adding %s", msgNo );
m_sentSet.add( msgNo );
}
return success;

View file

@ -189,7 +189,7 @@ public class MultiService {
if ( downloaded ) {
int ordinal = intent.getIntExtra( OWNER, -1 );
if ( -1 == ordinal ) {
DbgUtils.logf( "unexpected OWNER" );
DbgUtils.logw( DBUtils.class, "unexpected OWNER" );
} else {
DictFetchOwner owner = DictFetchOwner.values()[ordinal];
switch ( owner ) {

View file

@ -177,7 +177,7 @@ public class NagTurnReceiver extends BroadcastReceiver {
al.add(value);
}
} catch ( Exception ex ) {
DbgUtils.loge(ex);
DbgUtils.logex(ex);
}
}
if ( 0 < al.size() ) {

View file

@ -199,7 +199,7 @@ public class NetLaunchInfo {
}
calcValid();
} catch ( Exception e ) {
DbgUtils.logf( "unable to parse \"%s\"", data.toString() );
DbgUtils.loge( getClass(), "unable to parse \"%s\"", data.toString() );
}
}
calcValid();
@ -277,7 +277,7 @@ public class NetLaunchInfo {
int result = gameID;
if ( 0 == result ) {
Assert.assertNotNull( inviteID );
DbgUtils.logf( "gameID(): looking at inviteID: %s", inviteID );
DbgUtils.logi( getClass(), "gameID(): looking at inviteID: %s", inviteID );
result = Integer.parseInt( inviteID, 16 );
// DbgUtils.logf( "gameID(): gameID -1 so substituting %d", result );
gameID = result;
@ -335,7 +335,7 @@ public class NetLaunchInfo {
result = obj.toString();
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
// DbgUtils.logf( "makeLaunchJSON() => %s", result );
return result;
@ -419,7 +419,7 @@ public class NetLaunchInfo {
}
} catch ( JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
removeUnsupported( supported );
@ -469,7 +469,7 @@ public class NetLaunchInfo {
Uri result = ub.build();
if ( BuildConfig.DEBUG ) { // Test...
DbgUtils.logf( "testing %s...", result.toString() );
DbgUtils.logi( getClass(), "testing %s...", result.toString() );
NetLaunchInfo instance = new NetLaunchInfo( context, result );
Assert.assertTrue( instance.isValid() );
}
@ -492,7 +492,7 @@ public class NetLaunchInfo {
btAddress = got[1];
m_addrs.add( CommsConnType.COMMS_CONN_BT );
} else {
DbgUtils.logf( "addBTInfo(): no BT info available" );
DbgUtils.logw( getClass(), "addBTInfo(): no BT info available" );
}
}

View file

@ -83,7 +83,7 @@ public class NetStateCache {
boolean netAvail = getIsConnected( context );
if ( netAvail ) {
DbgUtils.logf( "netAvail(): second-guessing successful!!!" );
DbgUtils.logi( NetStateCache.class, "netAvail(): second-guessing successful!!!" );
s_netAvail = true;
if ( null != s_receiver ) {
s_receiver.notifyStateChanged( context );
@ -93,7 +93,7 @@ public class NetStateCache {
}
boolean result = s_netAvail || s_onSDKSim;
DbgUtils.logdf( "netAvail() => %b", result );
DbgUtils.logd( NetStateCache.class, "netAvail() => %b", result );
return result;
}
@ -123,7 +123,7 @@ public class NetStateCache {
if ( null != ni && ni.isConnectedOrConnecting() ) {
result = true;
}
DbgUtils.logf( "NetStateCache.getConnected() => %b", result );
DbgUtils.logi( NetStateCache.class, "NetStateCache.getConnected() => %b", result );
return result;
}
@ -164,7 +164,7 @@ public class NetStateCache {
boolean connectedReal = activeNetwork != null &&
activeNetwork.isConnectedOrConnecting();
if ( connectedReal != connectedCached ) {
DbgUtils.logf( "NetStateCache(): connected: cached: %b; actual: %b",
DbgUtils.logw( NetStateCache.class, "connected: cached: %b; actual: %b",
connectedCached, connectedReal );
}
}
@ -193,8 +193,7 @@ public class NetStateCache {
NetworkInfo ni = (NetworkInfo)intent.
getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
NetworkInfo.State state = ni.getState();
DbgUtils.logdf( "NetStateCache.PvtBroadcastReceiver.onReceive(state=%s)",
state.toString() );
DbgUtils.logd( getClass(), "onReceive(state=%s)", state.toString() );
boolean netAvail;
switch ( state ) {
@ -215,9 +214,8 @@ public class NetStateCache {
s_netAvail = netAvail; // keep current in case we're asked
notifyStateChanged( context );
} else {
DbgUtils.logdf( "NetStateCache.PvtBroadcastReceiver.onReceive:"
+ " no change; doing nothing; s_netAvail=%b",
s_netAvail );
DbgUtils.logd( getClass(), "onReceive: no change; "
+ "doing nothing; s_netAvail=%b", s_netAvail );
}
}
}
@ -241,7 +239,7 @@ public class NetStateCache {
Assert.assertTrue( mLastStateSent != s_netAvail );
mLastStateSent = s_netAvail;
DbgUtils.logf( "NetStateCache.notifyStateChanged(%b)",
DbgUtils.logi( getClass(), "notifyStateChanged(%b)",
s_netAvail );
synchronized( s_ifs ) {

View file

@ -71,9 +71,9 @@ public class NetUtils {
socket.setSoTimeout( timeoutMillis );
} catch ( java.net.UnknownHostException uhe ) {
DbgUtils.loge( uhe );
DbgUtils.logex( uhe );
} catch( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
return socket;
}
@ -128,7 +128,7 @@ public class NetUtils {
DBUtils.clearObits( m_context, m_obits );
}
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
}
@ -192,13 +192,13 @@ public class NetUtils {
}
if ( 0 != dis.available() ) {
msgs = null;
DbgUtils.logf( "format error: bytes left over in stream" );
DbgUtils.loge( NetUtils.class, "format error: bytes left over in stream" );
}
socket.close();
}
} catch( Exception npe ) {
DbgUtils.loge( npe );
DbgUtils.logex( npe );
}
return msgs;
} // queryRelay
@ -224,10 +224,10 @@ public class NetUtils {
result = (HttpURLConnection)new URL(url).openConnection();
} catch ( java.net.MalformedURLException mue ) {
Assert.assertNull( result );
DbgUtils.loge( mue );
DbgUtils.logex( mue );
} catch ( java.io.IOException ioe ) {
Assert.assertNull( result );
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
return result;
}
@ -272,12 +272,12 @@ public class NetUtils {
}
result = new String( bas.toByteArray() );
} else {
DbgUtils.logf( "runConn: responseCode: %d", responseCode );
DbgUtils.logw( NetUtils.class, "runConn: responseCode: %d", responseCode );
}
} catch ( java.net.ProtocolException pe ) {
DbgUtils.loge( pe );
DbgUtils.logex( pe );
} catch( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -298,7 +298,7 @@ public class NetUtils {
}
result = TextUtils.join( "&", pairs );
} catch ( java.io.UnsupportedEncodingException uee ) {
DbgUtils.loge( uee );
DbgUtils.logex( uee );
}
return result;

View file

@ -31,7 +31,7 @@ public class OnBootReceiver extends BroadcastReceiver {
{
if ( null != intent && null != intent.getAction()
&& intent.getAction().equals( Intent.ACTION_BOOT_COMPLETED ) ) {
DbgUtils.logdf( "OnBootReceiver: got ACTION_BOOT_COMPLETED" );
DbgUtils.logd( getClass(), "got ACTION_BOOT_COMPLETED" );
startTimers( context );
}
}

View file

@ -68,7 +68,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
protected String[] doInBackground( Void...unused )
{
ArrayList<String> names = new ArrayList<String>();
DbgUtils.logf( "doInBackground()" );
DbgUtils.logi( getClass(), "doInBackground()" );
try {
Socket socket = NetUtils.makeProxySocket( m_context, 15000 );
@ -88,7 +88,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
new DataInputStream(socket.getInputStream());
short len = dis.readShort();
short nRooms = dis.readShort();
DbgUtils.logf( "%s: got %d rooms", "doInBackground", nRooms );
DbgUtils.logi( getClass(), "doInBackground(): got %d rooms", nRooms );
// Can't figure out how to read a null-terminated string
// from DataInputStream so parse it myself.
@ -102,16 +102,16 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
++index;
}
String name = new String( bytes, lastIndex, index - lastIndex );
DbgUtils.logf( "got public room name: %s", name );
DbgUtils.logi( getClass(), "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.loge( ioe );
DbgUtils.logex( ioe );
}
DbgUtils.logf( "doInBackground() returning" );
DbgUtils.logi( getClass(), "doInBackground() returning" );
return names.toArray( new String[names.size()] );
}
@ -122,7 +122,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
@Override
protected void onPostExecute( String[] result )
{
DbgUtils.logf( "onPostExecute()" );
DbgUtils.logi( getClass(), "onPostExecute()" );
ArrayAdapter<String> adapter =
new ArrayAdapter<String>( m_context,
android.R.layout.simple_spinner_item,
@ -137,6 +137,6 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
m_nnf.NoNameFound();
}
DbgUtils.logf( "onPostExecute() done" );
DbgUtils.logi( getClass(), "onPostExecute() done" );
}
}

View file

@ -503,12 +503,12 @@ public class RelayInviteDelegate extends InviteDelegate {
JSONObject params = new JSONObject();
params.put( "relayIDs", ids );
params.put( "me", DevID.getRelayDevIDInt( m_activity ) );
DbgUtils.logf( "sending to server: %s", params.toString() );
DbgUtils.logi( getClass(), "sending to server: %s", params.toString() );
HttpURLConnection conn = NetUtils.makeHttpConn( m_context, "opponentIDsFor" );
if ( null != conn ) {
String str = NetUtils.runConn( conn, params );
DbgUtils.logf( "got json from server: %s", str );
DbgUtils.logi( getClass(), "got json from server: %s", str );
reply = new JSONObject( str );
}
@ -532,7 +532,7 @@ public class RelayInviteDelegate extends InviteDelegate {
}
} catch ( org.json.JSONException je ) {
DbgUtils.loge( je );
DbgUtils.logex( je );
}
stopProgress();
@ -542,7 +542,7 @@ public class RelayInviteDelegate extends InviteDelegate {
@Override protected void onPostExecute( Set<String> devIDs )
{
if ( null == devIDs ) {
DbgUtils.logf( "onPostExecute: no results from server?" );
DbgUtils.logw( getClass(), "onPostExecute: no results from server?" );
} else {
m_devIDRecs = new ArrayList<DevIDRec>(devIDs.size());
Iterator<String> iter = devIDs.iterator();

View file

@ -139,7 +139,7 @@ public class RelayService extends XWService
public static void gcmConfirmed( Context context, boolean confirmed )
{
if ( s_gcmWorking != confirmed ) {
DbgUtils.logf( "RelayService.gcmConfirmed(): changing "
DbgUtils.logi( RelayService.class, "gcmConfirmed(): changing "
+ "s_gcmWorking to %b", confirmed );
s_gcmWorking = confirmed;
}
@ -156,7 +156,7 @@ public class RelayService extends XWService
{
boolean enabled = ! XWPrefs
.getPrefsBoolean( context, R.string.key_disable_relay, false );
DbgUtils.logdf( "relayEnabled() => %b", enabled );
DbgUtils.logd( RelayService.class, "relayEnabled() => %b", enabled );
return enabled;
}
@ -176,7 +176,7 @@ public class RelayService extends XWService
public static void startService( Context context )
{
DbgUtils.logf( "RelayService.startService()" );
DbgUtils.logi( RelayService.class, "startService()" );
Intent intent = getIntentTo( context, MsgCmds.UDP_CHANGED );
context.startService( intent );
}
@ -214,7 +214,7 @@ public class RelayService extends XWService
public static int sendPacket( Context context, long rowid, byte[] msg )
{
DbgUtils.logdf( "RelayService.sendPacket(len=%d)", msg.length );
DbgUtils.logd( RelayService.class, "sendPacket(len=%d)", msg.length );
int result = -1;
if ( NetStateCache.netAvail( context ) ) {
Intent intent = getIntentTo( context, MsgCmds.SEND )
@ -223,7 +223,7 @@ public class RelayService extends XWService
context.startService( intent );
result = msg.length;
} else {
DbgUtils.logf( "RelayService.sendPacket: network down" );
DbgUtils.logw( RelayService.class, "sendPacket: network down" );
}
return result;
}
@ -250,7 +250,7 @@ public class RelayService extends XWService
private void receiveInvitation( int srcDevID, NetLaunchInfo nli )
{
DbgUtils.logdf( "receiveInvitation: got nli from %d: %s", srcDevID,
DbgUtils.logd( getClass(), "receiveInvitation: got nli from %d: %s", srcDevID,
nli.toString() );
if ( checkNotDupe( nli ) ) {
makeOrNotify( nli );
@ -302,15 +302,15 @@ 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.logdf( "RelayService::postData: packet of length %d for token %d",
msg.length, rowid );
DbgUtils.logd( RelayService.class, "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.logf( "RelayService.postData(): Dropping message for "
DbgUtils.logw( RelayService.class, "postData(): Dropping message for "
+ "rowid %d: not on device", rowid );
}
}
@ -360,7 +360,7 @@ public class RelayService extends XWService
m_handler = new Handler();
m_onInactivity = new Runnable() {
public void run() {
DbgUtils.logdf( "RelayService: m_onInactivity fired" );
DbgUtils.logd( getClass(), "m_onInactivity fired" );
if ( !shouldMaintainConnection() ) {
NetStateCache.unregister( RelayService.this,
RelayService.this );
@ -384,7 +384,7 @@ public class RelayService extends XWService
cmd = null;
}
if ( null != cmd ) {
DbgUtils.logdf( "RelayService::onStartCommand: cmd=%s",
DbgUtils.logd( getClass(), "onStartCommand(): cmd=%s",
cmd.toString() );
switch( cmd ) {
case PROCESS_GAME_MSGS:
@ -445,7 +445,7 @@ public class RelayService extends XWService
break;
case TIMER_FIRED:
if ( !NetStateCache.netAvail( this ) ) {
DbgUtils.logf( "not connecting: no network" );
DbgUtils.logw( getClass(), "not connecting: no network" );
} else if ( startFetchThreadIf() ) {
// do nothing
} else if ( registerWithRelayIfNot() ) {
@ -527,11 +527,11 @@ public class RelayService extends XWService
private void stopFetchThreadIf()
{
while ( null != m_fetchThread ) {
DbgUtils.logf( "2: m_fetchThread NOT NULL; WHAT TO DO???" );
DbgUtils.logw( getClass(), "2: m_fetchThread NOT NULL; WHAT TO DO???" );
try {
Thread.sleep( 20 );
} catch( java.lang.InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
}
}
}
@ -546,7 +546,7 @@ public class RelayService extends XWService
connectSocket(); // block until this is done
startWriteThread();
DbgUtils.logf( "RelayService:read thread running" );
DbgUtils.logi( getClass(), "read thread running" );
byte[] buf = new byte[1024];
for ( ; ; ) {
DatagramPacket packet =
@ -561,16 +561,16 @@ public class RelayService extends XWService
break;
}
}
DbgUtils.logf( "RelayService:read thread exiting" );
DbgUtils.logi( getClass(), "read thread exiting" );
}
}, getClass().getName() );
m_UDPReadThread.start();
} else {
DbgUtils.logf( "m_UDPReadThread not null and assumed to "
DbgUtils.logi( getClass(), "m_UDPReadThread not null and assumed to "
+ "be running" );
}
} else {
DbgUtils.logf( "RelayService.startUDPThreadsIfNot(): UDP disabled" );
DbgUtils.logi( getClass(), "startUDPThreadsIfNot(): UDP disabled" );
}
} // startUDPThreadsIfNot
@ -585,17 +585,17 @@ public class RelayService extends XWService
InetAddress addr = InetAddress.getByName( host );
m_UDPSocket.connect( addr, port ); // remember this address
DbgUtils.logdf( "RelayService.connectSocket(%s:%d): m_UDPSocket"
DbgUtils.logd( getClass(), "connectSocket(%s:%d): m_UDPSocket"
+ " now %H", host, port, m_UDPSocket );
} catch( java.net.SocketException se ) {
DbgUtils.loge( se );
DbgUtils.logex( se );
Assert.fail();
} catch( java.net.UnknownHostException uhe ) {
DbgUtils.loge( uhe );
DbgUtils.logex( uhe );
}
} else {
Assert.assertTrue( m_UDPSocket.isConnected() );
DbgUtils.logf( "m_UDPSocket not null" );
DbgUtils.logi( getClass(), "m_UDPSocket not null" );
}
}
@ -604,19 +604,18 @@ public class RelayService extends XWService
if ( null == m_UDPWriteThread ) {
m_UDPWriteThread = new Thread( null, new Runnable() {
public void run() {
DbgUtils.logf( "RelayService: write thread starting" );
DbgUtils.logi( getClass(), "write thread starting" );
for ( ; ; ) {
PacketData outData;
try {
outData = m_queue.take();
} catch ( InterruptedException ie ) {
DbgUtils.logf( "RelayService; write thread "
+ "killed" );
DbgUtils.logw( getClass(), "write thread killed" );
break;
}
if ( null == outData
|| 0 == outData.getLength() ) {
DbgUtils.logf( "stopping write thread" );
DbgUtils.logi( getClass(), "stopping write thread" );
break;
}
@ -624,7 +623,7 @@ public class RelayService extends XWService
DatagramPacket outPacket = outData.assemble();
m_UDPSocket.send( outPacket );
int pid = outData.m_packetID;
DbgUtils.logdf( "Sent udp packet, cmd=%s, id=%d,"
DbgUtils.logd( getClass(), "Sent udp packet, cmd=%s, id=%d,"
+ " of length %d",
outData.m_cmd.toString(),
pid, outPacket.getLength());
@ -634,8 +633,8 @@ public class RelayService extends XWService
resetExitTimer();
ConnStatusHandler.showSuccessOut();
} catch ( java.net.SocketException se ) {
DbgUtils.loge( se );
DbgUtils.logf( "Restarting threads to force"
DbgUtils.logex( se );
DbgUtils.logi( getClass(), "Restarting threads to force"
+ " new socket" );
m_handler.post( new Runnable() {
public void run() {
@ -643,17 +642,17 @@ public class RelayService extends XWService
}
} );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
} catch ( NullPointerException npe ) {
DbgUtils.logf( "network problem; dropping packet" );
DbgUtils.logw( getClass(), "network problem; dropping packet" );
}
}
DbgUtils.logf( "RelayService: write thread exiting" );
DbgUtils.logi( getClass(), "write thread exiting" );
}
}, getClass().getName() );
m_UDPWriteThread.start();
} else {
DbgUtils.logf( "m_UDPWriteThread not null and assumed to "
DbgUtils.logi( getClass(), "m_UDPWriteThread not null and assumed to "
+ "be running" );
}
}
@ -664,11 +663,11 @@ public class RelayService extends XWService
// can't add null
m_queue.add( new PacketData() );
try {
DbgUtils.logdf( "joining m_UDPWriteThread" );
DbgUtils.logd( getClass(), "joining m_UDPWriteThread" );
m_UDPWriteThread.join();
DbgUtils.logdf( "SUCCESSFULLY joined m_UDPWriteThread" );
DbgUtils.logd( getClass(), "SUCCESSFULLY joined m_UDPWriteThread" );
} catch( java.lang.InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
}
m_UDPWriteThread = null;
m_queue.clear();
@ -678,7 +677,7 @@ public class RelayService extends XWService
try {
m_UDPReadThread.join();
} catch( java.lang.InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
}
m_UDPReadThread = null;
m_UDPSocket = null;
@ -696,11 +695,11 @@ public class RelayService extends XWService
if ( !skipAck ) {
sendAckIf( header );
}
DbgUtils.logdf( "RelayService.gotPacket: cmd=%s", header.m_cmd.toString() );
DbgUtils.logd( getClass(), "gotPacket(): cmd=%s", header.m_cmd.toString() );
switch ( header.m_cmd ) {
case XWPDEV_UNAVAIL:
int unavail = dis.readInt();
DbgUtils.logf( "relay unvailable for another %d seconds",
DbgUtils.logi( getClass(), "relay unvailable for another %d seconds",
unavail );
String str = getVLIString( dis );
sendResult( MultiEvent.RELAY_ALERT, str );
@ -714,7 +713,7 @@ public class RelayService extends XWService
break;
case XWPDEV_BADREG:
str = getVLIString( dis );
DbgUtils.logf( "bad relayID \"%s\" reported", str );
DbgUtils.logi( getClass(), "bad relayID \"%s\" reported", str );
DevID.clearRelayDevID( this );
s_registered = false;
registerWithRelay();
@ -722,7 +721,7 @@ public class RelayService extends XWService
case XWPDEV_REGRSP:
str = getVLIString( dis );
short maxIntervalSeconds = dis.readShort();
DbgUtils.logdf( "got relayid %s (%d), maxInterval %d", str,
DbgUtils.logd( getClass(), "got relayid %s (%d), maxInterval %d", str,
Integer.parseInt( str, 16 ),
maxIntervalSeconds );
setMaxIntervalSeconds( maxIntervalSeconds );
@ -759,7 +758,7 @@ public class RelayService extends XWService
NetLaunchInfo nli = XwJNI.nliFromStream( nliData );
intent.putExtra( INVITE_FROM, srcDevID );
String asStr = nli.toString();
DbgUtils.logdf( "got invitation: %s", asStr );
DbgUtils.logd( getClass(), "got invitation: %s", asStr );
intent.putExtra( NLI_DATA, asStr );
startService( intent );
break;
@ -772,12 +771,12 @@ public class RelayService extends XWService
// DbgUtils.logf( "RelayService: got invite: %s", nliData );
// break;
default:
DbgUtils.logf( "RelayService.gotPacket(): Unhandled cmd" );
DbgUtils.logw( getClass(), "gotPacket(): Unhandled cmd" );
break;
}
}
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -800,7 +799,7 @@ public class RelayService extends XWService
boolean registered = null != relayID;
should = !registered;
}
DbgUtils.logdf( "RelayService.shouldRegister()=>%b", should );
DbgUtils.logd( getClass(), "shouldRegister()=>%b", should );
return should;
}
@ -817,7 +816,7 @@ public class RelayService extends XWService
long now = Utils.getCurSeconds();
long interval = now - s_regStartTime;
if ( interval < REG_WAIT_INTERVAL ) {
DbgUtils.logf( "registerWithRelay: skipping because only %d "
DbgUtils.logi( getClass(), "registerWithRelay: skipping because only %d "
+ "seconds since last start", interval );
} else {
String relayID = DevID.getRelayDevID( this );
@ -838,8 +837,8 @@ public class RelayService extends XWService
writeVLIString( out, devid );
}
DbgUtils.logdf( "registering devID \"%s\" (type=%s)", devid,
typ.toString() );
DbgUtils.logd( getClass(), "registering devID \"%s\" (type=%s)", devid,
typ.toString() );
out.writeShort( BuildConstants.CLIENT_VERS_RELAY );
writeVLIString( out, BuildConstants.GIT_REV );
@ -850,7 +849,7 @@ public class RelayService extends XWService
postPacket( bas, XWRelayReg.XWPDEV_REG );
s_regStartTime = now;
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
}
@ -874,7 +873,7 @@ public class RelayService extends XWService
postPacket( bas, reg );
}
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -898,7 +897,7 @@ public class RelayService extends XWService
out.write( msg, 0, msg.length );
postPacket( bas, XWRelayReg.XWPDEV_MSG );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -914,21 +913,21 @@ public class RelayService extends XWService
out.write( msg, 0, msg.length );
postPacket( bas, XWRelayReg.XWPDEV_MSGNOCONN );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
private void sendInvitation( int srcDevID, int destDevID, String relayID,
String nliStr )
{
DbgUtils.logdf( "sendInvitation(%d->%d/%s [%s])", srcDevID, destDevID,
relayID, nliStr );
DbgUtils.logd( getClass(), "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.logdf( "sendInvitation: compare these: %s vs %s",
DbgUtils.logd( getClass(), "sendInvitation: compare these: %s vs %s",
nli.toString(), tmp.toString() );
}
@ -948,7 +947,7 @@ public class RelayService extends XWService
out.write( nliData, 0, nliData.length );
postPacket( bas, XWRelayReg.XWPDEV_INVITE );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -961,7 +960,7 @@ public class RelayService extends XWService
un2vli( header.m_packetID, out );
postPacket( bas, XWRelayReg.XWPDEV_ACK );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
}
@ -974,13 +973,13 @@ public class RelayService extends XWService
if ( XWPDevProto.XWPDEV_PROTO_VERSION_1.ordinal() == proto ) {
int packetID = vli2un( dis );
if ( 0 != packetID ) {
DbgUtils.logdf( "RelayService.readHeader: got packetID %d", packetID );
DbgUtils.logd( getClass(), "readHeader(): got packetID %d", packetID );
}
byte ordinal = dis.readByte();
XWRelayReg cmd = XWRelayReg.values()[ordinal];
result = new PacketHeader( cmd, packetID );
} else {
DbgUtils.logf( "bad proto: %d", proto );
DbgUtils.logw( getClass(), "bad proto: %d", proto );
}
return result;
}
@ -1105,7 +1104,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.logf( "dropping send for lack of space; FIX ME!!" );
DbgUtils.logw( getClass(), "dropping send for lack of space; FIX ME!!" );
Assert.fail();
break;
}
@ -1135,7 +1134,7 @@ public class RelayService extends XWService
socket.close();
}
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
return null;
} // doInBackground
@ -1147,7 +1146,7 @@ public class RelayService extends XWService
if ( null != msgHash ) {
new AsyncSender( context, msgHash ).execute();
} else {
DbgUtils.logf( "sendToRelay: null msgs" );
DbgUtils.logw( RelayService.class, "sendToRelay: null msgs" );
}
} // sendToRelay
@ -1211,11 +1210,11 @@ public class RelayService extends XWService
if ( s_packetsSent.contains( packetID ) ) {
s_packetsSent.remove( packetID );
} else {
DbgUtils.logf( "Weird: got ack %d but never sent", packetID );
DbgUtils.logw( RelayService.class, "Weird: got ack %d but never sent", packetID );
}
DbgUtils.logdf( "RelayService.noteAck(): Got ack for %d; "
+ "there are %d unacked packets",
packetID, s_packetsSent.size() );
DbgUtils.logd( RelayService.class, "noteAck(): Got ack for %d; "
+ "there are %d unacked packets",
packetID, s_packetsSent.size() );
}
}
@ -1233,7 +1232,7 @@ public class RelayService extends XWService
private void startThreads()
{
DbgUtils.logdf( "RelayService.startThreads()" );
DbgUtils.logd( getClass(), "startThreads()" );
if ( !relayEnabled( this ) || !NetStateCache.netAvail( this ) ) {
stopThreads();
} else if ( XWApp.UDP_ENABLED ) {
@ -1248,7 +1247,7 @@ public class RelayService extends XWService
private void stopThreads()
{
DbgUtils.logdf( "RelayService.stopThreads()" );
DbgUtils.logd( getClass(), "stopThreads()" );
stopFetchThreadIf();
stopUDPThreadsIf();
}
@ -1279,7 +1278,7 @@ public class RelayService extends XWService
for ( int count = 0; !done; ++count ) {
nRead = is.read( buf );
if ( 1 != nRead ) {
DbgUtils.logf( "vli2un: unable to read from stream" );
DbgUtils.logw( RelayService.class, "vli2un: unable to read from stream" );
break;
}
int byt = buf[0];
@ -1360,7 +1359,7 @@ public class RelayService extends XWService
long interval = Utils.getCurSeconds() - m_lastGamePacketReceived;
result = interval < MAX_KEEPALIVE_SECS;
}
DbgUtils.logdf( "RelayService.shouldMaintainConnection=>%b", result );
DbgUtils.logd( getClass(), "shouldMaintainConnection=>%b", result );
return result;
}
@ -1409,14 +1408,14 @@ public class RelayService extends XWService
try {
m_packetID = nextPacketID( m_cmd );
DataOutputStream out = new DataOutputStream( bas );
DbgUtils.logdf( "RelayService.makeHeader(): building packet with cmd %s",
m_cmd.toString() );
DbgUtils.logd( getClass(), "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.loge( ioe );
DbgUtils.logex( ioe );
}
}

View file

@ -197,7 +197,7 @@ public class SMSService extends XWService {
Intent intent = getIntentTo( context, SMSAction.INVITE );
intent.putExtra( PHONE, phone );
String asString = nli.toString();
DbgUtils.logf( "SMSService.inviteRemote(%s, '%s')", phone, asString );
DbgUtils.logw( SMSService.class, "inviteRemote(%s, '%s')", phone, asString );
intent.putExtra( GAMEDATA_STR, asString );
context.startService( intent );
}
@ -214,7 +214,7 @@ public class SMSService extends XWService {
context.startService( intent );
nSent = binmsg.length;
} else {
DbgUtils.logf( "sendPacket: dropping because SMS disabled" );
DbgUtils.logi( SMSService.class, "sendPacket: dropping because SMS disabled" );
}
return nSent;
}
@ -251,7 +251,7 @@ public class SMSService extends XWService {
if ( hashRead == hashCode ) {
result = tmp;
} else {
DbgUtils.logf( "fromPublicFmt: hash code mismatch" );
DbgUtils.logw( SMSService.class, "fromPublicFmt: hash code mismatch" );
}
} catch( Exception e ) {
}
@ -375,7 +375,7 @@ public class SMSService extends XWService {
private void inviteRemote( String phone, String nliData )
{
DbgUtils.logf( "SMSService.inviteRemote()" );
DbgUtils.logi( getClass(), "inviteRemote()" );
ByteArrayOutputStream bas = new ByteArrayOutputStream( 128 );
DataOutputStream dos = new DataOutputStream( bas );
try {
@ -384,7 +384,7 @@ public class SMSService extends XWService {
send( SMS_CMD.INVITE, bas.toByteArray(), phone );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -398,7 +398,7 @@ public class SMSService extends XWService {
send( SMS_CMD.ACK, bas.toByteArray(), phone );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -413,7 +413,7 @@ public class SMSService extends XWService {
send( SMS_CMD.DEATH, bas.toByteArray(), phone );
s_sentDied.add( gameID );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
}
@ -431,7 +431,7 @@ public class SMSService extends XWService {
nSent = bytes.length;
}
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
return nSent;
}
@ -482,7 +482,7 @@ public class SMSService extends XWService {
start = end;
}
} else {
DbgUtils.logf( "breakAndEncode(): msg count %d too large; dropping",
DbgUtils.logw( getClass(), "breakAndEncode(): msg count %d too large; dropping",
count );
}
return result;
@ -490,7 +490,7 @@ public class SMSService extends XWService {
private void receive( SMS_CMD cmd, byte[] data, String phone )
{
DbgUtils.logf( "SMSService.receive(cmd=%s)", cmd.toString() );
DbgUtils.logi( getClass(), "receive(cmd=%s)", cmd.toString() );
DataInputStream dis =
new DataInputStream( new ByteArrayInputStream(data) );
try {
@ -509,7 +509,7 @@ public class SMSService extends XWService {
nli.gameID() );
}
} else {
DbgUtils.logf( "invalid nli from: %s", nliData );
DbgUtils.logw( getClass(), "invalid nli from: %s", nliData );
}
break;
case DATA:
@ -528,11 +528,11 @@ public class SMSService extends XWService {
gameID );
break;
default:
DbgUtils.logf( "unexpected cmd %s", cmd.toString() );
DbgUtils.logw( getClass(), "unexpected cmd %s", cmd.toString() );
break;
}
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
}
}
@ -547,7 +547,7 @@ public class SMSService extends XWService {
if ( tryAssemble( senderPhone, id, index, count, rest ) ) {
sendResult( MultiEvent.SMS_RECEIVE_OK );
} else {
DbgUtils.logf( "SMSService: receiveBuffer(): bogus message from"
DbgUtils.logw( getClass(), "SMSService: receiveBuffer(): bogus message from"
+ " phone %s", senderPhone );
}
}
@ -599,12 +599,12 @@ public class SMSService extends XWService {
gotPort = dis.readShort();
}
if ( SMS_PROTO_VERSION < proto ) {
DbgUtils.logf( "SMSService.disAssemble: bad proto %d from %s;"
DbgUtils.logw( getClass(), "SMSService.disAssemble: bad proto %d from %s;"
+ " dropping", proto, senderPhone );
sendResult( MultiEvent.BAD_PROTO_SMS, senderPhone );
} else if ( gotPort != myPort ) {
DbgUtils.logdf( "SMSService.disAssemble(): received on port %d"
+ " but expected %d", gotPort, myPort );
DbgUtils.logd( getClass(), "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()];
@ -613,10 +613,10 @@ public class SMSService extends XWService {
success = true;
}
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
DbgUtils.logex( ioe );
} catch ( ArrayIndexOutOfBoundsException oob ) {
// enum this older code doesn't know about; drop it
DbgUtils.logf( "disAssemble: dropping message with too-new enum" );
DbgUtils.logw( getClass(), "disAssemble: dropping message with too-new enum" );
}
return success;
}
@ -669,20 +669,20 @@ public class SMSService extends XWService {
for ( byte[] fragment : fragments ) {
mgr.sendDataMessage( phone, null, nbsPort, fragment, sent,
delivery );
DbgUtils.logf( "SMSService.sendBuffers(): sent %d byte fragment",
DbgUtils.logi( getClass(), "sendBuffers(): sent %d byte fragment",
fragment.length );
}
success = true;
} catch ( IllegalArgumentException iae ) {
DbgUtils.logf( "sendBuffers(%s): %s", phone, iae.toString() );
DbgUtils.logw( getClass(), "sendBuffers(%s): %s", phone, iae.toString() );
} catch ( NullPointerException npe ) {
Assert.fail(); // shouldn't be trying to do this!!!
} catch ( Exception ee ) {
DbgUtils.loge( ee );
DbgUtils.logex( ee );
}
}
} else {
DbgUtils.logf( "sendBuffers(): dropping because SMS disabled" );
DbgUtils.logi( getClass(), "dropping because SMS disabled" );
}
if ( showToasts( this ) && success && (0 == (s_nSent % 5)) ) {
@ -720,7 +720,7 @@ public class SMSService extends XWService {
case SmsManager.RESULT_ERROR_NO_SERVICE:
DbgUtils.showf( SMSService.this, "NO SERVICE!!!" );
default:
DbgUtils.logf( "FAILURE!!!" );
DbgUtils.logw( getClass(), "FAILURE!!!" );
sendResult( MultiEvent.SMS_SEND_FAILED );
break;
}
@ -733,7 +733,7 @@ public class SMSService extends XWService {
public void onReceive( Context context, Intent intent )
{
if ( Activity.RESULT_OK != getResultCode() ) {
DbgUtils.logf( "SMS delivery result: FAILURE" );
DbgUtils.logw( getClass(), "SMS delivery result: FAILURE" );
}
}
};
@ -753,7 +753,7 @@ public class SMSService extends XWService {
}
}
}
DbgUtils.logf( "matchKeyIf(%s) => %s", phone, result );
DbgUtils.logi( SMSService.class, "matchKeyIf(%s) => %s", phone, result );
return result;
}

View file

@ -92,7 +92,7 @@ public class Toolbar implements BoardContainer.SizeChangeListener {
m_onClickListeners.put( index, new View.OnClickListener() {
@Override
public void onClick( View view ) {
DbgUtils.logf( "Toolbar.setListener(): click on %s with action %s",
DbgUtils.logi( getClass(), "setListener(): click on %s with action %s",
view.toString(), action.toString() );
m_dlgDlgt.makeNotAgainBuilder( msgID, prefsKey, action )
.show();

View file

@ -118,7 +118,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
try {
versionCode = pm.getPackageInfo( packageName, 0 ).versionCode;
} catch ( PackageManager.NameNotFoundException nnfe ) {
DbgUtils.loge( nnfe );
DbgUtils.logex( nnfe );
versionCode = 0;
}
@ -142,7 +142,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
params.put( k_APP, appParams );
params.put( k_DEVID, XWPrefs.getDevID( context ) );
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
}
@ -157,7 +157,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
params.put( k_DICTS, dictParams );
params.put( k_DEVID, XWPrefs.getDevID( context ) );
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
}
@ -167,7 +167,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
try {
params.put( k_XLATEINFO, xlationUpdate );
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
}
@ -176,11 +176,12 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
params.put( k_STRINGSHASH, BuildConstants.STRINGS_HASH );
params.put( k_NAME, packageName );
params.put( k_AVERS, versionCode );
DbgUtils.logdf( "current update: %s", params.toString() );
DbgUtils.logd( UpdateCheckReceiver.class, "current update: %s",
params.toString() );
new UpdateQueryTask( context, params, fromUI, pm,
packageName, dals ).execute();
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
}
}
@ -223,7 +224,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
params.put( k_MD5SUM, sum );
params.put( k_INDEX, index );
} catch( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
return params;
}
@ -363,11 +364,11 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
}
}
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logf( "sent: \"%s\"", params.toString() );
DbgUtils.logf( "received: \"%s\"", jstr );
DbgUtils.logex( jse );
DbgUtils.logw( getClass(), "sent: \"%s\"", params.toString() );
DbgUtils.logw( getClass(), "received: \"%s\"", jstr );
} catch ( PackageManager.NameNotFoundException nnfe ) {
DbgUtils.loge( nnfe );
DbgUtils.logex( nnfe );
}
if ( !gotOne && m_fromUI ) {

View file

@ -140,7 +140,7 @@ public class Utils {
try {
Toast.makeText( context, msg, Toast.LENGTH_SHORT).show();
} catch ( java.lang.RuntimeException re ) {
DbgUtils.loge( re );
DbgUtils.logex( re );
}
}
@ -431,7 +431,7 @@ public class Utils {
.versionCode;
s_appVersion = new Integer( version );
} catch ( Exception e ) {
DbgUtils.loge( e );
DbgUtils.logex( e );
}
}
return null == s_appVersion? 0 : s_appVersion;

View file

@ -43,8 +43,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt )
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logf( "%s.onCreate(this=%H)",
getClass().getSimpleName(), this );
DbgUtils.logi( getClass(), "onCreate(this=%H)", this );
}
super.onCreate( savedInstanceState );
m_dlgt = dlgt;
@ -68,8 +67,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onPause()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logf( "%s.onPause(this=%H)",
getClass().getSimpleName(), this );
DbgUtils.logi( getClass(), "onPause(this=%H)", this );
}
m_dlgt.onPause();
super.onPause();
@ -79,8 +77,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onResume()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logf( "%s.onResume(this=%H)",
getClass().getSimpleName(), this );
DbgUtils.logi( getClass(), "onResume(this=%H)", this );
}
super.onResume();
m_dlgt.onResume();
@ -90,8 +87,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onPostResume()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logf( "%s.onPostResume(this=%H)",
getClass().getSimpleName(), this );
DbgUtils.logi( getClass(), "onPostResume(this=%H)", this );
}
super.onPostResume();
}
@ -100,8 +96,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onStart()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logf( "%s.onStart(this=%H)",
getClass().getSimpleName(), this );
DbgUtils.logi( getClass(), "%s.onStart(this=%H)", this );
}
super.onStart();
m_dlgt.onStart();
@ -111,8 +106,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onStop()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logf( "%s.onStop(this=%H)",
getClass().getSimpleName(), this );
DbgUtils.logi( getClass(), "%s.onStop(this=%H)", this );
}
m_dlgt.onStop();
super.onStop();
@ -122,8 +116,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onDestroy()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logf( "%s.onDestroy(this=%H)",
getClass().getSimpleName(), this );
DbgUtils.logi( getClass(), "onDestroy(this=%H)", this );
}
m_dlgt.onDestroy();
super.onDestroy();

View file

@ -65,7 +65,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.logf( "XWApp.onCreate(); git_rev=%s",
DbgUtils.logi( getClass(), "onCreate(); git_rev=%s",
getString( R.string.git_rev ) );
DbgUtils.logEnable( this );
@ -95,7 +95,7 @@ public class XWApp extends Application {
@Override
public void onTerminate()
{
DbgUtils.logf( "XwApp.onTerminate() called" );
DbgUtils.logi( getClass(), "onTerminate() called" );
XwJNI.cleanGlobals();
super.onTerminate();
}

View file

@ -71,7 +71,7 @@ abstract class XWFragment extends Fragment implements Delegator {
protected void onCreate( DelegateBase dlgt, Bundle sis )
{
DbgUtils.logdf( "%s.onCreate() called", this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onCreate() called" );
super.onCreate( sis );
if ( null != sis ) {
m_parentName = sis.getString( PARENT_NAME );
@ -94,15 +94,14 @@ abstract class XWFragment extends Fragment implements Delegator {
public View onCreateView( LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState )
{
DbgUtils.logdf( "%s.onCreateView() called", this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onCreateView() called" );
return m_dlgt.inflateView( inflater, container );
}
@Override
public void onActivityCreated( Bundle savedInstanceState )
{
DbgUtils.logdf( "%s.onActivityCreated() called",
this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onActivityCreated() called" );
m_dlgt.init( savedInstanceState );
super.onActivityCreated( savedInstanceState );
if ( m_hasOptionsMenu ) {
@ -113,8 +112,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onPause()
{
DbgUtils.logdf( "%s.onPause() called",
this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onPause() called" );
m_dlgt.onPause();
super.onPause();
}
@ -122,8 +120,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onResume()
{
DbgUtils.logdf( "%s.onResume() called",
this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onResume() called" );
super.onResume();
m_dlgt.onResume();
}
@ -131,8 +128,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onStart()
{
DbgUtils.logdf( "%s.onStart() called",
this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onStart() called" );
super.onStart();
m_dlgt.onStart();
}
@ -140,8 +136,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onStop()
{
DbgUtils.logdf( "%s.onStop() called",
this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onStop() called" );
m_dlgt.onStop();
super.onStop();
}
@ -149,8 +144,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onDestroy()
{
DbgUtils.logdf( "%s.onDestroy() called",
this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onDestroy() called" );
m_dlgt.onDestroy();
super.onDestroy();
}
@ -158,8 +152,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onActivityResult( int requestCode, int resultCode, Intent data )
{
DbgUtils.logdf( "%s.onActivityResult() called",
this.getClass().getSimpleName() );
DbgUtils.logd( getClass(), "onActivityResult() called" );
m_dlgt.onActivityResult( RequestCode.values()[requestCode],
resultCode, data );
}

View file

@ -64,7 +64,7 @@ class XWService extends Service {
if ( null != s_srcMgr ) {
s_srcMgr.sendResult( event, args );
} else {
DbgUtils.logdf( "XWService.sendResult: dropping %s event", event.toString() );
DbgUtils.logd( getClass(), "sendResult(): dropping %s event", event.toString() );
}
}
@ -80,7 +80,7 @@ class XWService extends Service {
s_seen.add( inviteID );
}
}
DbgUtils.logdf( "XWService.checkNotDupe(%s) => %b", inviteID, !isDupe );
DbgUtils.logd( getClass(), "checkNotDupe(%s) => %b", inviteID, !isDupe );
return !isDupe;
}

View file

@ -296,7 +296,7 @@ public class CommsAddrRec {
|| ip_relay_port != other.ip_relay_port;
break;
default:
DbgUtils.logf( "changesMatter: not handling case: %s",
DbgUtils.logw( getClass(), "changesMatter: not handling case: %s",
conType.toString() );
break;
}

View file

@ -164,7 +164,7 @@ public class CurGameInfo {
;
jsonData = obj.toString();
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
return jsonData;
@ -182,7 +182,7 @@ public class CurGameInfo {
int tmp = obj.optInt( PHONIES, phoniesAction.ordinal() );
phoniesAction = XWPhoniesChoice.values()[tmp];
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
}
}

View file

@ -424,9 +424,9 @@ public class GameSummary {
}
m_extras = asObj.toString();
} catch( org.json.JSONException ex ) {
DbgUtils.loge( ex );
DbgUtils.logex( ex );
}
DbgUtils.logf( "putStringExtra(%s,%s) => %s", key, value, m_extras );
DbgUtils.logi( getClass(), "putStringExtra(%s,%s) => %s", key, value, m_extras );
}
public String getStringExtra( String key )
@ -440,10 +440,10 @@ public class GameSummary {
result = null;
}
} catch( org.json.JSONException ex ) {
DbgUtils.loge( ex );
DbgUtils.logex( ex );
}
}
DbgUtils.logf( "getStringExtra(%s) => %s", key, result );
DbgUtils.logi( getClass(), "getStringExtra(%s) => %s", key, result );
return result;
}

View file

@ -180,7 +180,7 @@ public class JNIThread extends Thread {
if ( BuildConfig.DEBUG ) {
Iterator<QueueElem> iter = m_queue.iterator();
while ( iter.hasNext() ) {
DbgUtils.logf( "removing %s from queue",
DbgUtils.logi( getClass(), "removing %s from queue",
iter.next().m_cmd.toString() );
}
}
@ -210,7 +210,7 @@ public class JNIThread extends Thread {
// Assert.assertNull( m_jniGamePtr ); // fired!!
if ( null != m_jniGamePtr ) {
DbgUtils.logdf( "configure(): m_jniGamePtr not null; that ok?" );
DbgUtils.logd( getClass(), "configure(): m_jniGamePtr not null; that ok?" );
}
m_jniGamePtr = null;
if ( null != stream ) {
@ -249,7 +249,7 @@ public class JNIThread extends Thread {
join();
// Assert.assertFalse( isAlive() );
} catch ( java.lang.InterruptedException ie ) {
DbgUtils.loge( ie );
DbgUtils.logex( ie );
}
m_lock.unlock();
}
@ -366,7 +366,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.logdf( "JNIThread.save_jni(): no change in game; can skip saving" );
DbgUtils.logd( getClass(), "save_jni(): no change in game; can skip saving" );
} else {
// Don't need this!!!! this only runs on the run() thread
synchronized( this ) {
@ -421,7 +421,7 @@ public class JNIThread extends Thread {
try {
elem = m_queue.take();
} catch ( InterruptedException ie ) {
DbgUtils.logf( "interrupted; killing thread" );
DbgUtils.logw( getClass(), "interrupted; killing thread" );
break;
}
boolean draw = false;
@ -667,7 +667,7 @@ public class JNIThread extends Thread {
case CMD_NONE: // ignored
break;
default:
DbgUtils.logf( "dropping cmd: %s", elem.m_cmd.toString() );
DbgUtils.logw( getClass(), "dropping cmd: %s", elem.m_cmd.toString() );
Assert.fail();
}
@ -685,7 +685,7 @@ public class JNIThread extends Thread {
XwJNI.comms_stop( m_jniGamePtr );
save_jni();
} else {
DbgUtils.logf( "JNIThread.run(): exiting without saving" );
DbgUtils.logw( getClass(), "run(): exiting without saving" );
}
m_jniGamePtr.release();
m_jniGamePtr = null;
@ -712,7 +712,7 @@ public class JNIThread extends Thread {
{
m_queue.add( new QueueElem( cmd, true, args ) );
if ( m_stopped && ! JNICmd.CMD_NONE.equals(cmd) ) {
DbgUtils.logf( "WARNING: adding %s to stopped thread!!!",
DbgUtils.logw( getClass(), "adding %s to stopped thread!!!",
cmd.toString() );
DbgUtils.printStack();
}
@ -731,7 +731,7 @@ public class JNIThread extends Thread {
private void retain_sync()
{
++m_refCount;
DbgUtils.logf( "JNIThread.retain_sync(rowid=%d): m_refCount: %d",
DbgUtils.logi( getClass(), "retain_sync(rowid=%d): m_refCount: %d",
m_rowid, m_refCount );
}
@ -754,7 +754,7 @@ public class JNIThread extends Thread {
stop = true;
}
}
DbgUtils.logf( "JNIThread.release(rowid=%d): m_refCount: %d",
DbgUtils.logi( getClass(), "release(rowid=%d): m_refCount: %d",
m_rowid, m_refCount );
if ( stop ) {

View file

@ -70,7 +70,7 @@ public class JNIUtilsImpl implements JNIUtils {
try {
isr = new InputStreamReader( bais, isUTF8? "UTF8" : "ISO8859_1" );
} catch( java.io.UnsupportedEncodingException uee ) {
DbgUtils.logf( "splitFaces: %s", uee.toString() );
DbgUtils.logi( getClass(), "splitFaces: %s", uee.toString() );
isr = new InputStreamReader( bais );
}
@ -84,7 +84,7 @@ public class JNIUtilsImpl implements JNIUtils {
try {
chr = isr.read();
} catch ( java.io.IOException ioe ) {
DbgUtils.logf( ioe.toString() );
DbgUtils.logw( getClass(), ioe.toString() );
}
if ( -1 == chr ) {
addFace( faces, face );
@ -147,7 +147,7 @@ public class JNIUtilsImpl implements JNIUtils {
}
digest = md.digest();
} catch ( java.security.NoSuchAlgorithmException nsae ) {
DbgUtils.loge( nsae );
DbgUtils.logex( nsae );
}
return Utils.digestToString( digest );
}

View file

@ -208,7 +208,7 @@ public class UtilCtxtImpl implements UtilCtxt {
break;
default:
DbgUtils.logf( "no such stringCode: %d", stringCode );
DbgUtils.logw( getClass(), "no such stringCode: %d", stringCode );
}
String result = (0 == id) ? "" : LocUtils.getString( m_context, id );

View file

@ -51,8 +51,8 @@ public class XwJNI {
public synchronized GamePtr retain()
{
++m_refCount;
DbgUtils.logdf( "GamePtr.retain(this=%H, rowid=%d): refCount now %d",
this, m_rowid, m_refCount );
DbgUtils.logd( getClass(), "retain(this=%H, rowid=%d): refCount now %d",
this, m_rowid, m_refCount );
return this;
}
@ -61,8 +61,8 @@ public class XwJNI {
public synchronized void release()
{
--m_refCount;
DbgUtils.logdf( "GamePtr.release(this=%H, rowid=%d): refCount now %d",
this, m_rowid, m_refCount );
DbgUtils.logd( getClass(), "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 ) ) {

View file

@ -80,7 +80,7 @@ public class LocDelegate extends ListDelegateBase
protected void onWindowFocusChanged( boolean hasFocus )
{
if ( hasFocus && null != m_lastItem ) {
DbgUtils.logf( "updating LocListItem instance %H", m_lastItem );
DbgUtils.logi( getClass(), "updating LocListItem instance %H", m_lastItem );
m_lastItem.update();
m_lastItem = null;
}

View file

@ -35,7 +35,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.logf( "calling get with key %s", key );
DbgUtils.logw( LocIDs.class, "calling get with key %s", key );
result = getS_MAP( context ).get( key ); // NPE
}
return result;

View file

@ -133,7 +133,7 @@ public class LocSearcher {
} else {
Pair[] usePairs = null != m_lastTerm && term.contains(m_lastTerm)
? m_matchingPairs : m_filteredPairs;
DbgUtils.logf( "start: searching %d pairs", usePairs.length );
DbgUtils.logi( getClass(), "start: searching %d pairs", usePairs.length );
ArrayList<Pair> matches = new ArrayList<Pair>();
for ( Pair pair : usePairs ) {
if ( pair.matches( term ) ) {

View file

@ -306,7 +306,7 @@ public class LocUtils {
int quantity )
{
if ( XWApp.LOCUTILS_ENABLED ) {
DbgUtils.logf( "getQuantityString(%d): punting on locutils stuff for"
DbgUtils.logw( LocUtils.class, "getQuantityString(%d): punting on locutils stuff for"
+ " now. FIXME", quantity );
}
String result = context.getResources().getQuantityString( id, quantity );
@ -317,7 +317,7 @@ public class LocUtils {
int quantity, Object... params )
{
if ( XWApp.LOCUTILS_ENABLED ) {
DbgUtils.logf( "getQuantityString(%d): punting on locutils stuff for"
DbgUtils.logw( LocUtils.class, "getQuantityString(%d): punting on locutils stuff for"
+ " now. FIXME", quantity );
}
String result = context.getResources()
@ -413,7 +413,7 @@ public class LocUtils {
.put( k_LOCALE, locale )
.put( k_XLATEVERS, version );
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
}
return result;
@ -439,7 +439,7 @@ public class LocUtils {
String locale = entry.getString( k_LOCALE );
String newVersion = entry.getString( k_NEW );
JSONArray pairs = entry.getJSONArray( k_PAIRS );
DbgUtils.logf( "addXlations: locale %s: got pairs of len %d,"
DbgUtils.logi( LocUtils.class, "addXlations: locale %s: got pairs of len %d,"
+ " version %s", locale,
pairs.length(), newVersion );
@ -463,7 +463,7 @@ public class LocUtils {
s_xlationsBlessed = null;
loadXlations( context );
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
DbgUtils.logex( jse );
}
}
return nAdded;
@ -598,7 +598,7 @@ public class LocUtils {
DBUtils.getXlations( context, getCurLocale( context ) );
s_xlationsLocal = (Map<String,String>)asObjs[0];
s_xlationsBlessed = (Map<String,String>)asObjs[1];
DbgUtils.logf( "loadXlations: got %d local strings, %d blessed strings",
DbgUtils.logi( LocUtils.class, "loadXlations: got %d local strings, %d blessed strings",
s_xlationsLocal.size(),
s_xlationsBlessed.size() );
}
@ -761,7 +761,7 @@ public class LocUtils {
String locale = getCurLocale( context );
String msg = String.format( "Dropping bad translations for %s", locale );
Utils.showToast( context, msg );
DbgUtils.logf( msg );
DbgUtils.logw( LocUtils.class, msg );
DBUtils.dropXLations( context, locale );
DBUtils.setStringFor( context, localeKey(locale), "" );

View file

@ -9,9 +9,9 @@
<arg value="./local.properties" />
</exec>
<exec dir="." executable="../scripts/ndksetup.sh" output="/dev/null"
<exec dir="." executable="../scripts/ndksetup.sh" output="/dev/null"
failonerror="true" >
<arg value="${build.target}"/>
<arg value="--with-clang"/>
</exec>
</target>
@ -23,8 +23,8 @@
</exec>
<exec dir="." executable="../scripts/ndksetup.sh" output="/dev/null"
failonerror="true">
<arg value="${build.target}"/>
failonerror="true" >
<arg value="--with-clang"/>
</exec>
<exec dir="." executable="../scripts/ndkbuild.sh" failonerror="true">

View file

@ -120,8 +120,10 @@ public class %s {
fil.write( " /* %04d */ \"%s\",\n" % (ii, pairs[key]['text']) )
fil.write( " };\n" );
names = ()
func = "\n protected static void checkStrings( Context context ) \n {\n"
if "debug" == target:
names = (name, name)
func += """
int nMatches = 0;
for ( int ii = 0; ii < strs.length; ++ii ) {
@ -129,15 +131,15 @@ public class %s {
if ( strs[ii].equals( fromCtxt ) ) {
++nMatches;
} else {
DbgUtils.logf( "unequal strings: \\"%s\\" vs \\"%s\\"",
DbgUtils.logi( %s.class, "unequal strings: \\"%%s\\" vs \\"%%s\\"",
strs[ii], fromCtxt );
}
}
DbgUtils.logf( "checkStrings: %d of %d strings matched", nMatches, strs.length );
DbgUtils.logi( %s.class, "checkStrings: %%d of %%d strings matched", nMatches, strs.length );
"""
func += " }"
fil.write( func )
fil.write( func % names )
# Now the end of the class
lines = """

View file

@ -2,14 +2,33 @@
set -u -e
USE_CLANG=''
APPMK=./jni/Application.mk
TMP_MK=/tmp/tmp_$$_Application.mk
XWORDS_DEBUG_ARMONLY=${XWORDS_DEBUG_ARMONLY:-""}
XWORDS_DEBUG_X86ONLY=${XWORDS_DEBUG_X86ONLYx:-""}
usage() {
echo "usage $0 [--with-clang]"
exit 1
}
while [ $# -gt 0 ]; do
case $1 in
--with-clang)
USE_CLANG=1
;;
*)
usage "Unexpected param $1"
;;
esac
shift
done
echo "# Generated by $0; do not edit!!!" > $TMP_MK
echo "NDK_TOOLCHAIN_VERSION := clang" >> $TMP_MK
[ -n "$USE_CLANG" ] && echo "NDK_TOOLCHAIN_VERSION := clang" >> $TMP_MK
if [ -n "$XWORDS_DEBUG_ARMONLY" ]; then
echo "APP_ABI := armeabi" >> $TMP_MK
@ -26,7 +45,7 @@ fi
if [ ! -f $APPMK ]; then
cp $TMP_MK $APPMK
elif ! diff $APPMK $TMP_MK; then
elif ! diff -q $APPMK $TMP_MK >/dev/null; then
cp $TMP_MK $APPMK
fi
rm -f $TMP_MK

View file

@ -784,11 +784,15 @@ wordScoreFormatterAddTile( WordScoreFormatter* fmtr, Tile tile,
}
fullBufPtr = fmtr->fullBuf + fmtr->bufLen;
fmtr->bufLen +=
XP_SNPRINTF( fullBufPtr,
(XP_U16)(sizeof(fmtr->fullBuf) - fmtr->bufLen),
(XP_UCHAR*)(tileMultiplier > 1?"%s(%dx%d)":"%s%d"),
prefix, tileScore, tileMultiplier );
XP_U16 len = sizeof(fmtr->fullBuf) - fmtr->bufLen;
if ( tileMultiplier > 1 ) {
fmtr->bufLen += XP_SNPRINTF( fullBufPtr, len,
"%s(%dx%d)", prefix, tileScore,
tileMultiplier );
} else {
fmtr->bufLen += XP_SNPRINTF( fullBufPtr, len,
"%s%d", prefix, tileScore );
}
XP_ASSERT( XP_STRLEN(fmtr->fullBuf) == fmtr->bufLen );
XP_ASSERT( fmtr->bufLen < sizeof(fmtr->fullBuf) );

View file

@ -122,8 +122,7 @@ XP_Bool server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream );
#endif
#ifdef XWFEATURE_CHAT
void server_sendChat( ServerCtxt* server, const XP_UCHAR* msg,
XP_S16 from );
void server_sendChat( ServerCtxt* server, const XP_UCHAR* msg, XP_S16 from );
#endif
void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,

View file

@ -112,6 +112,7 @@ DEFINES += -DXWFEATURE_WALKDICT_FILTER
DEFINES += -DXWFEATURE_DICTSANITY
DEFINES += -DHASH_STREAM
DEFINES += -DRELAY_NAME_DEFAULT="\"localhost\""
DEFINES += -DXWFEATURE_TURNCHANGENOTIFY
#DEFINES += -DXWFEATURE_SCOREONEPASS
### Enable zero or one of these two ###
#DEFINES += -DXWFEATURE_TRAYUNDO_ALL

View file

@ -1382,6 +1382,14 @@ curses_util_yOffsetChange( XW_UtilCtxt* XP_UNUSED(uc),
/* } */
} /* curses_util_yOffsetChange */
#ifdef XWFEATURE_TURNCHANGENOTIFY
static void
curses_util_turnChanged( XW_UtilCtxt* XP_UNUSED(uc), XP_S16 newTurn )
{
XP_LOGF( "%s(turn=%d)", __func__, newTurn );
}
#endif
static XP_Bool
curses_util_warnIllegalWord( XW_UtilCtxt* XP_UNUSED(uc),
BadWordInfo* XP_UNUSED(bwi),
@ -1453,6 +1461,9 @@ setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util )
util->vtable->m_util_getVTManager = curses_util_getVTManager;
util->vtable->m_util_askPassword = curses_util_askPassword;
util->vtable->m_util_yOffsetChange = curses_util_yOffsetChange;
#ifdef XWFEATURE_TURNCHANGENOTIFY
util->vtable->m_util_turnChanged = curses_util_turnChanged;
#endif
util->vtable->m_util_warnIllegalWord = curses_util_warnIllegalWord;
util->vtable->m_util_remSelected = curses_util_remSelected;
#ifndef XWFEATURE_STANDALONE_ONLY

View file

@ -171,7 +171,7 @@ writeToDB( XWStreamCtxt* stream, void* closure )
}
static void
addSnap( CommonGlobals* cGlobals )
addSnapshot( CommonGlobals* cGlobals )
{
LOG_FUNC();
@ -184,9 +184,8 @@ addSnap( CommonGlobals* cGlobals )
XWStreamCtxt* stream = make_simple_stream( cGlobals );
getImage( dctx, stream );
removeSurface( dctx );
sqlite3_int64 newRow = writeBlobColumnStream( stream, cGlobals->pDb,
cGlobals->selRow, "snap" );
XP_ASSERT( cGlobals->selRow == newRow );
writeBlobColumnStream( stream, cGlobals->pDb, cGlobals->selRow, "snap" );
// XP_ASSERT( cGlobals->selRow == newRow );
stream_destroy( stream );
}
@ -264,7 +263,7 @@ summarize( CommonGlobals* cGlobals )
sqlite3_finalize( stmt );
XP_USE( result );
addSnap( cGlobals );
addSnapshot( cGlobals );
}
GSList*

View file

@ -1764,6 +1764,15 @@ gtk_util_yOffsetChange( XW_UtilCtxt* uc, XP_U16 maxOffset,
}
} /* gtk_util_yOffsetChange */
#ifdef XWFEATURE_TURNCHANGENOTIFY
static void
gtk_util_turnChanged( XW_UtilCtxt* uc, XP_S16 XP_UNUSED(newTurn) )
{
GtkGameGlobals* globals = (GtkGameGlobals*)uc->closure;
saveGame( &globals->cGlobals );
}
#endif
static void
gtkShowFinalScores( const GtkGameGlobals* globals, XP_Bool ignoreTimeout )
{
@ -2396,6 +2405,9 @@ setupGtkUtilCallbacks( GtkGameGlobals* globals, XW_UtilCtxt* util )
util->vtable->m_util_askPassword = gtk_util_askPassword;
util->vtable->m_util_trayHiddenChange = gtk_util_trayHiddenChange;
util->vtable->m_util_yOffsetChange = gtk_util_yOffsetChange;
#ifdef XWFEATURE_TURNCHANGENOTIFY
util->vtable->m_util_turnChanged = gtk_util_turnChanged;
#endif
util->vtable->m_util_informMove = gtk_util_informMove;
util->vtable->m_util_informUndo = gtk_util_informUndo;
util->vtable->m_util_notifyGameOver = gtk_util_notifyGameOver;

View file

@ -359,6 +359,10 @@ saveGame( CommonGlobals* cGlobals )
}
if ( doSave ) {
if ( !!cGlobals->pDb ) {
summarize( cGlobals );
}
XWStreamCtxt* outStream;
MemStreamCloseCallback onClose = !!cGlobals->pDb?
writeToDB : writeToFile;
@ -377,9 +381,6 @@ saveGame( CommonGlobals* cGlobals )
game_saveSucceeded( &cGlobals->game, cGlobals->curSaveToken );
XP_LOGF( "%s: saved", __func__ );
if ( !!cGlobals->pDb ) {
summarize( cGlobals );
}
} else {
XP_LOGF( "%s: simulating save failure", __func__ );
}