use TAG instead of class for logging

Moving to the traditional use of Log class, with TAG defined in every
class that logs. It's just easier to use all the facilities built into
logcat.
This commit is contained in:
Eric House 2016-11-27 21:18:46 -08:00
parent 49d75d5d91
commit 2fa47f057d
65 changed files with 425 additions and 424 deletions

View file

@ -34,7 +34,7 @@ public class BTReceiver extends BroadcastReceiver {
{
if ( XWApp.BTSUPPORTED ) {
String action = intent.getAction();
DbgUtils.logd( getClass(), "BTReceiver.onReceive(action=%s, intent=%s)",
DbgUtils.logd( TAG, "BTReceiver.onReceive(action=%s, intent=%s)",
action, intent.toString() );
if ( action.equals( BluetoothDevice.ACTION_ACL_CONNECTED ) ) {

View file

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

View file

@ -30,6 +30,7 @@ import org.json.JSONObject;
import junit.framework.Assert;
public class BiDiSockWrap {
private static final String TAG = BiDiSockWrap.class.getSimpleName();
interface Iface {
void gotPacket( BiDiSockWrap wrap, byte[] bytes );
void onWriteSuccess( BiDiSockWrap wrap );
@ -71,9 +72,9 @@ public class BiDiSockWrap {
while ( mActive ) {
try {
Thread.sleep( waitMillis );
DbgUtils.logd( getClass(), "trying to connect..." );
DbgUtils.logd( TAG, "trying to connect..." );
Socket socket = new Socket( mAddress, mPort );
DbgUtils.logd( getClass(), "connected!!!" );
DbgUtils.logd( TAG, "connected!!!" );
init( socket );
mIface.connectStateChanged( BiDiSockWrap.this, true );
break;
@ -142,13 +143,13 @@ public class BiDiSockWrap {
mWriteThread = new Thread( new Runnable() {
@Override
public void run() {
DbgUtils.logd( getClass(), "write thread starting" );
DbgUtils.logd( TAG, "write thread starting" );
try {
DataOutputStream outStream
= new DataOutputStream( mSocket.getOutputStream() );
while ( mRunThreads ) {
byte[] packet = mQueue.take();
DbgUtils.logd( BiDiSockWrap.class,
DbgUtils.logd( TAG,
"write thread got packet of len %d",
packet.length );
Assert.assertNotNull( packet );
@ -167,7 +168,7 @@ public class BiDiSockWrap {
} catch ( InterruptedException ie ) {
Assert.fail();
}
DbgUtils.logd( getClass(), "write thread exiting" );
DbgUtils.logd( TAG, "write thread exiting" );
}
} );
mWriteThread.start();
@ -175,13 +176,13 @@ public class BiDiSockWrap {
mReadThread = new Thread( new Runnable() {
@Override
public void run() {
DbgUtils.logd( getClass(), "read thread starting" );
DbgUtils.logd( TAG, "read thread starting" );
try {
DataInputStream inStream
= new DataInputStream( mSocket.getInputStream() );
while ( mRunThreads ) {
short len = inStream.readShort();
DbgUtils.logd( BiDiSockWrap.class, "got len: %d", len );
DbgUtils.logd( TAG, "got len: %d", len );
byte[] packet = new byte[len];
inStream.read( packet );
mIface.gotPacket( BiDiSockWrap.this, packet );
@ -190,10 +191,9 @@ public class BiDiSockWrap {
DbgUtils.logex( ioe );
closeSocket();
}
DbgUtils.logd( getClass(), "read thread exiting" );
DbgUtils.logd( TAG, "read thread exiting" );
}
} );
mReadThread.start();
}
}

View file

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

View file

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

View file

@ -2707,7 +2707,7 @@ public class BoardDelegate extends DelegateBase
doRematchIf( activity, null, rowID, summary, gi, gamePtr );
gamePtr.release();
} else {
DbgUtils.logw( BoardDelegate.class, "setupRematchFor(): unable to lock game" );
DbgUtils.logw( TAG, "setupRematchFor(): unable to lock game" );
}
if ( null != thread ) {

View file

@ -110,7 +110,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
} else if ( XwJNI.board_containsPt( m_jniGamePtr, xx, yy ) ) {
handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy );
} else {
DbgUtils.logd( getClass(), "BoardView.onTouchEvent(): in white space" );
DbgUtils.logd( TAG, "BoardView.onTouchEvent(): in white space" );
}
break;
case MotionEvent.ACTION_MOVE:
@ -143,7 +143,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
m_lastSpacing = MULTI_INACTIVE;
break;
default:
DbgUtils.logw( getClass(), "onTouchEvent: unknown action: %d", action );
DbgUtils.logw( TAG, "onTouchEvent: unknown action: %d", action );
break;
}
}
@ -161,7 +161,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
if ( BoardContainer.getIsPortrait() != (m_dims.height > m_dims.width) ) {
// square possible; will break above!
Assert.assertTrue( m_dims.height != m_dims.width );
DbgUtils.logd( getClass(), "BoardView.onMeasure: discarding m_dims" );
DbgUtils.logd( TAG, "BoardView.onMeasure: discarding m_dims" );
if ( ++m_dimsTossCount < 4 ) {
m_dims = null;
m_layoutWidth = m_layoutHeight = 0;
@ -188,7 +188,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
width = minWidth;
}
setMeasuredDimension( width, height );
DbgUtils.logd( getClass(), "BoardView.onMeasure: calling setMeasuredDimension( width=%d, height=%d )",
DbgUtils.logd( TAG, "BoardView.onMeasure: calling setMeasuredDimension( width=%d, height=%d )",
width, height );
}
@ -215,7 +215,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
ConnStatusHandler.draw( m_context, canvas, getResources(),
m_connTypes, m_isSolo );
} else {
DbgUtils.logd( getClass(), "BoardView.onDraw(): board not laid out yet" );
DbgUtils.logd( TAG, "BoardView.onDraw(): board not laid out yet" );
}
}
}
@ -226,15 +226,15 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
final int height = getHeight();
boolean layoutDone = width == m_layoutWidth && height == m_layoutHeight;
if ( layoutDone ) {
DbgUtils.logd( getClass(), "layoutBoardOnce(): layoutDone true" );
DbgUtils.logd( TAG, "layoutBoardOnce(): layoutDone true" );
} else if ( null == m_gi ) {
// nothing to do either
DbgUtils.logd( getClass(), "layoutBoardOnce(): no m_gi" );
DbgUtils.logd( TAG, "layoutBoardOnce(): no m_gi" );
} else if ( null == m_jniThread ) {
// nothing to do either
DbgUtils.logd( getClass(), "layoutBoardOnce(): no m_jniThread" );
DbgUtils.logd( TAG, "layoutBoardOnce(): no m_jniThread" );
} else if ( null == m_dims ) {
DbgUtils.logd( getClass(), "layoutBoardOnce(): null m_dims" );
DbgUtils.logd( TAG, "layoutBoardOnce(): null m_dims" );
// m_canvas = null;
// need to synchronize??
Paint paint = new Paint();
@ -245,13 +245,13 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
int timerWidth = scratch.width();
int fontWidth =
Math.min(m_defaultFontHt, timerWidth / timerTxt.length());
DbgUtils.logd( getClass(), "layoutBoardOnce(): posting JNICmd.CMD_LAYOUT(w=%d, h=%d)",
DbgUtils.logd( TAG, "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.logd( getClass(), "layoutBoardOnce(): DOING IT" );
DbgUtils.logd( TAG, "layoutBoardOnce(): DOING IT" );
// If board size has changed we need a new bitmap
int bmHeight = 1 + m_dims.height;
int bmWidth = 1 + m_dims.width;
@ -285,7 +285,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
m_layoutHeight = height;
layoutDone = true;
}
DbgUtils.logd( getClass(), "layoutBoardOnce()=>%b", layoutDone );
DbgUtils.logd( TAG, "layoutBoardOnce()=>%b", layoutDone );
return layoutDone;
} // layoutBoardOnce
@ -298,7 +298,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
public void startHandling( Activity parent, JNIThread thread,
CommsConnTypeSet connTypes )
{
DbgUtils.logd( getClass(), "startHandling(thread=%H)", thread );
DbgUtils.logd( TAG, "startHandling(thread=%H)", thread );
m_parent = parent;
m_jniThread = thread;
m_jniGamePtr = thread.getGamePtr();
@ -348,7 +348,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
public void dimsChanged( BoardDims dims )
{
DbgUtils.logd( getClass(), "dimsChanged(%s)", dims.toString() );
DbgUtils.logd( TAG, "dimsChanged(%s)", dims.toString() );
m_dims = dims;
m_parent.runOnUiThread( new Runnable() {
public void run()
@ -413,7 +413,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
private void handle( JNIThread.JNICmd cmd, Object... args )
{
if ( null == m_jniThread ) {
DbgUtils.logw( getClass(), "not calling handle(%s)", cmd.toString() );
DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() );
DbgUtils.printStack();
} else {
m_jniThread.handle( cmd, args );

View file

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

View file

@ -43,6 +43,7 @@ import java.util.Vector;
public class CommsTransport implements TransportProcs,
NetStateCache.StateChangedIf {
private static final String TAG = CommsTransport.class.getSimpleName();
private Selector m_selector;
private SocketChannel m_socketChannel;
private CommsAddrRec m_relayAddr;
@ -96,7 +97,7 @@ public class CommsTransport implements TransportProcs,
} catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe );
} catch ( UnresolvedAddressException uae ) {
DbgUtils.logw( getClass(), "bad address: name: %s; port: %s; exception: %s",
DbgUtils.logw( TAG, "bad address: name: %s; port: %s; exception: %s",
m_useHost, m_relayAddr.ip_relay_port,
uae.toString() );
}
@ -124,7 +125,7 @@ public class CommsTransport implements TransportProcs,
try {
m_socketChannel = SocketChannel.open();
m_socketChannel.configureBlocking( false );
DbgUtils.logi( getClass(), "connecting to %s:%d",
DbgUtils.logi( TAG, "connecting to %s:%d",
m_useHost,
m_relayAddr.ip_relay_port );
InetSocketAddress isa = new
@ -149,12 +150,12 @@ public class CommsTransport implements TransportProcs,
// we get this when relay goes down. Need to notify!
failed = true;
closeSocket();
DbgUtils.logw( getClass(), "exiting: %s", cce.toString() );
DbgUtils.logw( TAG, "exiting: %s", cce.toString() );
break; // don't try again
} catch ( java.io.IOException ioe ) {
closeSocket();
DbgUtils.logw( getClass(), "exiting: %s", ioe.toString() );
DbgUtils.logw( getClass(), ioe.toString() );
DbgUtils.logw( TAG, "exiting: %s", ioe.toString() );
DbgUtils.logw( TAG, ioe.toString() );
} catch ( java.nio.channels.NoConnectionPendingException ncp ) {
DbgUtils.logex( ncp );
closeSocket();
@ -198,7 +199,7 @@ public class CommsTransport implements TransportProcs,
}
}
} catch ( java.io.IOException ioe ) {
DbgUtils.logw( getClass(), "%s: cancelling key", ioe.toString() );
DbgUtils.logw( TAG, "%s: cancelling key", ioe.toString() );
key.cancel();
failed = true;
break outer_loop;
@ -260,7 +261,7 @@ public class CommsTransport implements TransportProcs,
try {
m_socketChannel.close();
} catch ( Exception e ) {
DbgUtils.logw( getClass(), "closing socket: %s", e.toString() );
DbgUtils.logw( TAG, "closing socket: %s", e.toString() );
}
m_socketChannel = null;
}
@ -355,7 +356,7 @@ public class CommsTransport implements TransportProcs,
public int transportSend( byte[] buf, String msgNo, CommsAddrRec addr,
CommsConnType conType, int gameID )
{
DbgUtils.logd( getClass(), "transportSend(len=%d, typ=%s)",
DbgUtils.logd( TAG, "transportSend(len=%d, typ=%s)",
buf.length, conType.toString() );
int nSent = -1;
Assert.assertNotNull( addr );
@ -384,13 +385,13 @@ public class CommsTransport implements TransportProcs,
// Keep this while debugging why the resend_all that gets
// fired on reconnect doesn't unstall a game but a manual
// resend does.
DbgUtils.logd( getClass(), "transportSend(%d)=>%d", buf.length, nSent );
DbgUtils.logd( TAG, "transportSend(%d)=>%d", buf.length, nSent );
return nSent;
}
public void relayStatus( CommsRelayState newState )
{
DbgUtils.logi( getClass(), "relayStatus called; state=%s", newState.toString() );
DbgUtils.logi( TAG, "relayStatus called; state=%s", newState.toString() );
switch( newState ) {
case COMMS_RELAYSTATE_UNCONNECTED:

View file

@ -47,6 +47,7 @@ import java.util.HashMap;
import java.util.Iterator;
public class ConnStatusHandler {
private static final String TAG = ConnStatusHandler.class.getSimpleName();
public interface ConnStatusCBacks {
public void invalidateParent();
@ -544,7 +545,7 @@ public class ConnStatusHandler {
result = WiDirService.connecting();
break;
default:
DbgUtils.logw( ConnStatusHandler.class, "connTypeEnabled: %s not handled",
DbgUtils.logw( TAG, "connTypeEnabled: %s not handled",
connType.toString() );
break;
}

View file

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

View file

@ -61,6 +61,7 @@ import java.util.Set;
import java.util.StringTokenizer;
public class DBUtils {
private static final String TAG = DBUtils.class.getSimpleName();
public static final int ROWID_NOTFOUND = -1;
public static final int ROWIDS_ALL = -2;
public static final int GROUPID_UNSPEC = -1;
@ -441,7 +442,7 @@ public class DBUtils {
db.close();
}
// DbgUtils.logd( DBUtils.class, "countOpenGamesUsingRelay() => %d", result );
// DbgUtils.logd( TAG, "countOpenGamesUsingRelay() => %d", result );
return result;
}
@ -818,7 +819,7 @@ public class DBUtils {
db.close();
}
if ( null != result && 1 < result.length ) {
DbgUtils.logi( DBUtils.class, "getRowIDsFor(%x)=>length %d array", gameID,
DbgUtils.logi( TAG, "getRowIDsFor(%x)=>length %d array", gameID,
result.length );
}
return result;
@ -866,7 +867,7 @@ public class DBUtils {
int gameID = cursor.getInt( col );
col = cursor.getColumnIndex( DBHelper.REMOTEDEVS );
String devs = cursor.getString( col );
DbgUtils.logi( DBUtils.class, "gameid %d has remote[s] %s", gameID, devs );
DbgUtils.logi( TAG, "gameid %d has remote[s] %s", gameID, devs );
if ( null != devs && 0 < devs.length() ) {
for ( String dev : TextUtils.split( devs, "\n" ) ) {
@ -1117,7 +1118,7 @@ public class DBUtils {
result = cursor.getBlob( cursor
.getColumnIndex(DBHelper.SNAPSHOT));
} else {
DbgUtils.loge( DBUtils.class, "loadGame: none for rowid=%d",
DbgUtils.loge( TAG, "loadGame: none for rowid=%d",
rowid );
}
cursor.close();
@ -1135,7 +1136,7 @@ public class DBUtils {
deleteGame( context, lock );
lock.unlock();
} else {
DbgUtils.loge( DBUtils.class, "deleteGame: unable to lock rowid %d", rowid );
DbgUtils.loge( TAG, "deleteGame: unable to lock rowid %d", rowid );
if ( BuildConfig.DEBUG ) {
Assert.fail();
}
@ -1226,15 +1227,15 @@ public class DBUtils {
HistoryPair[] result = null;
String oldHistory = getChatHistoryStr( context, rowid );
if ( null != oldHistory ) {
DbgUtils.logd( DBUtils.class, "convertChatString(): got string: %s", oldHistory );
DbgUtils.logd( TAG, "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.logd( DBUtils.class, "convertChatString(): prefixes: \"%s\" and \"%s\"", localPrefix, rmtPrefix );
DbgUtils.logd( TAG, "convertChatString(): prefixes: \"%s\" and \"%s\"", localPrefix, rmtPrefix );
String[] msgs = oldHistory.split( "\n" );
DbgUtils.logd( DBUtils.class, "convertChatString(): split into %d", msgs.length );
DbgUtils.logd( TAG, "convertChatString(): split into %d", msgs.length );
int localPlayerIndx = -1;
int remotePlayerIndx = -1;
for ( int ii = playersLocal.length - 1; ii >= 0; --ii ) {
@ -1245,24 +1246,24 @@ public class DBUtils {
}
}
for ( String msg : msgs ) {
DbgUtils.logd( DBUtils.class, "convertChatString(): msg: %s", msg );
DbgUtils.logd( TAG, "convertChatString(): msg: %s", msg );
int indx = -1;
String prefix = null;
if ( msg.startsWith( localPrefix ) ) {
DbgUtils.logd( DBUtils.class, "convertChatString(): msg: %s starts with %s", msg, localPrefix );
DbgUtils.logd( TAG, "convertChatString(): msg: %s starts with %s", msg, localPrefix );
prefix = localPrefix;
indx = localPlayerIndx;
} else if ( msg.startsWith( rmtPrefix ) ) {
DbgUtils.logd( DBUtils.class, "convertChatString(): msg: %s starts with %s", msg, rmtPrefix );
DbgUtils.logd( TAG, "convertChatString(): msg: %s starts with %s", msg, rmtPrefix );
prefix = rmtPrefix;
indx = remotePlayerIndx;
} else {
DbgUtils.logd( DBUtils.class, "convertChatString(): msg: %s starts with neither", msg );
DbgUtils.logd( TAG, "convertChatString(): msg: %s starts with neither", msg );
}
if ( -1 != indx ) {
DbgUtils.logd( DBUtils.class, "convertChatString(): removing substring %s; was: %s", prefix, msg );
DbgUtils.logd( TAG, "convertChatString(): removing substring %s; was: %s", prefix, msg );
msg = msg.substring( prefix.length(), msg.length() );
DbgUtils.logd( DBUtils.class, "convertChatString(): removED substring; now %s", msg );
DbgUtils.logd( TAG, "convertChatString(): removED substring; now %s", msg );
valuess.add( cvForChat( rowid, msg, indx ) );
HistoryPair pair = new HistoryPair(msg, indx );
@ -1332,7 +1333,7 @@ public class DBUtils {
startAndEndOut[1] = Math.min( result.length(),
Integer.parseInt( parts[1] ) );
}
DbgUtils.logd( DBUtils.class, "getCurChat(): => %s [%d,%d]", result,
DbgUtils.logd( TAG, "getCurChat(): => %s [%d,%d]", result,
startAndEndOut[0], startAndEndOut[1] );
return result;
}
@ -1854,7 +1855,7 @@ public class DBUtils {
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
valuess.add( cvForChat( rowid, msg, fromPlayer ) );
appendChatHistory( context, valuess );
DbgUtils.logi( DBUtils.class, "appendChatHistory: inserted \"%s\" from player %d",
DbgUtils.logi( TAG, "appendChatHistory: inserted \"%s\" from player %d",
msg, fromPlayer );
} // appendChatHistory
@ -2503,7 +2504,7 @@ public class DBUtils {
String.format( "not rowid in (select rowid from %s order by TIMESTAMP desc limit %d)",
DBHelper.TABLE_NAME_LOGS, LOGLIMIT );
int nGone = db.delete( DBHelper.TABLE_NAME_LOGS, where, null );
DbgUtils.logi( DBUtils.class, false, "appendLog(): deleted %d rows", nGone );
DbgUtils.logi( TAG, false, "appendLog(): deleted %d rows", nGone );
}
db.close();
}
@ -2578,7 +2579,7 @@ public class DBUtils {
int result = updateRowImpl( db, table, rowid, values );
db.close();
if ( 0 == result ) {
DbgUtils.logw( DBUtils.class, "updateRow failed" );
DbgUtils.logw( TAG, "updateRow failed" );
}
}
}

View file

@ -35,7 +35,7 @@ import org.eehouse.android.xw4.loc.LocUtils;
import java.util.Formatter;
public class DbgUtils {
private static final String TAG = BuildConstants.DBG_TAG;
private static final String TAG = DbgUtils.class.getSimpleName();
private static boolean s_doLog = BuildConfig.DEBUG;
private enum LogType { ERROR, WARN, DEBUG, INFO };
@ -54,11 +54,10 @@ public class DbgUtils {
logEnable( on );
}
private static void callLog( LogType lt, Class claz, String fmt,
private static void callLog( LogType lt, String tag, String fmt,
Object... args )
{
if ( s_doLog ) {
String tag = claz.getSimpleName();
String msg = new Formatter().format( fmt, args ).toString();
switch( lt ) {
case DEBUG:
@ -69,52 +68,28 @@ public class DbgUtils {
}
public static void logd( String tag, String fmt, Object... args ) {
Assert.fail();
}
public static void logd( Class claz, String fmt, Object... args )
{
callLog( LogType.DEBUG, claz, fmt, args );
callLog( LogType.DEBUG, tag, fmt, args );
}
public static void loge( String tag, String fmt, Object... args )
{
Assert.fail();
}
public static void loge( Class claz, String fmt, Object... args )
{
callLog( LogType.ERROR, claz, fmt, args );
callLog( LogType.ERROR, tag, fmt, args );
}
public static void logi( String tag, String fmt, Object... args )
{
Assert.fail();
logi( tag, true, fmt, args );
}
public static void logi( Class claz, String fmt, Object... args )
public static void logi( String tag, boolean persist, String fmt,
Object... args )
{
logi( claz, true, fmt, args );
}
public static void logi( String tag, boolean persist, String fmt, Object... args )
{
Assert.fail();
}
public static void logi( Class claz, boolean persist, String fmt, Object... args )
{
callLog( LogType.INFO, claz, fmt, args );
callLog( LogType.INFO, tag, fmt, args );
}
public static void logw( String tag, String fmt, Object... args )
{
Assert.fail();
}
public static void logw( Class claz, String fmt, Object... args )
{
callLog( LogType.WARN, claz, fmt, args );
callLog( LogType.WARN, tag, fmt, args );
}
public static void showf( String format, Object... args )
@ -136,7 +111,7 @@ public class DbgUtils {
public static void logex( Exception exception )
{
logw( DbgUtils.class, "Exception: %s", exception.toString() );
logw( TAG, "Exception: %s", exception.toString() );
printStack( exception.getStackTrace() );
}
@ -150,7 +125,7 @@ public class DbgUtils {
if ( s_doLog && null != trace ) {
// 1: skip printStack etc.
for ( int ii = 1; ii < trace.length; ++ii ) {
DbgUtils.logd( DbgUtils.class, "ste %d: %s", ii, trace[ii].toString() );
DbgUtils.logd( TAG, "ste %d: %s", ii, trace[ii].toString() );
}
}
}
@ -182,7 +157,7 @@ public class DbgUtils {
{
if ( s_doLog ) {
String dump = DatabaseUtils.dumpCursorToString( cursor );
logi( DbgUtils.class, "cursor: %s", dump );
logi( TAG, "cursor: %s", dump );
}
}

View file

@ -58,6 +58,7 @@ import java.util.Map;
public class DelegateBase implements DlgClickNotify,
DlgDelegate.HasDlgDelegate,
MultiService.MultiEventListener {
private static final String TAG = DelegateBase.class.getSimpleName();
private DlgDelegate m_dlgDelegate;
private Delegator m_delegator;
@ -118,14 +119,14 @@ public class DelegateBase implements DlgClickNotify,
protected void onActivityResult( RequestCode requestCode, int resultCode,
Intent data )
{
DbgUtils.logi( getClass(), "onActivityResult(): subclass responsibility!!!" );
DbgUtils.logi( TAG, "onActivityResult(): subclass responsibility!!!" );
}
protected void onStart()
{
Class clazz = getClass();
if ( s_instances.containsKey( clazz ) ) {
DbgUtils.logd( getClass(), "onStart(): replacing curThis" );
DbgUtils.logd( TAG, "onStart(): replacing curThis" );
}
s_instances.put( clazz, new WeakReference<DelegateBase>(this) );
}
@ -160,7 +161,7 @@ public class DelegateBase implements DlgClickNotify,
result = ref.get();
}
if ( this != result ) {
DbgUtils.logd( getClass(), "%s.curThis() => " + result, this.toString() );
DbgUtils.logd( TAG, "%s.curThis() => " + result, this.toString() );
}
return result;
}
@ -570,12 +571,12 @@ public class DelegateBase implements DlgClickNotify,
protected boolean canHandleNewIntent( Intent intent )
{
DbgUtils.logd( getClass(), "canHandleNewIntent() => false" );
DbgUtils.logd( TAG, "canHandleNewIntent() => false" );
return false;
}
protected void handleNewIntent( Intent intent ) {
DbgUtils.logd( getClass(), "handleNewIntent(%s): not handling",
DbgUtils.logd( TAG, "handleNewIntent(%s): not handling",
intent.toString() );
}
@ -594,7 +595,7 @@ public class DelegateBase implements DlgClickNotify,
switch( event ) {
case BT_ERR_COUNT:
int count = (Integer)args[0];
DbgUtils.logi( getClass(), "Bluetooth error count: %d", count );
DbgUtils.logi( TAG, "Bluetooth error count: %d", count );
break;
case BAD_PROTO_BT:
fmtId = R.string.bt_bad_proto_fmt;
@ -609,7 +610,7 @@ public class DelegateBase implements DlgClickNotify,
m_dlgDelegate.eventOccurred( event, args );
break;
default:
DbgUtils.logd( getClass(), "eventOccurred(event=%s) (DROPPED)",
DbgUtils.logd( TAG, "eventOccurred(event=%s) (DROPPED)",
event.toString() );
break;
}
@ -671,7 +672,7 @@ public class DelegateBase implements DlgClickNotify,
Assert.fail();
break;
}
DbgUtils.logi( getClass(), "dlgButtonClicked(action=%s button=%s): UNHANDLED",
DbgUtils.logi( TAG, "dlgButtonClicked(action=%s button=%s): UNHANDLED",
action.toString(), buttonName );
}
}

View file

@ -34,6 +34,7 @@ import android.content.Context;
import com.google.android.gcm.GCMRegistrar;
public class DevID {
private static final String TAG = DevID.class.getSimpleName();
private static final String DEVID_KEY = "DevID.devid_key";
private static final String DEVID_ACK_KEY = "key_relay_regid_ackd";
@ -84,18 +85,18 @@ public class DevID {
s_relayDevID = asStr;
}
}
DbgUtils.logd( DevID.class, "getRelayDevID() => %s", s_relayDevID );
DbgUtils.logd( TAG, "getRelayDevID() => %s", s_relayDevID );
return s_relayDevID;
}
public static void setRelayDevID( Context context, String devID )
{
DbgUtils.logd( DevID.class, "setRelayDevID()" );
DbgUtils.logd( TAG, "setRelayDevID()" );
if ( BuildConfig.DEBUG ) {
String oldID = getRelayDevID( context );
if ( null != oldID && 0 < oldID.length()
&& ! devID.equals( oldID ) ) {
DbgUtils.logd( DevID.class, "devID changing!!!: %s => %s", oldID, devID );
DbgUtils.logd( TAG, "devID changing!!!: %s => %s", oldID, devID );
}
}
DBUtils.setStringFor( context, DEVID_KEY, devID );
@ -107,7 +108,7 @@ public class DevID {
public static void clearRelayDevID( Context context )
{
DbgUtils.logi( DevID.class, "clearRelayDevID()" );
DbgUtils.logi( TAG, "clearRelayDevID()" );
DBUtils.setStringFor( context, DEVID_KEY, "" );
// DbgUtils.printStack();
}

View file

@ -47,6 +47,7 @@ import java.util.Arrays;
public class DictBrowseDelegate extends DelegateBase
implements View.OnClickListener, OnItemSelectedListener {
private static final String TAG = DictBrowseDelegate.class.getSimpleName();
private static final String DICT_NAME = "DICT_NAME";
private static final String DICT_LOC = "DICT_LOC";
@ -258,7 +259,7 @@ public class DictBrowseDelegate extends DelegateBase
try {
super.finalize();
} catch ( java.lang.Throwable err ){
DbgUtils.logi( getClass(), "%s", err.toString() );
DbgUtils.logi( TAG, "%s", err.toString() );
}
}
@ -453,7 +454,7 @@ public class DictBrowseDelegate extends DelegateBase
DictUtils.DictLoc loc
= DictUtils.getDictLoc( delegator.getActivity(), name );
if ( null == loc ) {
DbgUtils.logw( DictBrowseDelegate.class, "launch(): DictLoc null; try again?" );
DbgUtils.logw( TAG, "launch(): DictLoc null; try again?" );
} else {
launch( delegator, name, loc );
}

View file

@ -45,6 +45,7 @@ import java.util.Map;
import java.util.Set;
public class DictLangCache {
private static final String TAG = DictLangCache.class.getSimpleName();
private static String[] s_langNames;
private static HashMap<String, Integer> s_langCodes;
@ -361,7 +362,7 @@ public class DictLangCache {
for ( DictAndLoc dal : dals ) {
String name = getLangName( context, dal.name );
if ( null == name || 0 == name.length() ) {
DbgUtils.logw( DictLangCache.class, "bad lang name for dal name %s", dal.name );
DbgUtils.logw( TAG, "bad lang name for dal name %s", dal.name );
// Assert.fail();
}
langs.add( name );
@ -473,7 +474,7 @@ public class DictLangCache {
// Tmp test that recovers from problem with new background download code
if ( null != info && 0 == info.langCode ) {
DbgUtils.logw( DictLangCache.class, "getInfo: dropping info for %s b/c lang code wrong",
DbgUtils.logw( TAG, "getInfo: dropping info for %s b/c lang code wrong",
dal.name );
info = null;
}
@ -493,7 +494,7 @@ public class DictLangCache {
DBUtils.dictsSetInfo( context, dal, info );
} else {
info = null;
DbgUtils.logi( DictLangCache.class,
DbgUtils.logi( TAG,
"getInfo(): unable to open dict %s", dal.name );
}
}

View file

@ -38,6 +38,7 @@ import java.util.ArrayList;
import java.util.HashMap;
public class DictUtils {
private static final String TAG = DictUtils.class.getSimpleName();
public interface DownProgListener {
void progressMade( int nBytes );
@ -360,7 +361,7 @@ public class DictUtils {
bytes = new byte[len];
fis.read( bytes, 0, len );
fis.close();
DbgUtils.logi( DictUtils.class, "Successfully loaded %s", name );
DbgUtils.logi( TAG, "Successfully loaded %s", name );
} catch ( java.io.FileNotFoundException fnf ) {
// DbgUtils.logex( fnf );
} catch ( java.io.IOException ioe ) {
@ -589,7 +590,7 @@ public class DictUtils {
if ( !result.exists() ) {
result.mkdirs();
if ( !result.exists() ) {
DbgUtils.logw( DictUtils.class, "unable to create sd dir %s", packdir );
DbgUtils.logw( TAG, "unable to create sd dir %s", packdir );
result = null;
}
}

View file

@ -72,6 +72,7 @@ public class DictsDelegate extends ListDelegateBase
SelectableItem, MountEventReceiver.SDCardNotifiee,
DlgDelegate.DlgClickNotify, GroupStateListener,
DownloadFinishedListener, XWListItem.ExpandedListener {
private static final String TAG = DictsDelegate.class.getSimpleName();
protected static final String DICT_SHOWREMOTE = "do_launch";
protected static final String DICT_LANG_EXTRA = "use_lang";
@ -329,7 +330,7 @@ public class DictsDelegate extends ListDelegateBase
}
}
} else {
DbgUtils.logw( getClass(), "No remote info for lang %s", langName );
DbgUtils.logw( TAG, "No remote info for lang %s", langName );
}
}
@ -383,7 +384,7 @@ public class DictsDelegate extends ListDelegateBase
DictLoc fromLoc = (DictLoc)selItem.getCached();
String name = selItem.getText();
if ( fromLoc == toLoc ) {
DbgUtils.logw( getClass(), "not moving %s: same loc", name );
DbgUtils.logw( TAG, "not moving %s: same loc", name );
} else if ( DictUtils.moveDict( self.m_activity,
name, fromLoc,
toLoc ) ) {
@ -393,7 +394,7 @@ public class DictsDelegate extends ListDelegateBase
DBUtils.dictsMoveInfo( self.m_activity, name,
fromLoc, toLoc );
} else {
DbgUtils.logw( getClass(), "moveDict(%s) failed", name );
DbgUtils.logw( TAG, "moveDict(%s) failed", name );
}
}
}
@ -851,7 +852,7 @@ public class DictsDelegate extends ListDelegateBase
//////////////////////////////////////////////////////////////////////
public void cardMounted( boolean nowMounted )
{
DbgUtils.logi( getClass(), "cardMounted(%b)", nowMounted );
DbgUtils.logi( TAG, "cardMounted(%b)", nowMounted );
// post so other SDCardNotifiee implementations get a chance
// to process first: avoid race conditions
post( new Runnable() {
@ -986,7 +987,7 @@ public class DictsDelegate extends ListDelegateBase
Assert.fail();
}
}
DbgUtils.logi( getClass(), "countSelDicts() => {loc: %d; remote: %d}",
DbgUtils.logi( TAG, "countSelDicts() => {loc: %d; remote: %d}",
results[SEL_LOCAL], results[SEL_REMOTE] );
return results;
}
@ -1149,7 +1150,7 @@ public class DictsDelegate extends ListDelegateBase
public void itemClicked( SelectableItem.LongClickHandler clicked,
GameSummary summary )
{
DbgUtils.logi( getClass(), "itemClicked not implemented" );
DbgUtils.logi( TAG, "itemClicked not implemented" );
}
public void itemToggled( SelectableItem.LongClickHandler toggled,
@ -1340,7 +1341,7 @@ public class DictsDelegate extends ListDelegateBase
new HashSet<String>( Arrays.asList( m_langs ) );
// DictLangCache hits the DB hundreds of times below. Fix!
DbgUtils.logw( getClass(), "Fix me I'm stupid" );
DbgUtils.logw( TAG, "Fix me I'm stupid" );
try {
// DbgUtils.logf( "data: %s", jsonData );
JSONObject obj = new JSONObject( jsonData );

View file

@ -51,6 +51,7 @@ import java.util.Iterator;
import java.util.Map;
public class DlgDelegate {
private static final String TAG = DlgDelegate.class.getSimpleName();
public static enum Action {
SKIP_CALLBACK,
@ -583,7 +584,7 @@ public class DlgDelegate {
break;
default:
DbgUtils.loge( getClass(), "eventOccurred: unhandled event %s", event.toString() );
DbgUtils.loge( TAG, "eventOccurred: unhandled event %s", event.toString() );
}
if ( null != msg ) {
@ -999,7 +1000,7 @@ public class DlgDelegate {
if ( null == oneBase ) {
iter.remove(); // no point in keeping it
} else if ( base.equals( oneBase ) ) {
DbgUtils.logd( DlgDelegate.class, "removing alert %s for %s", dlgID.toString(),
DbgUtils.logd( TAG, "removing alert %s for %s", dlgID.toString(),
oneBase.toString() );
activity.removeDialog( dlgID.ordinal() );
iter.remove(); // no point in keeping this either

View file

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

View file

@ -39,6 +39,7 @@ import java.util.Iterator;
import java.util.Set;
public class ExpiringDelegate {
private static final String TAG = ExpiringDelegate.class.getSimpleName();
private static final long INTERVAL_SECS = 3 * 24 * 60 * 60;
// private static final long INTERVAL_SECS = 60 * 10; // for testing
@ -91,7 +92,7 @@ public class ExpiringDelegate {
}
}
DbgUtils.logd( getClass(), "ref had %d refs, now has %d expiringdelegate views",
DbgUtils.logd( TAG, "ref had %d refs, now has %d expiringdelegate views",
sizeBefore, dlgts.size() );
for ( ExpiringDelegate dlgt : dlgts ) {
@ -120,7 +121,7 @@ public class ExpiringDelegate {
private void setHandler( Handler handler )
{
if ( handler != m_handler ) {
DbgUtils.logd( getClass(), "handler changing from %H to %H",
DbgUtils.logd( TAG, "handler changing from %H to %H",
m_handler, handler );
m_handler = handler;
reschedule();

View file

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

View file

@ -61,6 +61,7 @@ public class GameConfigDelegate extends DelegateBase
implements View.OnClickListener
,XWListItem.DeleteCallback
,RefreshNamesTask.NoNameFound {
private static final String TAG = GameConfigDelegate.class.getSimpleName();
private static final String INTENT_FORRESULT_NEWGAME = "newgame";
@ -229,7 +230,7 @@ public class GameConfigDelegate extends DelegateBase
self.showToast( R.string.forced_consistent );
self.loadPlayersList();
} else {
DbgUtils.logw( getClass(), "onDismiss(): "
DbgUtils.logw( TAG, "onDismiss(): "
+ "no visible self" );
}
}
@ -774,13 +775,13 @@ public class GameConfigDelegate extends DelegateBase
}
} else {
DbgUtils.logw( getClass(), "unknown v: " + view.toString() );
DbgUtils.logw( TAG, "unknown v: " + view.toString() );
}
} // onClick
private void saveAndClose( boolean forceNew )
{
DbgUtils.logi( getClass(), "saveAndClose(forceNew=%b)", forceNew );
DbgUtils.logi( TAG, "saveAndClose(forceNew=%b)", forceNew );
applyChanges( forceNew );
finishAndLaunch();
@ -1030,7 +1031,7 @@ public class GameConfigDelegate extends DelegateBase
setting = 2;
break;
default:
DbgUtils.logw( getClass(), "setSmartnessSpinner got %d from getRobotSmartness()",
DbgUtils.logw( TAG, "setSmartnessSpinner got %d from getRobotSmartness()",
m_gi.getRobotSmartness() );
Assert.fail();
}
@ -1072,7 +1073,7 @@ public class GameConfigDelegate extends DelegateBase
private void adjustPlayersLabel()
{
DbgUtils.logi( getClass(), "adjustPlayersLabel()" );
DbgUtils.logi( TAG, "adjustPlayersLabel()" );
String label;
if ( localOnlyGame() ) {
label = getString( R.string.players_label_standalone );

View file

@ -46,6 +46,7 @@ import java.util.concurrent.LinkedBlockingQueue;
public class GameListItem extends LinearLayout
implements View.OnClickListener, SelectableItem.LongClickHandler {
private static final String TAG = GameListItem.class.getSimpleName();
private static final int SUMMARY_WAIT_MSECS = 1000;
@ -455,7 +456,7 @@ public class GameListItem extends LinearLayout
try {
elem = s_queue.take();
} catch ( InterruptedException ie ) {
DbgUtils.logw( getClass(), "interrupted; killing "
DbgUtils.logw( TAG, "interrupted; killing "
+ "s_thumbThread" );
break;
}

View file

@ -28,6 +28,7 @@ import java.util.HashMap;
// obtainable when other read locks are granted but not when a
// write lock is. Write-locks are exclusive.
public class GameLock {
private static final String TAG = GameLock.class.getSimpleName();
private static final boolean DEBUG_LOCKS = false;
private static final boolean THROW_ON_LOCKED = true;
private static final int SLEEP_TIME = 100;
@ -55,7 +56,7 @@ public class GameLock {
m_isForWrite = isForWrite;
m_lockCount = 0;
if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "GameLock(rowid:%d,isForWrite:%b)=>"
DbgUtils.logi( TAG, "GameLock(rowid:%d,isForWrite:%b)=>"
+ "this: %H", rowid, isForWrite, this );
DbgUtils.printStack();
}
@ -91,19 +92,19 @@ public class GameLock {
}
} else if ( this == owner && ! m_isForWrite ) {
if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "tryLock(): incrementing lock count" );
DbgUtils.logi( TAG, "tryLock(): incrementing lock count" );
}
Assert.assertTrue( 0 == m_lockCount );
++m_lockCount;
gotIt = true;
owner = null;
} else if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "tryLock(): rowid %d already held by lock %H",
DbgUtils.logi( TAG, "tryLock(): rowid %d already held by lock %H",
m_rowid, owner );
}
}
if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "tryLock %H (rowid=%d) => %b",
DbgUtils.logi( TAG, "tryLock %H (rowid=%d) => %b",
this, m_rowid, gotIt );
}
return owner;
@ -124,7 +125,7 @@ public class GameLock {
long sleptTime = 0;
if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "lock %H (rowid:%d, maxMillis=%d)", this, m_rowid,
DbgUtils.logi( TAG, "lock %H (rowid:%d, maxMillis=%d)", this, m_rowid,
maxMillis );
}
@ -135,11 +136,11 @@ public class GameLock {
break;
}
if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "lock() %H failed; sleeping", this );
DbgUtils.logi( TAG, "lock() %H failed; sleeping", this );
if ( 0 == sleptTime || sleptTime + SLEEP_TIME >= ASSERT_TIME ) {
DbgUtils.logi( getClass(), "lock %H seeking stack:", curOwner );
DbgUtils.logi( TAG, "lock %H seeking stack:", curOwner );
DbgUtils.printStack( curOwner.m_lockTrace );
DbgUtils.logi( getClass(), "lock %H seeking stack:", this );
DbgUtils.logi( TAG, "lock %H seeking stack:", this );
DbgUtils.printStack();
}
}
@ -152,7 +153,7 @@ public class GameLock {
}
if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "lock() %H awake; "
DbgUtils.logi( TAG, "lock() %H awake; "
+ "sleptTime now %d millis", this, sleptTime );
}
@ -162,7 +163,7 @@ public class GameLock {
throw new GameLockedException();
} else if ( sleptTime >= ASSERT_TIME ) {
if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "lock %H overlocked", this );
DbgUtils.logi( TAG, "lock %H overlocked", this );
}
Assert.fail();
}
@ -188,7 +189,7 @@ public class GameLock {
--m_lockCount;
if ( DEBUG_LOCKS ) {
DbgUtils.logi( getClass(), "unlock: this: %H (rowid:%d) unlocked",
DbgUtils.logi( TAG, "unlock: this: %H (rowid:%d) unlocked",
this, m_rowid );
}
}
@ -204,7 +205,7 @@ public class GameLock {
{
boolean result = m_isForWrite && 1 == m_lockCount;
if ( !result ) {
DbgUtils.logw( getClass(), "canWrite(): %H, returning false", this );
DbgUtils.logw( TAG, "canWrite(): %H, returning false", this );
}
return result;
}

View file

@ -59,6 +59,7 @@ import java.util.HashSet;
import java.util.Iterator;
public class GameUtils {
private static final String TAG = GameUtils.class.getSimpleName();
public static final String INVITED = "invited";
public static final String INTENT_KEY_ROWID = "rowid";
@ -72,7 +73,7 @@ public class GameUtils {
public static class NoSuchGameException extends RuntimeException {
public NoSuchGameException() {
DbgUtils.logi( getClass(), "NoSuchGameException()");
DbgUtils.logi( TAG, "NoSuchGameException()");
}
}
@ -167,7 +168,7 @@ public class GameUtils {
Utils.cancelNotification( context, (int)rowidIn );
success = true;
} else {
DbgUtils.logw( GameUtils.class, "resetGame: unable to open rowid %d", rowidIn );
DbgUtils.logw( TAG, "resetGame: unable to open rowid %d", rowidIn );
}
return success;
}
@ -268,7 +269,7 @@ public class GameUtils {
lockSrc.unlock();
}
} else {
DbgUtils.logd( GameUtils.class, "dupeGame: unable to open rowid %d",
DbgUtils.logd( TAG, "dupeGame: unable to open rowid %d",
rowidIn );
}
return rowid;
@ -292,7 +293,7 @@ public class GameUtils {
lock.unlock();
success = true;
} else {
DbgUtils.logw( GameUtils.class, "deleteGame: unable to delete rowid %d", rowid );
DbgUtils.logw( TAG, "deleteGame: unable to delete rowid %d", rowid );
success = false;
}
return success;
@ -355,13 +356,13 @@ public class GameUtils {
GamePtr gamePtr = null;
if ( null == stream ) {
DbgUtils.logw( GameUtils.class, "loadMakeGame: no saved game!");
DbgUtils.logw( TAG, "loadMakeGame: no saved game!");
} else {
XwJNI.gi_from_stream( gi, stream );
String[] dictNames = gi.dictNames();
DictUtils.DictPairs pairs = DictUtils.openDicts( context, dictNames );
if ( pairs.anyMissing( dictNames ) ) {
DbgUtils.logw( GameUtils.class, "loadMakeGame() failing: dicts %s unavailable",
DbgUtils.logw( TAG, "loadMakeGame() failing: dicts %s unavailable",
TextUtils.join( ",", dictNames ) );
} else {
String langName = gi.langName();
@ -443,7 +444,7 @@ public class GameUtils {
long oldest = s_sendTimes[s_sendTimes.length - 1];
long age = now - oldest;
force = RESEND_INTERVAL_SECS < age;
DbgUtils.logd( GameUtils.class, "resendAllIf(): based on last send age of %d sec, doit = %b",
DbgUtils.logd( TAG, "resendAllIf(): based on last send age of %d sec, doit = %b",
age, force );
}
@ -523,7 +524,7 @@ public class GameUtils {
public static long makeNewMultiGame( Context context, NetLaunchInfo nli,
MultiMsgSink sink, UtilCtxt util )
{
DbgUtils.logd( GameUtils.class, "makeNewMultiGame(nli=%s)", nli.toString() );
DbgUtils.logd( TAG, "makeNewMultiGame(nli=%s)", nli.toString() );
CommsAddrRec addr = nli.makeAddrRec( context );
return makeNewMultiGame( context, sink, util, DBUtils.GROUPID_UNSPEC,
@ -853,7 +854,7 @@ public class GameUtils {
}
allHere = 0 == missingSet.size();
} else {
DbgUtils.logw( GameUtils.class, "gameDictsHere: game has no dicts!" );
DbgUtils.logw( TAG, "gameDictsHere: game has no dicts!" );
}
if ( null != missingNames ) {
missingNames[0] =
@ -1054,7 +1055,7 @@ public class GameUtils {
lock.unlock();
} else {
DbgUtils.logw( GameUtils.class, "replaceDicts: unable to open rowid %d", rowid );
DbgUtils.logw( TAG, "replaceDicts: unable to open rowid %d", rowid );
}
return success;
} // replaceDicts
@ -1140,7 +1141,7 @@ public class GameUtils {
do {
rint = Utils.nextRandomInt();
} while ( 0 == rint );
DbgUtils.logi( GameUtils.class, "newGameID()=>%X (%d)", rint, rint );
DbgUtils.logi( TAG, "newGameID()=>%X (%d)", rint, rint );
return rint;
}
@ -1176,7 +1177,7 @@ public class GameUtils {
Utils.postNotification( context, intent, title, msg, (int)rowid );
}
} else {
DbgUtils.logd( GameUtils.class, "postMoveNotification(): posting nothing for lack"
DbgUtils.logd( TAG, "postMoveNotification(): posting nothing for lack"
+ " of brm" );
}
}
@ -1283,15 +1284,15 @@ public class GameUtils {
int nSent = XwJNI.comms_resendAll( gamePtr, true,
m_filter, false );
gamePtr.release();
DbgUtils.logd( getClass(), "ResendTask.doInBackground(): sent %d "
DbgUtils.logd( TAG, "ResendTask.doInBackground(): sent %d "
+ "messages for rowid %d", nSent, rowid );
} else {
DbgUtils.logd( getClass(), "ResendTask.doInBackground(): loadMakeGame()"
DbgUtils.logd( TAG, "ResendTask.doInBackground(): loadMakeGame()"
+ " failed for rowid %d", rowid );
}
lock.unlock();
} else {
DbgUtils.logw( ResendTask.class,
DbgUtils.logw( TAG,
"ResendTask.doInBackground: unable to unlock %d",
rowid );
}

View file

@ -74,6 +74,7 @@ public class GamesListDelegate extends ListDelegateBase
DBUtils.DBChangeListener, SelectableItem,
DownloadFinishedListener, DlgDelegate.HasDlgDelegate,
GroupStateListener {
private static final String TAG = GamesListDelegate.class.getSimpleName();
private static final String SAVE_ROWID = "SAVE_ROWID";
@ -274,7 +275,7 @@ public class GamesListDelegate extends ListDelegateBase
}
}
if ( -1 == posn ) {
DbgUtils.logd( getClass(), "getGroupPosition: group %d not found", groupID );
DbgUtils.logd( TAG, "getGroupPosition: group %d not found", groupID );
}
return posn;
}
@ -336,7 +337,7 @@ public class GamesListDelegate extends ListDelegateBase
boolean changed = false;
int newID = fieldToID( newField );
if ( -1 == newID ) {
DbgUtils.logd( getClass(), "setField(): unable to match"
DbgUtils.logd( TAG, "setField(): unable to match"
+ " fieldName %s", newField );
} else if ( m_fieldID != newID ) {
m_fieldID = newID;
@ -432,7 +433,7 @@ public class GamesListDelegate extends ListDelegateBase
private ArrayList<Object> removeRange( ArrayList<Object> list,
int start, int len )
{
DbgUtils.logd( getClass(), "removeRange(start=%d, len=%d)", start, len );
DbgUtils.logd( TAG, "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 +1339,7 @@ public class GamesListDelegate extends ListDelegateBase
switch ( requestCode ) {
case REQUEST_LANG_GL:
if ( !cancelled ) {
DbgUtils.logd( getClass(), "lang need met" );
DbgUtils.logd( TAG, "lang need met" );
if ( checkWarnNoDict( m_missingDictRowId ) ) {
launchGameIf();
}
@ -1467,7 +1468,7 @@ public class GamesListDelegate extends ListDelegateBase
Assert.assertTrue( m_menuPrepared );
} else {
DbgUtils.logd( getClass(), "onPrepareOptionsMenu: incomplete so bailing" );
DbgUtils.logd( TAG, "onPrepareOptionsMenu: incomplete so bailing" );
}
return m_menuPrepared;
} // onPrepareOptionsMenu
@ -1592,7 +1593,7 @@ public class GamesListDelegate extends ListDelegateBase
AdapterView.AdapterContextMenuInfo info
= (AdapterView.AdapterContextMenuInfo)menuInfo;
View targetView = info.targetView;
DbgUtils.logd( getClass(), "onCreateContextMenu(t=%s)",
DbgUtils.logd( TAG, "onCreateContextMenu(t=%s)",
targetView.getClass().getSimpleName() );
if ( targetView instanceof GameListItem ) {
item = (GameListItem)targetView;
@ -2375,7 +2376,7 @@ public class GamesListDelegate extends ListDelegateBase
private void launchGame( long rowid, boolean invited )
{
if ( DBUtils.ROWID_NOTFOUND == rowid ) {
DbgUtils.logd( getClass(), "launchGame(): dropping bad rowid" );
DbgUtils.logd( TAG, "launchGame(): dropping bad rowid" );
} else if ( ! m_launchedGames.contains( rowid ) ) {
m_launchedGames.add( rowid );
if ( m_adapter.inExpandedGroup( rowid ) ) {

View file

@ -23,4 +23,3 @@ package org.eehouse.android.xw4;
public interface GroupStateListener {
void onGroupExpandedChanged( Object groupObj, boolean expanded );
}

View file

@ -46,6 +46,7 @@ import junit.framework.Assert;
abstract class InviteDelegate extends ListDelegateBase
implements View.OnClickListener,
ViewGroup.OnHierarchyChangeListener {
private static final String TAG = InviteDelegate.class.getSimpleName();
public static final String DEVS = "DEVS";
public static final String COUNTS = "COUNTS";
@ -180,7 +181,7 @@ abstract class InviteDelegate extends ListDelegateBase
counts[ii] = m_counts.get( addr );
}
}
DbgUtils.logd( getClass(), "listSelected() adding %s",
DbgUtils.logd( TAG, "listSelected() adding %s",
checked.toString() );
devsP[0] = checked;
}
@ -214,7 +215,7 @@ abstract class InviteDelegate extends ListDelegateBase
protected void onItemChecked( int index, boolean checked )
{
DbgUtils.logd( getClass(), "onItemChecked(%d, %b)", index, checked );
DbgUtils.logd( TAG, "onItemChecked(%d, %b)", index, checked );
if ( checked ) {
m_checked.add( index );
} else {

View file

@ -46,6 +46,7 @@ import java.util.ArrayList;
public class LookupAlert extends LinearLayout
implements View.OnClickListener, Dialog.OnKeyListener,
AdapterView.OnItemClickListener {
private static final String TAG = LookupAlert.class.getSimpleName();
public static final String WORDS = "WORDS";
public static final String LANG = "LANG";
@ -277,7 +278,7 @@ public class LookupAlert extends LinearLayout
private static void lookupWord( Context context, String word, String fmt )
{
if ( false ) {
DbgUtils.logw( LookupAlert.class, "skipping lookupWord(%s)", word );
DbgUtils.logw( TAG, "skipping lookupWord(%s)", word );
} else {
String langCode = s_langCodes[s_lang];
String dict_url = String.format( fmt, langCode, word );

View file

@ -43,6 +43,7 @@ import java.util.Map;
public class MainActivity extends XWActivity
implements FragmentManager.OnBackStackChangedListener {
private static final String TAG = MainActivity.class.getSimpleName();
private static final int MAX_PANES_LANDSCAPE = 2;
private static final boolean LOG_IDS = true;
@ -122,11 +123,11 @@ public class MainActivity extends XWActivity
boolean isPortrait
= Configuration.ORIENTATION_PORTRAIT == newConfig.orientation;
DbgUtils.logi( getClass(), "onConfigurationChanged(isPortrait=%b)",
DbgUtils.logi( TAG, "onConfigurationChanged(isPortrait=%b)",
isPortrait );
m_isPortrait = isPortrait;
if ( isPortrait != (rect.width() <= rect.height()) ) {
DbgUtils.logd( getClass(), "onConfigurationChanged(): isPortrait:"
DbgUtils.logd( TAG, "onConfigurationChanged(): isPortrait:"
+ " %b; width: %d; height: %d",
isPortrait, rect.width(), rect.height() );
}
@ -184,9 +185,9 @@ public class MainActivity extends XWActivity
break;
}
String name = frag.getClass().getSimpleName();
DbgUtils.logd( getClass(), "popIntoView(): popping %d: %s", top, name );
DbgUtils.logd( TAG, "popIntoView(): popping %d: %s", top, name );
fm.popBackStackImmediate();
DbgUtils.logd( getClass(), "popIntoView(): DONE popping %s",
DbgUtils.logd( TAG, "popIntoView(): DONE popping %s",
name );
}
}
@ -211,14 +212,14 @@ public class MainActivity extends XWActivity
frag.getDelegate().handleNewIntent( intent );
}
} else {
DbgUtils.logd( getClass(), "no fragment for child %s indx %d",
DbgUtils.logd( TAG, "no fragment for child %s indx %d",
child.getClass().getSimpleName(), ii );
}
}
if ( BuildConfig.DEBUG && !handled ) {
// DbgUtils.showf( this, "dropping intent %s", intent.toString() );
DbgUtils.logd( getClass(), "dropping intent %s", intent.toString() );
DbgUtils.logd( TAG, "dropping intent %s", intent.toString() );
// DbgUtils.printStack();
// setIntent( intent ); -- look at handling this in onPostResume()?
m_newIntent = intent;
@ -245,7 +246,7 @@ public class MainActivity extends XWActivity
if ( null != frag ) {
frag.onActivityResult( requestCode.ordinal(), resultCode, data );
} else {
DbgUtils.logd( getClass(), "dispatchOnActivityResult(): can't dispatch %s",
DbgUtils.logd( TAG, "dispatchOnActivityResult(): can't dispatch %s",
requestCode.toString() );
}
}
@ -337,14 +338,14 @@ public class MainActivity extends XWActivity
{
// make sure the right-most are visible
int fragCount = getSupportFragmentManager().getBackStackEntryCount();
DbgUtils.logi( getClass(), "onBackStackChanged(); count now %d", fragCount );
DbgUtils.logi( TAG, "onBackStackChanged(); count now %d", fragCount );
if ( 0 == fragCount ) {
finish();
} else {
if ( fragCount == m_root.getChildCount() - 1 ) {
View child = m_root.getChildAt( fragCount );
if ( LOG_IDS ) {
DbgUtils.logi( getClass(), "onBackStackChanged(): removing view with id %x",
DbgUtils.logi( TAG, "onBackStackChanged(): removing view with id %x",
child.getId() );
}
m_root.removeView( child );
@ -355,7 +356,7 @@ public class MainActivity extends XWActivity
if ( null != m_pendingResult ) {
Fragment target = m_pendingResult.getTarget();
if ( null != target ) {
DbgUtils.logi( getClass(),"onBackStackChanged(): calling onActivityResult()" );
DbgUtils.logi( TAG,"onBackStackChanged(): calling onActivityResult()" );
target.onActivityResult( m_pendingResult.m_request,
m_pendingResult.m_result,
m_pendingResult.m_data );
@ -404,7 +405,7 @@ public class MainActivity extends XWActivity
int id = frame.getId();
Fragment frag = fm.findFragmentById( id );
if ( null == frag ) {
DbgUtils.logw( getClass(),"tellOrienationChanged: NO FRAG at %d, id=%d", ii, id );
DbgUtils.logw( TAG,"tellOrienationChanged: NO FRAG at %d, id=%d", ii, id );
} else if ( frag instanceof XWFragment ) {
((XWFragment)frag).getDelegate().orientationChanged();
}
@ -432,7 +433,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.logi( getClass(), "pane %d: visible=%b", ii, visible );
DbgUtils.logi( TAG, "pane %d: visible=%b", ii, visible );
child.setVisibility( visible ? View.VISIBLE : View.GONE );
setMenuVisibility( child, visible );
if ( visible ) {
@ -448,7 +449,7 @@ public class MainActivity extends XWActivity
if ( null != frag ) {
frag.setTitle();
} else {
DbgUtils.logd( getClass(), "trySetTitle(): no fragment for id %x",
DbgUtils.logd( TAG, "trySetTitle(): no fragment for id %x",
view.getId() );
}
}
@ -498,7 +499,7 @@ public class MainActivity extends XWActivity
FragmentManager fm = getSupportFragmentManager();
int fragCount = fm.getBackStackEntryCount();
int containerCount = m_root.getChildCount();
DbgUtils.logi( getClass(), "fragCount: %d; containerCount: %d", fragCount, containerCount );
DbgUtils.logi( TAG, "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 +529,7 @@ public class MainActivity extends XWActivity
int id = --m_nextID;
cont.setId( id );
if ( LOG_IDS ) {
DbgUtils.logi( getClass(), "assigning id %x to view with name %s", id, newName );
DbgUtils.logi( TAG, "assigning id %x to view with name %s", id, newName );
}
m_root.addView( cont, replace ? containerCount - 1 : containerCount );
@ -539,7 +540,7 @@ public class MainActivity extends XWActivity
setMenuVisibility( child, false );
DbgUtils.logi( getClass(), "hiding %dth container", indx );
DbgUtils.logi( TAG, "hiding %dth container", indx );
}
fm.beginTransaction()

View file

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

View file

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

View file

@ -31,6 +31,7 @@ import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
public class MultiService {
private static final String TAG = MultiService.class.getSimpleName();
public static final String FORCECHANNEL = "FC";
public static final String LANG = "LANG";
@ -191,7 +192,7 @@ public class MultiService {
if ( downloaded ) {
int ordinal = intent.getIntExtra( OWNER, -1 );
if ( -1 == ordinal ) {
DbgUtils.logw( DBUtils.class, "unexpected OWNER" );
DbgUtils.logw( TAG, "unexpected OWNER" );
} else {
DictFetchOwner owner = DictFetchOwner.values()[ordinal];
switch ( owner ) {

View file

@ -41,6 +41,7 @@ import java.io.InputStream;
import java.util.Iterator;
public class NetLaunchInfo {
private static final String TAG = NetLaunchInfo.class.getSimpleName();
private static final String ADDRS_KEY = "ad";
private static final String PHONE_KEY = "phn";
private static final String GSM_KEY = "gsm";
@ -206,7 +207,7 @@ public class NetLaunchInfo {
}
calcValid();
} catch ( Exception e ) {
DbgUtils.loge( getClass(), "unable to parse \"%s\"", data.toString() );
DbgUtils.loge( TAG, "unable to parse \"%s\"", data.toString() );
}
}
calcValid();
@ -287,7 +288,7 @@ public class NetLaunchInfo {
int result = gameID;
if ( 0 == result ) {
Assert.assertNotNull( inviteID );
DbgUtils.logi( getClass(), "gameID(): looking at inviteID: %s", inviteID );
DbgUtils.logi( TAG, "gameID(): looking at inviteID: %s", inviteID );
result = Integer.parseInt( inviteID, 16 );
// DbgUtils.logf( "gameID(): gameID -1 so substituting %d", result );
gameID = result;
@ -493,7 +494,7 @@ public class NetLaunchInfo {
Uri result = ub.build();
if ( BuildConfig.DEBUG ) { // Test...
DbgUtils.logi( getClass(), "testing %s...", result.toString() );
DbgUtils.logi( TAG, "testing %s...", result.toString() );
NetLaunchInfo instance = new NetLaunchInfo( context, result );
Assert.assertTrue( instance.isValid() );
}
@ -516,7 +517,7 @@ public class NetLaunchInfo {
btAddress = got[1];
m_addrs.add( CommsConnType.COMMS_CONN_BT );
} else {
DbgUtils.logw( getClass(), "addBTInfo(): no BT info available" );
DbgUtils.logw( TAG, "addBTInfo(): no BT info available" );
}
}

View file

@ -38,6 +38,7 @@ import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;
public class NetStateCache {
private static final String TAG = NetStateCache.class.getSimpleName();
private static final long WAIT_STABLE_MILLIS = 2 * 1000;
public interface StateChangedIf {
@ -83,7 +84,7 @@ public class NetStateCache {
boolean netAvail = getIsConnected( context );
if ( netAvail ) {
DbgUtils.logi( NetStateCache.class, "netAvail(): second-guessing successful!!!" );
DbgUtils.logi( TAG, "netAvail(): second-guessing successful!!!" );
s_netAvail = true;
if ( null != s_receiver ) {
s_receiver.notifyStateChanged( context );
@ -93,7 +94,7 @@ public class NetStateCache {
}
boolean result = s_netAvail || s_onSDKSim;
DbgUtils.logd( NetStateCache.class, "netAvail() => %b", result );
DbgUtils.logd( TAG, "netAvail() => %b", result );
return result;
}
@ -123,7 +124,7 @@ public class NetStateCache {
if ( null != ni && ni.isConnectedOrConnecting() ) {
result = true;
}
DbgUtils.logi( NetStateCache.class, "NetStateCache.getConnected() => %b", result );
DbgUtils.logi( TAG, "NetStateCache.getConnected() => %b", result );
return result;
}
@ -164,7 +165,7 @@ public class NetStateCache {
boolean connectedReal = activeNetwork != null &&
activeNetwork.isConnectedOrConnecting();
if ( connectedReal != connectedCached ) {
DbgUtils.logw( NetStateCache.class, "connected: cached: %b; actual: %b",
DbgUtils.logw( TAG, "connected: cached: %b; actual: %b",
connectedCached, connectedReal );
}
}
@ -193,7 +194,7 @@ public class NetStateCache {
NetworkInfo ni = (NetworkInfo)intent.
getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
NetworkInfo.State state = ni.getState();
DbgUtils.logd( getClass(), "onReceive(state=%s)", state.toString() );
DbgUtils.logd( TAG, "onReceive(state=%s)", state.toString() );
boolean netAvail;
switch ( state ) {
@ -214,7 +215,7 @@ public class NetStateCache {
s_netAvail = netAvail; // keep current in case we're asked
notifyStateChanged( context );
} else {
DbgUtils.logd( getClass(), "onReceive: no change; "
DbgUtils.logd( TAG, "onReceive: no change; "
+ "doing nothing; s_netAvail=%b", s_netAvail );
}
}
@ -239,7 +240,7 @@ public class NetStateCache {
Assert.assertTrue( mLastStateSent != s_netAvail );
mLastStateSent = s_netAvail;
DbgUtils.logi( getClass(), "notifyStateChanged(%b)",
DbgUtils.logi( TAG, "notifyStateChanged(%b)",
s_netAvail );
synchronized( s_ifs ) {

View file

@ -47,6 +47,7 @@ import java.util.Map;
import javax.net.SocketFactory;
public class NetUtils {
private static final String TAG = NetUtils.class.getSimpleName();
public static final String k_PARAMS = "params";
public static final byte PROTOCOL_VERSION = 0;
@ -192,7 +193,7 @@ public class NetUtils {
}
if ( 0 != dis.available() ) {
msgs = null;
DbgUtils.loge( NetUtils.class, "format error: bytes left over in stream" );
DbgUtils.loge( TAG, "format error: bytes left over in stream" );
}
socket.close();
}
@ -272,7 +273,7 @@ public class NetUtils {
}
result = new String( bas.toByteArray() );
} else {
DbgUtils.logw( NetUtils.class, "runConn: responseCode: %d", responseCode );
DbgUtils.logw( TAG, "runConn: responseCode: %d", responseCode );
}
} catch ( java.net.ProtocolException pe ) {
DbgUtils.logex( pe );

View file

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

View file

@ -69,7 +69,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
protected String[] doInBackground( Void...unused )
{
ArrayList<String> names = new ArrayList<String>();
DbgUtils.logi( getClass(), "doInBackground()" );
DbgUtils.logi( TAG, "doInBackground()" );
try {
Socket socket = NetUtils.makeProxySocket( m_context, 15000 );
@ -89,7 +89,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
new DataInputStream(socket.getInputStream());
short len = dis.readShort();
short nRooms = dis.readShort();
DbgUtils.logi( getClass(), "doInBackground(): got %d rooms", nRooms );
DbgUtils.logi( TAG, "doInBackground(): got %d rooms", nRooms );
// Can't figure out how to read a null-terminated string
// from DataInputStream so parse it myself.
@ -103,7 +103,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
++index;
}
String name = new String( bytes, lastIndex, index - lastIndex );
DbgUtils.logi( getClass(), "got public room name: %s", name );
DbgUtils.logi( TAG, "got public room name: %s", name );
int indx = name.lastIndexOf( "/" );
indx = name.lastIndexOf( "/", indx-1 );
names.add( name.substring(0, indx ) );
@ -112,7 +112,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
} catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe );
}
DbgUtils.logi( getClass(), "doInBackground() returning" );
DbgUtils.logi( TAG, "doInBackground() returning" );
return names.toArray( new String[names.size()] );
}
@ -123,7 +123,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
@Override
protected void onPostExecute( String[] result )
{
DbgUtils.logi( getClass(), "onPostExecute()" );
DbgUtils.logi( TAG, "onPostExecute()" );
ArrayAdapter<String> adapter =
new ArrayAdapter<String>( m_context,
android.R.layout.simple_spinner_item,
@ -138,6 +138,6 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
m_nnf.NoNameFound();
}
DbgUtils.logi( getClass(), "onPostExecute() done" );
DbgUtils.logi( TAG, "onPostExecute() done" );
}
}

View file

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

View file

@ -56,6 +56,7 @@ import java.util.concurrent.LinkedBlockingQueue;
public class RelayService extends XWService
implements NetStateCache.StateChangedIf {
private static final String TAG = RelayService.class.getSimpleName();
private static final int MAX_SEND = 1024;
private static final int MAX_BUF = MAX_SEND - 2;
private static final int REG_WAIT_INTERVAL = 10;
@ -142,7 +143,7 @@ public class RelayService extends XWService
public static void gcmConfirmed( Context context, boolean confirmed )
{
if ( s_gcmWorking != confirmed ) {
DbgUtils.logi( RelayService.class, "gcmConfirmed(): changing "
DbgUtils.logi( TAG, "gcmConfirmed(): changing "
+ "s_gcmWorking to %b", confirmed );
s_gcmWorking = confirmed;
}
@ -159,7 +160,7 @@ public class RelayService extends XWService
{
boolean enabled = ! XWPrefs
.getPrefsBoolean( context, R.string.key_disable_relay, false );
DbgUtils.logd( RelayService.class, "relayEnabled() => %b", enabled );
DbgUtils.logd( TAG, "relayEnabled() => %b", enabled );
return enabled;
}
@ -179,7 +180,7 @@ public class RelayService extends XWService
public static void startService( Context context )
{
DbgUtils.logi( RelayService.class, "startService()" );
DbgUtils.logi( TAG, "startService()" );
Intent intent = getIntentTo( context, MsgCmds.UDP_CHANGED );
context.startService( intent );
}
@ -217,7 +218,7 @@ public class RelayService extends XWService
public static int sendPacket( Context context, long rowid, byte[] msg )
{
DbgUtils.logd( RelayService.class, "sendPacket(len=%d)", msg.length );
DbgUtils.logd( TAG, "sendPacket(len=%d)", msg.length );
int result = -1;
if ( NetStateCache.netAvail( context ) ) {
Intent intent = getIntentTo( context, MsgCmds.SEND )
@ -226,7 +227,7 @@ public class RelayService extends XWService
context.startService( intent );
result = msg.length;
} else {
DbgUtils.logw( RelayService.class, "sendPacket: network down" );
DbgUtils.logw( TAG, "sendPacket: network down" );
}
return result;
}
@ -253,7 +254,7 @@ public class RelayService extends XWService
private void receiveInvitation( int srcDevID, NetLaunchInfo nli )
{
DbgUtils.logd( getClass(), "receiveInvitation: got nli from %d: %s", srcDevID,
DbgUtils.logd( TAG, "receiveInvitation: got nli from %d: %s", srcDevID,
nli.toString() );
if ( checkNotDupe( nli ) ) {
makeOrNotify( nli );
@ -305,7 +306,7 @@ public class RelayService extends XWService
// Exists to get incoming data onto the main thread
private static void postData( Context context, long rowid, byte[] msg )
{
DbgUtils.logd( RelayService.class, "postData(): packet of "
DbgUtils.logd( TAG, "postData(): packet of "
+ "length %d for token %d", msg.length, rowid );
if ( DBUtils.haveGame( context, rowid ) ) {
Intent intent = getIntentTo( context, MsgCmds.RECEIVE )
@ -313,7 +314,7 @@ public class RelayService extends XWService
.putExtra( BINBUFFER, msg );
context.startService( intent );
} else {
DbgUtils.logw( RelayService.class, "postData(): Dropping message for "
DbgUtils.logw( TAG, "postData(): Dropping message for "
+ "rowid %d: not on device", rowid );
}
}
@ -363,7 +364,7 @@ public class RelayService extends XWService
m_handler = new Handler();
m_onInactivity = new Runnable() {
public void run() {
DbgUtils.logd( getClass(), "m_onInactivity fired" );
DbgUtils.logd( TAG, "m_onInactivity fired" );
if ( !shouldMaintainConnection() ) {
NetStateCache.unregister( RelayService.this,
RelayService.this );
@ -387,7 +388,7 @@ public class RelayService extends XWService
cmd = null;
}
if ( null != cmd ) {
DbgUtils.logd( getClass(), "onStartCommand(): cmd=%s",
DbgUtils.logd( TAG, "onStartCommand(): cmd=%s",
cmd.toString() );
switch( cmd ) {
case PROCESS_GAME_MSGS:
@ -448,7 +449,7 @@ public class RelayService extends XWService
break;
case TIMER_FIRED:
if ( !NetStateCache.netAvail( this ) ) {
DbgUtils.logw( getClass(), "not connecting: no network" );
DbgUtils.logw( TAG, "not connecting: no network" );
} else if ( startFetchThreadIf() ) {
// do nothing
} else if ( registerWithRelayIfNot() ) {
@ -530,7 +531,7 @@ public class RelayService extends XWService
private void stopFetchThreadIf()
{
while ( null != m_fetchThread ) {
DbgUtils.logw( getClass(), "2: m_fetchThread NOT NULL; WHAT TO DO???" );
DbgUtils.logw( TAG, "2: m_fetchThread NOT NULL; WHAT TO DO???" );
try {
Thread.sleep( 20 );
} catch( java.lang.InterruptedException ie ) {
@ -549,7 +550,7 @@ public class RelayService extends XWService
connectSocket(); // block until this is done
startWriteThread();
DbgUtils.logi( getClass(), "read thread running" );
DbgUtils.logi( TAG, "read thread running" );
byte[] buf = new byte[1024];
for ( ; ; ) {
DatagramPacket packet =
@ -564,16 +565,16 @@ public class RelayService extends XWService
break;
}
}
DbgUtils.logi( getClass(), "read thread exiting" );
DbgUtils.logi( TAG, "read thread exiting" );
}
}, getClass().getName() );
m_UDPReadThread.start();
} else {
DbgUtils.logi( getClass(), "m_UDPReadThread not null and assumed to "
DbgUtils.logi( TAG, "m_UDPReadThread not null and assumed to "
+ "be running" );
}
} else {
DbgUtils.logi( getClass(), "startUDPThreadsIfNot(): UDP disabled" );
DbgUtils.logi( TAG, "startUDPThreadsIfNot(): UDP disabled" );
}
} // startUDPThreadsIfNot
@ -588,7 +589,7 @@ public class RelayService extends XWService
InetAddress addr = InetAddress.getByName( host );
m_UDPSocket.connect( addr, port ); // remember this address
DbgUtils.logd( getClass(), "connectSocket(%s:%d): m_UDPSocket"
DbgUtils.logd( TAG, "connectSocket(%s:%d): m_UDPSocket"
+ " now %H", host, port, m_UDPSocket );
} catch( java.net.SocketException se ) {
DbgUtils.logex( se );
@ -598,7 +599,7 @@ public class RelayService extends XWService
}
} else {
Assert.assertTrue( m_UDPSocket.isConnected() );
DbgUtils.logi( getClass(), "m_UDPSocket not null" );
DbgUtils.logi( TAG, "m_UDPSocket not null" );
}
}
@ -607,18 +608,18 @@ public class RelayService extends XWService
if ( null == m_UDPWriteThread ) {
m_UDPWriteThread = new Thread( null, new Runnable() {
public void run() {
DbgUtils.logi( getClass(), "write thread starting" );
DbgUtils.logi( TAG, "write thread starting" );
for ( ; ; ) {
PacketData outData;
try {
outData = m_queue.take();
} catch ( InterruptedException ie ) {
DbgUtils.logw( getClass(), "write thread killed" );
DbgUtils.logw( TAG, "write thread killed" );
break;
}
if ( null == outData
|| 0 == outData.getLength() ) {
DbgUtils.logi( getClass(), "stopping write thread" );
DbgUtils.logi( TAG, "stopping write thread" );
break;
}
@ -626,7 +627,7 @@ public class RelayService extends XWService
DatagramPacket outPacket = outData.assemble();
m_UDPSocket.send( outPacket );
int pid = outData.m_packetID;
DbgUtils.logd( getClass(), "Sent udp packet, cmd=%s, id=%d,"
DbgUtils.logd( TAG, "Sent udp packet, cmd=%s, id=%d,"
+ " of length %d",
outData.m_cmd.toString(),
pid, outPacket.getLength());
@ -637,7 +638,7 @@ public class RelayService extends XWService
ConnStatusHandler.showSuccessOut();
} catch ( java.net.SocketException se ) {
DbgUtils.logex( se );
DbgUtils.logi( getClass(), "Restarting threads to force"
DbgUtils.logi( TAG, "Restarting threads to force"
+ " new socket" );
m_handler.post( new Runnable() {
public void run() {
@ -647,15 +648,15 @@ public class RelayService extends XWService
} catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe );
} catch ( NullPointerException npe ) {
DbgUtils.logw( getClass(), "network problem; dropping packet" );
DbgUtils.logw( TAG, "network problem; dropping packet" );
}
}
DbgUtils.logi( getClass(), "write thread exiting" );
DbgUtils.logi( TAG, "write thread exiting" );
}
}, getClass().getName() );
m_UDPWriteThread.start();
} else {
DbgUtils.logi( getClass(), "m_UDPWriteThread not null and assumed to "
DbgUtils.logi( TAG, "m_UDPWriteThread not null and assumed to "
+ "be running" );
}
}
@ -666,9 +667,9 @@ public class RelayService extends XWService
// can't add null
m_queue.add( new PacketData() );
try {
DbgUtils.logd( getClass(), "joining m_UDPWriteThread" );
DbgUtils.logd( TAG, "joining m_UDPWriteThread" );
m_UDPWriteThread.join();
DbgUtils.logd( getClass(), "SUCCESSFULLY joined m_UDPWriteThread" );
DbgUtils.logd( TAG, "SUCCESSFULLY joined m_UDPWriteThread" );
} catch( java.lang.InterruptedException ie ) {
DbgUtils.logex( ie );
}
@ -699,11 +700,11 @@ public class RelayService extends XWService
if ( !skipAck ) {
sendAckIf( header );
}
DbgUtils.logd( getClass(), "gotPacket(): cmd=%s", header.m_cmd.toString() );
DbgUtils.logd( TAG, "gotPacket(): cmd=%s", header.m_cmd.toString() );
switch ( header.m_cmd ) {
case XWPDEV_UNAVAIL:
int unavail = dis.readInt();
DbgUtils.logi( getClass(), "relay unvailable for another %d seconds",
DbgUtils.logi( TAG, "relay unvailable for another %d seconds",
unavail );
String str = getVLIString( dis );
sendResult( MultiEvent.RELAY_ALERT, str );
@ -717,7 +718,7 @@ public class RelayService extends XWService
break;
case XWPDEV_BADREG:
str = getVLIString( dis );
DbgUtils.logi( getClass(), "bad relayID \"%s\" reported", str );
DbgUtils.logi( TAG, "bad relayID \"%s\" reported", str );
DevID.clearRelayDevID( this );
s_registered = false;
registerWithRelay();
@ -725,7 +726,7 @@ public class RelayService extends XWService
case XWPDEV_REGRSP:
str = getVLIString( dis );
short maxIntervalSeconds = dis.readShort();
DbgUtils.logd( getClass(), "got relayid %s (%d), maxInterval %d", str,
DbgUtils.logd( TAG, "got relayid %s (%d), maxInterval %d", str,
Integer.parseInt( str, 16 ),
maxIntervalSeconds );
setMaxIntervalSeconds( maxIntervalSeconds );
@ -764,7 +765,7 @@ public class RelayService extends XWService
NetLaunchInfo nli = XwJNI.nliFromStream( nliData );
intent.putExtra( INVITE_FROM, srcDevID );
String asStr = nli.toString();
DbgUtils.logd( getClass(), "got invitation: %s", asStr );
DbgUtils.logd( TAG, "got invitation: %s", asStr );
intent.putExtra( NLI_DATA, asStr );
startService( intent );
break;
@ -777,7 +778,7 @@ public class RelayService extends XWService
// DbgUtils.logf( "RelayService: got invite: %s", nliData );
// break;
default:
DbgUtils.logw( getClass(), "gotPacket(): Unhandled cmd" );
DbgUtils.logw( TAG, "gotPacket(): Unhandled cmd" );
break;
}
}
@ -809,7 +810,7 @@ public class RelayService extends XWService
boolean registered = null != relayID;
should = !registered;
}
DbgUtils.logd( getClass(), "shouldRegister()=>%b", should );
DbgUtils.logd( TAG, "shouldRegister()=>%b", should );
return should;
}
@ -826,7 +827,7 @@ public class RelayService extends XWService
long now = Utils.getCurSeconds();
long interval = now - s_regStartTime;
if ( interval < REG_WAIT_INTERVAL ) {
DbgUtils.logi( getClass(), "registerWithRelay: skipping because only %d "
DbgUtils.logi( TAG, "registerWithRelay: skipping because only %d "
+ "seconds since last start", interval );
} else {
String relayID = DevID.getRelayDevID( this );
@ -847,7 +848,7 @@ public class RelayService extends XWService
writeVLIString( out, devid );
}
DbgUtils.logd( getClass(), "registering devID \"%s\" (type=%s)", devid,
DbgUtils.logd( TAG, "registering devID \"%s\" (type=%s)", devid,
typ.toString() );
out.writeShort( BuildConstants.CLIENT_VERS_RELAY );
@ -930,14 +931,14 @@ public class RelayService extends XWService
private void sendInvitation( int srcDevID, int destDevID, String relayID,
String nliStr )
{
DbgUtils.logd( getClass(), "sendInvitation(%d->%d/%s [%s])", srcDevID, destDevID,
DbgUtils.logd( TAG, "sendInvitation(%d->%d/%s [%s])", srcDevID, destDevID,
relayID, nliStr );
NetLaunchInfo nli = new NetLaunchInfo( this, nliStr );
byte[] nliData = XwJNI.nliToStream( nli );
if ( BuildConfig.DEBUG ) {
NetLaunchInfo tmp = XwJNI.nliFromStream( nliData );
DbgUtils.logd( getClass(), "sendInvitation: compare these: %s vs %s",
DbgUtils.logd( TAG, "sendInvitation: compare these: %s vs %s",
nli.toString(), tmp.toString() );
}
@ -983,13 +984,13 @@ public class RelayService extends XWService
if ( XWPDevProto.XWPDEV_PROTO_VERSION_1.ordinal() == proto ) {
int packetID = vli2un( dis );
if ( 0 != packetID ) {
DbgUtils.logd( getClass(), "readHeader(): got packetID %d", packetID );
DbgUtils.logd( TAG, "readHeader(): got packetID %d", packetID );
}
byte ordinal = dis.readByte();
XWRelayReg cmd = XWRelayReg.values()[ordinal];
result = new PacketHeader( cmd, packetID );
} else {
DbgUtils.logw( getClass(), "bad proto: %d", proto );
DbgUtils.logw( TAG, "bad proto: %d", proto );
}
return result;
}
@ -1114,7 +1115,7 @@ public class RelayService extends XWService
if ( msgLen + thisLen > MAX_BUF ) {
// Need to deal with this case by sending multiple
// packets. It WILL happen.
DbgUtils.logw( getClass(), "dropping send for lack of space; FIX ME!!" );
DbgUtils.logw( TAG, "dropping send for lack of space; FIX ME!!" );
Assert.fail();
break;
}
@ -1156,7 +1157,7 @@ public class RelayService extends XWService
if ( null != msgHash ) {
new AsyncSender( context, msgHash ).execute();
} else {
DbgUtils.logw( RelayService.class, "sendToRelay: null msgs" );
DbgUtils.logw( TAG, "sendToRelay: null msgs" );
}
} // sendToRelay
@ -1220,9 +1221,9 @@ public class RelayService extends XWService
if ( s_packetsSent.contains( packetID ) ) {
s_packetsSent.remove( packetID );
} else {
DbgUtils.logw( RelayService.class, "Weird: got ack %d but never sent", packetID );
DbgUtils.logw( TAG, "Weird: got ack %d but never sent", packetID );
}
DbgUtils.logd( RelayService.class, "noteAck(): Got ack for %d; "
DbgUtils.logd( TAG, "noteAck(): Got ack for %d; "
+ "there are %d unacked packets",
packetID, s_packetsSent.size() );
}
@ -1241,7 +1242,7 @@ public class RelayService extends XWService
private void startThreads()
{
DbgUtils.logd( getClass(), "startThreads()" );
DbgUtils.logd( TAG, "startThreads()" );
if ( !relayEnabled( this ) || !NetStateCache.netAvail( this ) ) {
stopThreads();
} else if ( XWApp.UDP_ENABLED ) {
@ -1256,7 +1257,7 @@ public class RelayService extends XWService
private void stopThreads()
{
DbgUtils.logd( getClass(), "stopThreads()" );
DbgUtils.logd( TAG, "stopThreads()" );
stopFetchThreadIf();
stopUDPThreadsIf();
}
@ -1287,7 +1288,7 @@ public class RelayService extends XWService
for ( int count = 0; !done; ++count ) {
nRead = is.read( buf );
if ( 1 != nRead ) {
DbgUtils.logw( RelayService.class, "vli2un: unable to read from stream" );
DbgUtils.logw( TAG, "vli2un: unable to read from stream" );
break;
}
int byt = buf[0];
@ -1315,7 +1316,7 @@ public class RelayService extends XWService
private void setMaxIntervalSeconds( int maxIntervalSeconds )
{
DbgUtils.logd( getClass(), "IGNORED: setMaxIntervalSeconds(%d); "
DbgUtils.logd( TAG, "IGNORED: setMaxIntervalSeconds(%d); "
+ "using -1 instead", maxIntervalSeconds );
maxIntervalSeconds = -1;
if ( m_maxIntervalSeconds != maxIntervalSeconds ) {
@ -1337,7 +1338,7 @@ public class RelayService extends XWService
result = figureBackoffSeconds();
}
DbgUtils.logd( getClass(), "getMaxIntervalSeconds() => %d", result );
DbgUtils.logd( TAG, "getMaxIntervalSeconds() => %d", result );
return result;
}
@ -1378,7 +1379,7 @@ public class RelayService extends XWService
long interval = Utils.getCurSeconds() - m_lastGamePacketReceived;
result = interval < MAX_KEEPALIVE_SECS;
}
DbgUtils.logd( getClass(), "shouldMaintainConnection=>%b", result );
DbgUtils.logd( TAG, "shouldMaintainConnection=>%b", result );
return result;
}
@ -1408,7 +1409,7 @@ public class RelayService extends XWService
diff = s_curNextTimer - now;
}
Assert.assertTrue( diff < Integer.MAX_VALUE );
DbgUtils.logd( getClass(), "figureBackoffSeconds() => %d", diff );
DbgUtils.logd( TAG, "figureBackoffSeconds() => %d", diff );
result = (int)diff;
}
return result;
@ -1459,7 +1460,7 @@ public class RelayService extends XWService
try {
m_packetID = nextPacketID( m_cmd );
DataOutputStream out = new DataOutputStream( bas );
DbgUtils.logd( getClass(), "makeHeader(): building packet with cmd %s",
DbgUtils.logd( TAG, "makeHeader(): building packet with cmd %s",
m_cmd.toString() );
out.writeByte( XWPDevProto.XWPDEV_PROTO_VERSION_1.ordinal() );
un2vli( m_packetID, out );

View file

@ -44,4 +44,3 @@ public enum RequestCode {
// SMSInviteDelegate
GET_CONTACT,
}

View file

@ -67,4 +67,3 @@ public class SMSListItem extends LinearLayout {
return cb.isChecked();
}
}

View file

@ -198,7 +198,7 @@ public class SMSService extends XWService {
Intent intent = getIntentTo( context, SMSAction.INVITE );
intent.putExtra( PHONE, phone );
String asString = nli.toString();
DbgUtils.logw( SMSService.class, "inviteRemote(%s, '%s')", phone, asString );
DbgUtils.logw( TAG, "inviteRemote(%s, '%s')", phone, asString );
intent.putExtra( GAMEDATA_STR, asString );
context.startService( intent );
}
@ -215,7 +215,7 @@ public class SMSService extends XWService {
context.startService( intent );
nSent = binmsg.length;
} else {
DbgUtils.logi( SMSService.class, "sendPacket: dropping because SMS disabled" );
DbgUtils.logi( TAG, "sendPacket: dropping because SMS disabled" );
}
return nSent;
}
@ -252,7 +252,7 @@ public class SMSService extends XWService {
if ( hashRead == hashCode ) {
result = tmp;
} else {
DbgUtils.logw( SMSService.class, "fromPublicFmt: hash code mismatch" );
DbgUtils.logw( TAG, "fromPublicFmt: hash code mismatch" );
}
} catch( Exception e ) {
}
@ -376,7 +376,7 @@ public class SMSService extends XWService {
private void inviteRemote( String phone, String nliData )
{
DbgUtils.logi( getClass(), "inviteRemote()" );
DbgUtils.logi( TAG, "inviteRemote()" );
ByteArrayOutputStream bas = new ByteArrayOutputStream( 128 );
DataOutputStream dos = new DataOutputStream( bas );
try {
@ -483,7 +483,7 @@ public class SMSService extends XWService {
start = end;
}
} else {
DbgUtils.logw( getClass(), "breakAndEncode(): msg count %d too large; dropping",
DbgUtils.logw( TAG, "breakAndEncode(): msg count %d too large; dropping",
count );
}
return result;
@ -491,7 +491,7 @@ public class SMSService extends XWService {
private void receive( SMS_CMD cmd, byte[] data, String phone )
{
DbgUtils.logi( getClass(), "receive(cmd=%s)", cmd.toString() );
DbgUtils.logi( TAG, "receive(cmd=%s)", cmd.toString() );
DataInputStream dis =
new DataInputStream( new ByteArrayInputStream(data) );
try {
@ -510,7 +510,7 @@ public class SMSService extends XWService {
nli.gameID() );
}
} else {
DbgUtils.logw( getClass(), "invalid nli from: %s", nliData );
DbgUtils.logw( TAG, "invalid nli from: %s", nliData );
}
break;
case DATA:
@ -529,7 +529,7 @@ public class SMSService extends XWService {
gameID );
break;
default:
DbgUtils.logw( getClass(), "unexpected cmd %s", cmd.toString() );
DbgUtils.logw( TAG, "unexpected cmd %s", cmd.toString() );
break;
}
} catch ( java.io.IOException ioe ) {
@ -548,7 +548,7 @@ public class SMSService extends XWService {
if ( tryAssemble( senderPhone, id, index, count, rest ) ) {
sendResult( MultiEvent.SMS_RECEIVE_OK );
} else {
DbgUtils.logw( getClass(), "SMSService: receiveBuffer(): bogus message from"
DbgUtils.logw( TAG, "SMSService: receiveBuffer(): bogus message from"
+ " phone %s", senderPhone );
}
}
@ -600,11 +600,11 @@ public class SMSService extends XWService {
gotPort = dis.readShort();
}
if ( SMS_PROTO_VERSION < proto ) {
DbgUtils.logw( getClass(), "SMSService.disAssemble: bad proto %d from %s;"
DbgUtils.logw( TAG, "SMSService.disAssemble: bad proto %d from %s;"
+ " dropping", proto, senderPhone );
sendResult( MultiEvent.BAD_PROTO_SMS, senderPhone );
} else if ( gotPort != myPort ) {
DbgUtils.logd( getClass(), "disAssemble(): received on port %d"
DbgUtils.logd( TAG, "disAssemble(): received on port %d"
+ " but expected %d", gotPort, myPort );
} else {
SMS_CMD cmd = SMS_CMD.values()[dis.readByte()];
@ -617,7 +617,7 @@ public class SMSService extends XWService {
DbgUtils.logex( ioe );
} catch ( ArrayIndexOutOfBoundsException oob ) {
// enum this older code doesn't know about; drop it
DbgUtils.logw( getClass(), "disAssemble: dropping message with too-new enum" );
DbgUtils.logw( TAG, "disAssemble: dropping message with too-new enum" );
}
return success;
}
@ -670,12 +670,12 @@ public class SMSService extends XWService {
for ( byte[] fragment : fragments ) {
mgr.sendDataMessage( phone, null, nbsPort, fragment, sent,
delivery );
DbgUtils.logi( getClass(), "sendBuffers(): sent %d byte fragment",
DbgUtils.logi( TAG, "sendBuffers(): sent %d byte fragment",
fragment.length );
}
success = true;
} catch ( IllegalArgumentException iae ) {
DbgUtils.logw( getClass(), "sendBuffers(%s): %s", phone, iae.toString() );
DbgUtils.logw( TAG, "sendBuffers(%s): %s", phone, iae.toString() );
} catch ( NullPointerException npe ) {
Assert.fail(); // shouldn't be trying to do this!!!
} catch ( Exception ee ) {
@ -683,7 +683,7 @@ public class SMSService extends XWService {
}
}
} else {
DbgUtils.logi( getClass(), "dropping because SMS disabled" );
DbgUtils.logi( TAG, "dropping because SMS disabled" );
}
if ( showToasts( this ) && success && (0 == (s_nSent % 5)) ) {
@ -721,7 +721,7 @@ public class SMSService extends XWService {
case SmsManager.RESULT_ERROR_NO_SERVICE:
DbgUtils.showf( SMSService.this, "NO SERVICE!!!" );
default:
DbgUtils.logw( getClass(), "FAILURE!!!" );
DbgUtils.logw( TAG, "FAILURE!!!" );
sendResult( MultiEvent.SMS_SEND_FAILED );
break;
}
@ -734,7 +734,7 @@ public class SMSService extends XWService {
public void onReceive( Context context, Intent intent )
{
if ( Activity.RESULT_OK != getResultCode() ) {
DbgUtils.logw( getClass(), "SMS delivery result: FAILURE" );
DbgUtils.logw( TAG, "SMS delivery result: FAILURE" );
}
}
};
@ -754,7 +754,7 @@ public class SMSService extends XWService {
}
}
}
DbgUtils.logi( SMSService.class, "matchKeyIf(%s) => %s", phone, result );
DbgUtils.logi( TAG, "matchKeyIf(%s) => %s", phone, result );
return result;
}

View file

@ -35,4 +35,3 @@ public interface SelectableItem {
public void itemToggled( LongClickHandler toggled, boolean selected );
public boolean getSelected( LongClickHandler obj );
}

View file

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

View file

@ -177,7 +177,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
params.put( k_STRINGSHASH, BuildConstants.STRINGS_HASH );
params.put( k_NAME, packageName );
params.put( k_AVERS, versionCode );
DbgUtils.logd( UpdateCheckReceiver.class, "current update: %s",
DbgUtils.logd( TAG, "current update: %s",
params.toString() );
new UpdateQueryTask( context, params, fromUI, pm,
packageName, dals ).execute();
@ -366,8 +366,8 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
}
} catch ( org.json.JSONException jse ) {
DbgUtils.logex( jse );
DbgUtils.logw( getClass(), "sent: \"%s\"", params.toString() );
DbgUtils.logw( getClass(), "received: \"%s\"", jstr );
DbgUtils.logw( TAG, "sent: \"%s\"", params.toString() );
DbgUtils.logw( TAG, "received: \"%s\"", jstr );
} catch ( PackageManager.NameNotFoundException nnfe ) {
DbgUtils.logex( nnfe );
}

View file

@ -182,7 +182,7 @@ public class WiDirService extends XWService {
ChannelListener listener = new ChannelListener() {
@Override
public void onChannelDisconnected() {
DbgUtils.logd( CLAZZ, "onChannelDisconnected()");
DbgUtils.logd( TAG, "onChannelDisconnected()");
}
};
sChannel = getMgr().initialize( context, Looper.getMainLooper(),
@ -208,7 +208,7 @@ public class WiDirService extends XWService {
sMacAddress = DBUtils.getStringFor( context, MAC_ADDR_KEY, null );
}
}
DbgUtils.logd( CLAZZ, "getMyMacAddress() => %s",
DbgUtils.logd( TAG, "getMyMacAddress() => %s",
sMacAddress );
// Assert.assertNotNull(sMacAddress);
return sMacAddress;
@ -242,16 +242,16 @@ public class WiDirService extends XWService {
public static void inviteRemote( Context context, String macAddr,
NetLaunchInfo nli )
{
DbgUtils.logd( CLAZZ, "inviteRemote(%s)", macAddr );
DbgUtils.logd( TAG, "inviteRemote(%s)", macAddr );
Assert.assertNotNull( macAddr );
String nliString = nli.toString();
DbgUtils.logd( CLAZZ, "inviteRemote(%s)", nliString );
DbgUtils.logd( TAG, "inviteRemote(%s)", nliString );
boolean[] forwarding = { false };
BiDiSockWrap wrap = getForSend( macAddr, forwarding );
if ( null == wrap ) {
DbgUtils.loge( CLAZZ, "inviteRemote: no socket for %s", macAddr );
DbgUtils.loge( TAG, "inviteRemote: no socket for %s", macAddr );
} else {
try {
JSONObject packet = new JSONObject()
@ -272,7 +272,7 @@ public class WiDirService extends XWService {
public static int sendPacket( Context context, String macAddr, int gameID,
byte[] buf )
{
DbgUtils.logd( CLAZZ, "sendPacket(len=%d,addr=%s)", buf.length, macAddr );
DbgUtils.logd( TAG, "sendPacket(len=%d,addr=%s)", buf.length, macAddr );
int nSent = -1;
boolean[] forwarding = { false };
@ -295,7 +295,7 @@ public class WiDirService extends XWService {
DbgUtils.logex( jse );
}
} else {
DbgUtils.logd( CLAZZ, "sendPacket: no socket for %s", macAddr );
DbgUtils.logd( TAG, "sendPacket: no socket for %s", macAddr );
}
return nSent;
}
@ -305,7 +305,7 @@ public class WiDirService extends XWService {
if ( WIFI_DIRECT_ENABLED ) {
if ( initListeners( activity ) ) {
activity.registerReceiver( sReceiver, sIntentFilter );
DbgUtils.logd( CLAZZ, "activityResumed() done" );
DbgUtils.logd( TAG, "activityResumed() done" );
startDiscovery();
}
}
@ -321,7 +321,7 @@ public class WiDirService extends XWService {
} catch ( IllegalArgumentException iae ) {
DbgUtils.logex( iae );
}
DbgUtils.logd( CLAZZ, "activityPaused() done" );
DbgUtils.logd( TAG, "activityPaused() done" );
// Examples seem to kick discovery off once and that's it
// sDiscoveryStarted = false;
@ -340,13 +340,13 @@ public class WiDirService extends XWService {
sIface = new BiDiSockWrap.Iface() {
public void gotPacket( BiDiSockWrap socket, byte[] bytes )
{
DbgUtils.logd( CLAZZ, "wrapper got packet!!!" );
DbgUtils.logd( TAG, "wrapper got packet!!!" );
processPacket( socket, bytes );
}
public void connectStateChanged( BiDiSockWrap wrap, boolean nowConnected )
{
DbgUtils.logd( CLAZZ, "connectStateChanged(con=%b)", nowConnected );
DbgUtils.logd( TAG, "connectStateChanged(con=%b)", nowConnected );
if ( nowConnected ) {
try {
wrap.send( new JSONObject()
@ -359,7 +359,7 @@ public class WiDirService extends XWService {
} else {
int sizeBefore = sSocketWrapMap.size();
sSocketWrapMap.values().remove( wrap );
DbgUtils.logd( CLAZZ, "removed wrap; had %d, now have %d",
DbgUtils.logd( TAG, "removed wrap; had %d, now have %d",
sizeBefore, sSocketWrapMap.size() );
if ( 0 == sSocketWrapMap.size() ) {
updateStatusIn( false );
@ -376,9 +376,9 @@ public class WiDirService extends XWService {
sGroupListener = new GroupInfoListener() {
public void onGroupInfoAvailable( WifiP2pGroup group ) {
if ( null == group ) {
DbgUtils.logd( CLAZZ, "onGroupInfoAvailable(null)!" );
DbgUtils.logd( TAG, "onGroupInfoAvailable(null)!" );
} else {
DbgUtils.logd( CLAZZ, "onGroupInfoAvailable(owner: %b)!",
DbgUtils.logd( TAG, "onGroupInfoAvailable(owner: %b)!",
group.isGroupOwner() );
Assert.assertTrue( sAmGroupOwner == group.isGroupOwner() );
if ( sAmGroupOwner ) {
@ -389,18 +389,18 @@ public class WiDirService extends XWService {
sUserMap.put( macAddr, dev.deviceName );
BiDiSockWrap wrap = sSocketWrapMap.get( macAddr );
if ( null == wrap ) {
DbgUtils.logd( CLAZZ,
DbgUtils.logd( TAG,
"groupListener: no socket for %s",
macAddr );
} else {
DbgUtils.logd( CLAZZ, "socket for %s connected: %b",
DbgUtils.logd( TAG, "socket for %s connected: %b",
macAddr, wrap.isConnected() );
}
}
}
}
}
DbgUtils.logd( CLAZZ, "thread count: %d", Thread.activeCount() );
DbgUtils.logd( TAG, "thread count: %d", Thread.activeCount() );
new Handler().postDelayed( new Runnable() {
@Override
public void run() {
@ -419,7 +419,7 @@ public class WiDirService extends XWService {
sReceiver = new WFDBroadcastReceiver( mgr, sChannel );
succeeded = true;
} catch ( SecurityException se ) {
DbgUtils.logd( CLAZZ, "disabling wifi; no permissions" );
DbgUtils.logd( TAG, "disabling wifi; no permissions" );
WIFI_DIRECT_ENABLED = false;
}
} else {
@ -455,7 +455,7 @@ public class WiDirService extends XWService {
private void schedule( int waitSeconds )
{
DbgUtils.logd( CLAZZ, "scheduling %s in %d seconds",
DbgUtils.logd( TAG, "scheduling %s in %d seconds",
m_curState.toString(), waitSeconds );
m_handler.removeCallbacks( this ); // remove any others
m_handler.postDelayed( this, waitSeconds * 1000 );
@ -464,7 +464,7 @@ public class WiDirService extends XWService {
// ActionListener interface
@Override
public void onSuccess() {
DbgUtils.logd( CLAZZ, "onSuccess(): state %s done",
DbgUtils.logd( TAG, "onSuccess(): state %s done",
m_curState.toString() );
m_curState = State.values()[m_curState.ordinal() + 1];
schedule( 0 );
@ -472,7 +472,7 @@ public class WiDirService extends XWService {
@Override
public void onFailure(int code) {
DbgUtils.logd( CLAZZ, "onFailure(): state %s failed",
DbgUtils.logd( TAG, "onFailure(): state %s failed",
m_curState.toString() );
switch ( code ) {
case WifiP2pManager.ERROR:
@ -558,7 +558,7 @@ public class WiDirService extends XWService {
WifiP2pDevice srcDevice) {
// Service has been discovered. My app?
if ( instanceName.equalsIgnoreCase( SERVICE_NAME ) ) {
DbgUtils.logd( CLAZZ, "onBonjourServiceAvailable "
DbgUtils.logd( TAG, "onBonjourServiceAvailable "
+ instanceName + " with name "
+ srcDevice.deviceName );
tryConnect( srcDevice );
@ -572,13 +572,13 @@ public class WiDirService extends XWService {
public void onDnsSdTxtRecordAvailable( String domainName,
Map<String, String> map,
WifiP2pDevice device ) {
DbgUtils.logd( CLAZZ,
DbgUtils.logd( TAG,
"onDnsSdTxtRecordAvailable(avail: %s, port: %s; name: %s)",
map.get("AVAILABLE"), map.get("PORT"), map.get("NAME"));
}
};
mgr.setDnsSdResponseListeners( sChannel, srl, trl );
DbgUtils.logd( CLAZZ, "setDiscoveryListeners done" );
DbgUtils.logd( TAG, "setDiscoveryListeners done" );
}
}
@ -590,7 +590,7 @@ public class WiDirService extends XWService {
long now = Utils.getCurSeconds();
result = 3 >= now - when;
}
DbgUtils.logd( CLAZZ, "connectPending(%s)=>%b",
DbgUtils.logd( TAG, "connectPending(%s)=>%b",
macAddress, result );
return result;
}
@ -605,12 +605,12 @@ public class WiDirService extends XWService {
final String macAddress = device.deviceAddress;
if ( sSocketWrapMap.containsKey(macAddress)
&& sSocketWrapMap.get(macAddress).isConnected() ) {
DbgUtils.logd( CLAZZ, "tryConnect(%s): already connected",
DbgUtils.logd( TAG, "tryConnect(%s): already connected",
macAddress );
} else if ( connectPending( macAddress ) ) {
// Do nothing
} else {
DbgUtils.logd( CLAZZ, "trying to connect to %s", macAddress );
DbgUtils.logd( TAG, "trying to connect to %s", macAddress );
WifiP2pConfig config = new WifiP2pConfig();
config.deviceAddress = macAddress;
config.wps.setup = WpsInfo.PBC;
@ -618,12 +618,12 @@ public class WiDirService extends XWService {
getMgr().connect( sChannel, config, new ActionListener() {
@Override
public void onSuccess() {
DbgUtils.logd( CLAZZ, "onSuccess(): %s", "connect_xx" );
DbgUtils.logd( TAG, "onSuccess(): %s", "connect_xx" );
notePending( macAddress );
}
@Override
public void onFailure(int reason) {
DbgUtils.logd( CLAZZ, "onFailure(%d): %s", reason, "connect_xx");
DbgUtils.logd( TAG, "onFailure(%d): %s", reason, "connect_xx");
}
} );
}
@ -632,7 +632,7 @@ public class WiDirService extends XWService {
private static void connectToOwner( InetAddress addr )
{
BiDiSockWrap wrap = new BiDiSockWrap( addr, OWNER_PORT, sIface );
DbgUtils.logd( CLAZZ, "connectToOwner(%s)", addr.toString() );
DbgUtils.logd( TAG, "connectToOwner(%s)", addr.toString() );
wrap.connect();
}
@ -643,7 +643,7 @@ public class WiDirService extends XWService {
if ( null != macAddress ) {
// this has fired. Sockets close and re-open?
sSocketWrapMap.put( macAddress, wrap );
DbgUtils.logd( CLAZZ,
DbgUtils.logd( TAG,
"storeByAddress(); storing wrap for %s",
macAddress );
}
@ -651,7 +651,7 @@ public class WiDirService extends XWService {
private void handleGotMessage( Intent intent )
{
DbgUtils.logd( CLAZZ, "handleGotMessage(%s)", intent.toString() );
DbgUtils.logd( TAG, "handleGotMessage(%s)", intent.toString() );
int gameID = intent.getIntExtra( KEY_GAMEID, 0 );
byte[] data = XwJNI.base64Decode( intent.getStringExtra( KEY_DATA ) );
String macAddress = intent.getStringExtra( KEY_RETADDR );
@ -664,7 +664,7 @@ public class WiDirService extends XWService {
private void handleGotInvite( Intent intent )
{
DbgUtils.logd( CLAZZ, "handleGotInvite()" );
DbgUtils.logd( TAG, "handleGotInvite()" );
String nliData = intent.getStringExtra( KEY_NLI );
NetLaunchInfo nli = new NetLaunchInfo( this, nliData );
String returnMac = intent.getStringExtra( KEY_SRC );
@ -704,10 +704,10 @@ public class WiDirService extends XWService {
private static void processPacket( BiDiSockWrap wrap, byte[] bytes )
{
String asStr = new String(bytes);
DbgUtils.logd( CLAZZ, "got string: %s", asStr );
DbgUtils.logd( TAG, "got string: %s", asStr );
try {
JSONObject asObj = new JSONObject( asStr );
DbgUtils.logd( CLAZZ, "got json: %s", asObj.toString() );
DbgUtils.logd( TAG, "got json: %s", asObj.toString() );
final String cmd = asObj.optString( KEY_CMD, "" );
if ( cmd.equals( CMD_PING ) ) {
storeByAddress( wrap, asObj );
@ -843,16 +843,16 @@ public class WiDirService extends XWService {
private static void forwardPacket( byte[] bytes, String destAddr )
{
DbgUtils.logd( CLAZZ, "forwardPacket(mac=%s)", destAddr );
DbgUtils.logd( TAG, "forwardPacket(mac=%s)", destAddr );
if ( sAmGroupOwner ) {
BiDiSockWrap wrap = sSocketWrapMap.get( destAddr );
if ( null != wrap && wrap.isConnected() ) {
wrap.send( bytes );
} else {
DbgUtils.loge( CLAZZ, "no working socket for %s", destAddr );
DbgUtils.loge( TAG, "no working socket for %s", destAddr );
}
} else {
DbgUtils.loge( CLAZZ, "can't forward; not group owner (any more?)" );
DbgUtils.loge( TAG, "can't forward; not group owner (any more?)" );
}
}
@ -861,20 +861,20 @@ public class WiDirService extends XWService {
sAmServer = true;
sAcceptThread = new Thread( new Runnable() {
public void run() {
DbgUtils.logd( CLAZZ, "accept thread starting" );
DbgUtils.logd( TAG, "accept thread starting" );
try {
sServerSock = new ServerSocket( OWNER_PORT );
while ( sAmServer ) {
DbgUtils.logd( CLAZZ, "calling accept()" );
DbgUtils.logd( TAG, "calling accept()" );
Socket socket = sServerSock.accept();
DbgUtils.logd( CLAZZ, "accept() returned!!" );
DbgUtils.logd( TAG, "accept() returned!!" );
new BiDiSockWrap( socket, sIface );
}
} catch ( IOException ioe ) {
sAmServer = false;
DbgUtils.logex( ioe );
}
DbgUtils.logd( CLAZZ, "accept thread exiting" );
DbgUtils.logd( TAG, "accept thread exiting" );
}
} );
sAcceptThread.start();
@ -910,7 +910,7 @@ public class WiDirService extends XWService {
// See if we need to forward through group owner instead
if ( null == wrap && !sAmGroupOwner && 1 == sSocketWrapMap.size() ) {
wrap = sSocketWrapMap.values().iterator().next();
DbgUtils.logd( CLAZZ, "forwarding to %s through group owner", macAddr );
DbgUtils.logd( TAG, "forwarding to %s through group owner", macAddr );
forwarding[0] = true;
}
@ -936,12 +936,12 @@ public class WiDirService extends XWService {
public void onReceive( Context context, Intent intent ) {
if ( WIFI_DIRECT_ENABLED ) {
String action = intent.getAction();
DbgUtils.logd( CLAZZ, "got intent: " + intent.toString() );
DbgUtils.logd( TAG, "got intent: " + intent.toString() );
if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) {
int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1);
sEnabled = state == WifiP2pManager.WIFI_P2P_STATE_ENABLED;
DbgUtils.logd( CLAZZ, "WifiP2PEnabled: %b", sEnabled );
DbgUtils.logd( TAG, "WifiP2PEnabled: %b", sEnabled );
} else if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {
mManager.requestPeers( mChannel, this );
} else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) {
@ -949,12 +949,12 @@ public class WiDirService extends XWService {
NetworkInfo networkInfo = (NetworkInfo)intent
.getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
if ( networkInfo.isConnected() ) {
DbgUtils.logd( CLAZZ, "network %s connected",
DbgUtils.logd( TAG, "network %s connected",
networkInfo.toString() );
mManager.requestConnectionInfo(mChannel, this );
} else {
// here
DbgUtils.logd( CLAZZ, "network %s NOT connected",
DbgUtils.logd( TAG, "network %s NOT connected",
networkInfo.toString() );
}
} else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {
@ -966,7 +966,7 @@ public class WiDirService extends XWService {
synchronized( sUserMap ) {
sUserMap.put( sMacAddress, sDeviceName );
}
DbgUtils.logd( CLAZZ, "Got my MAC Address: %s and name: %s",
DbgUtils.logd( TAG, "Got my MAC Address: %s and name: %s",
sMacAddress, sDeviceName );
String stored = DBUtils.getStringFor( context, MAC_ADDR_KEY, null );
@ -985,7 +985,7 @@ public class WiDirService extends XWService {
// InetAddress from WifiP2pInfo struct.
InetAddress groupOwnerAddress = info.groupOwnerAddress;
String hostAddress = groupOwnerAddress.getHostAddress();
DbgUtils.logd( CLAZZ, "onConnectionInfoAvailable(%s); addr: %s",
DbgUtils.logd( TAG, "onConnectionInfoAvailable(%s); addr: %s",
info.toString(), hostAddress );
// After the group negotiation, we can determine the group owner.
@ -993,10 +993,10 @@ public class WiDirService extends XWService {
sAmGroupOwner = info.isGroupOwner;
if ( info.isGroupOwner ) {
DbgUtils.showf( "Joining %s WiFi P2p group as owner", SERVICE_NAME );
DbgUtils.logd( CLAZZ, "am group owner" );
DbgUtils.logd( TAG, "am group owner" );
startAcceptThread();
} else {
DbgUtils.logd( CLAZZ, "am NOT group owner" );
DbgUtils.logd( TAG, "am NOT group owner" );
DbgUtils.showf( "Joining %s WiFi P2p group as guest", SERVICE_NAME );
stopAcceptThread();
connectToOwner( info.groupOwnerAddress );
@ -1012,11 +1012,11 @@ public class WiDirService extends XWService {
@Override
public void onPeersAvailable( WifiP2pDeviceList peerList ) {
DbgUtils.logd( CLAZZ, "got list of %d peers",
DbgUtils.logd( TAG, "got list of %d peers",
peerList.getDeviceList().size() );
for ( WifiP2pDevice device : peerList.getDeviceList() ) {
// DbgUtils.logd( CLAZZ, "not connecting to: %s", device.toString() );
// DbgUtils.logd( TAG, "not connecting to: %s", device.toString() );
tryConnect( device );
}
// Out with the old, in with the new.

View file

@ -44,7 +44,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt )
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logi( getClass(), "onCreate(this=%H)", this );
DbgUtils.logi( TAG, "onCreate(this=%H)", this );
}
super.onCreate( savedInstanceState );
m_dlgt = dlgt;
@ -70,7 +70,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onPause()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logi( getClass(), "onPause(this=%H)", this );
DbgUtils.logi( TAG, "onPause(this=%H)", this );
}
m_dlgt.onPause();
super.onPause();
@ -81,7 +81,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onResume()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logi( getClass(), "onResume(this=%H)", this );
DbgUtils.logi( TAG, "onResume(this=%H)", this );
}
super.onResume();
WiDirService.activityResumed( this );
@ -92,7 +92,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onPostResume()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logi( getClass(), "onPostResume(this=%H)", this );
DbgUtils.logi( TAG, "onPostResume(this=%H)", this );
}
super.onPostResume();
}
@ -101,7 +101,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onStart()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logi( getClass(), "%s.onStart(this=%H)", this );
DbgUtils.logi( TAG, "%s.onStart(this=%H)", this );
}
super.onStart();
m_dlgt.onStart();
@ -111,7 +111,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onStop()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logi( getClass(), "%s.onStop(this=%H)", this );
DbgUtils.logi( TAG, "%s.onStop(this=%H)", this );
}
m_dlgt.onStop();
super.onStop();
@ -121,7 +121,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
protected void onDestroy()
{
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logi( getClass(), "onDestroy(this=%H)", this );
DbgUtils.logi( TAG, "onDestroy(this=%H)", this );
}
m_dlgt.onDestroy();
super.onDestroy();

View file

@ -69,7 +69,7 @@ public class XWApp extends Application {
// This one line should always get logged even if logging is
// off -- because logging is on by default until logEnable is
// called.
DbgUtils.logi( getClass(), "onCreate(); git_rev=%s",
DbgUtils.logi( TAG, "onCreate(); git_rev=%s",
getString( R.string.git_rev ) );
DbgUtils.logEnable( this );
@ -100,7 +100,7 @@ public class XWApp extends Application {
@Override
public void onTerminate()
{
DbgUtils.logi( getClass(), "onTerminate() called" );
DbgUtils.logi( TAG, "onTerminate() called" );
XwJNI.cleanGlobals();
super.onTerminate();
}

View file

@ -36,6 +36,7 @@ import android.widget.ListView;
import junit.framework.Assert;
abstract class XWFragment extends Fragment implements Delegator {
private static final String TAG = XWFragment.class.getSimpleName();
private static final String PARENT_NAME = "PARENT_NAME";
private DelegateBase m_dlgt;
@ -71,7 +72,7 @@ abstract class XWFragment extends Fragment implements Delegator {
protected void onCreate( DelegateBase dlgt, Bundle sis )
{
DbgUtils.logd( getClass(), "onCreate() called" );
DbgUtils.logd( TAG, "onCreate() called" );
super.onCreate( sis );
if ( null != sis ) {
m_parentName = sis.getString( PARENT_NAME );
@ -94,14 +95,14 @@ abstract class XWFragment extends Fragment implements Delegator {
public View onCreateView( LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState )
{
DbgUtils.logd( getClass(), "onCreateView() called" );
DbgUtils.logd( TAG, "onCreateView() called" );
return m_dlgt.inflateView( inflater, container );
}
@Override
public void onActivityCreated( Bundle savedInstanceState )
{
DbgUtils.logd( getClass(), "onActivityCreated() called" );
DbgUtils.logd( TAG, "onActivityCreated() called" );
m_dlgt.init( savedInstanceState );
super.onActivityCreated( savedInstanceState );
if ( m_hasOptionsMenu ) {
@ -112,7 +113,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onPause()
{
DbgUtils.logd( getClass(), "onPause() called" );
DbgUtils.logd( TAG, "onPause() called" );
m_dlgt.onPause();
super.onPause();
}
@ -120,7 +121,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onResume()
{
DbgUtils.logd( getClass(), "onResume() called" );
DbgUtils.logd( TAG, "onResume() called" );
super.onResume();
m_dlgt.onResume();
}
@ -128,7 +129,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onStart()
{
DbgUtils.logd( getClass(), "onStart() called" );
DbgUtils.logd( TAG, "onStart() called" );
super.onStart();
m_dlgt.onStart();
}
@ -136,7 +137,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onStop()
{
DbgUtils.logd( getClass(), "onStop() called" );
DbgUtils.logd( TAG, "onStop() called" );
m_dlgt.onStop();
super.onStop();
}
@ -144,7 +145,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onDestroy()
{
DbgUtils.logd( getClass(), "onDestroy() called" );
DbgUtils.logd( TAG, "onDestroy() called" );
m_dlgt.onDestroy();
super.onDestroy();
}
@ -152,7 +153,7 @@ abstract class XWFragment extends Fragment implements Delegator {
@Override
public void onActivityResult( int requestCode, int resultCode, Intent data )
{
DbgUtils.logd( getClass(), "onActivityResult() called" );
DbgUtils.logd( TAG, "onActivityResult() called" );
m_dlgt.onActivityResult( RequestCode.values()[requestCode],
resultCode, data );
}

View file

@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.Set;
class XWService extends Service {
private static final String TAG = XWService.class.getSimpleName();
public static enum ReceiveResult { OK, GAME_GONE, UNCONSUMED };
protected static MultiService s_srcMgr = null;
@ -64,7 +65,7 @@ class XWService extends Service {
if ( null != s_srcMgr ) {
s_srcMgr.sendResult( event, args );
} else {
DbgUtils.logd( getClass(), "sendResult(): dropping %s event", event.toString() );
DbgUtils.logd( TAG, "sendResult(): dropping %s event", event.toString() );
}
}
@ -80,7 +81,7 @@ class XWService extends Service {
s_seen.add( inviteID );
}
}
DbgUtils.logd( getClass(), "checkNotDupe(%s) => %b", inviteID, !isDupe );
DbgUtils.logd( TAG, "checkNotDupe(%s) => %b", inviteID, !isDupe );
return !isDupe;
}

View file

@ -40,6 +40,7 @@ import java.util.HashSet;
import java.util.Iterator;
public class CommsAddrRec {
private static final String TAG = CommsAddrRec.class.getSimpleName();
public enum CommsConnType {
_COMMS_CONN_NONE,
@ -312,7 +313,7 @@ public class CommsAddrRec {
|| ip_relay_port != other.ip_relay_port;
break;
default:
DbgUtils.logw( getClass(), "changesMatter: not handling case: %s",
DbgUtils.logw( TAG, "changesMatter: not handling case: %s",
conType.toString() );
break;
}

View file

@ -40,6 +40,7 @@ import org.json.JSONObject;
* in CurGameInfo
*/
public class GameSummary {
private static final String TAG = GameSummary.class.getSimpleName();
public static final String EXTRA_REMATCH_BTADDR = "rm_btaddr";
public static final String EXTRA_REMATCH_PHONE = "rm_phone";
public static final String EXTRA_REMATCH_RELAY = "rm_relay";
@ -427,7 +428,7 @@ public class GameSummary {
} catch( org.json.JSONException ex ) {
DbgUtils.logex( ex );
}
DbgUtils.logi( getClass(), "putStringExtra(%s,%s) => %s", key, value, m_extras );
DbgUtils.logi( TAG, "putStringExtra(%s,%s) => %s", key, value, m_extras );
}
public String getStringExtra( String key )
@ -444,7 +445,7 @@ public class GameSummary {
DbgUtils.logex( ex );
}
}
DbgUtils.logi( getClass(), "getStringExtra(%s) => %s", key, result );
DbgUtils.logi( TAG, "getStringExtra(%s) => %s", key, result );
return result;
}
@ -462,7 +463,7 @@ public class GameSummary {
break;
}
}
// DbgUtils.logd( getClass(), "hasRematchInfo() => %b", found );
// DbgUtils.logd( TAG, "hasRematchInfo() => %b", found );
return found;
}

View file

@ -181,7 +181,7 @@ public class JNIThread extends Thread {
if ( BuildConfig.DEBUG ) {
Iterator<QueueElem> iter = m_queue.iterator();
while ( iter.hasNext() ) {
DbgUtils.logi( getClass(), "removing %s from queue",
DbgUtils.logi( TAG, "removing %s from queue",
iter.next().m_cmd.toString() );
}
}
@ -211,7 +211,7 @@ public class JNIThread extends Thread {
// Assert.assertNull( m_jniGamePtr ); // fired!!
if ( null != m_jniGamePtr ) {
DbgUtils.logd( getClass(), "configure(): m_jniGamePtr not null; that ok?" );
DbgUtils.logd( TAG, "configure(): m_jniGamePtr not null; that ok?" );
}
m_jniGamePtr = null;
if ( null != stream ) {
@ -367,7 +367,7 @@ public class JNIThread extends Thread {
// PENDING: once certain this is true, stop saving the full array and
// instead save the hash. Also, update it after each save.
if ( hashesEqual ) {
DbgUtils.logd( getClass(), "save_jni(): no change in game; can skip saving" );
DbgUtils.logd( TAG, "save_jni(): no change in game; can skip saving" );
} else {
// Don't need this!!!! this only runs on the run() thread
synchronized( this ) {
@ -422,7 +422,7 @@ public class JNIThread extends Thread {
try {
elem = m_queue.take();
} catch ( InterruptedException ie ) {
DbgUtils.logw( getClass(), "interrupted; killing thread" );
DbgUtils.logw( TAG, "interrupted; killing thread" );
break;
}
boolean draw = false;
@ -668,7 +668,7 @@ public class JNIThread extends Thread {
case CMD_NONE: // ignored
break;
default:
DbgUtils.logw( getClass(), "dropping cmd: %s", elem.m_cmd.toString() );
DbgUtils.logw( TAG, "dropping cmd: %s", elem.m_cmd.toString() );
Assert.fail();
}
@ -686,7 +686,7 @@ public class JNIThread extends Thread {
XwJNI.comms_stop( m_jniGamePtr );
save_jni();
} else {
DbgUtils.logw( getClass(), "run(): exiting without saving" );
DbgUtils.logw( TAG, "run(): exiting without saving" );
}
m_jniGamePtr.release();
m_jniGamePtr = null;
@ -713,7 +713,7 @@ public class JNIThread extends Thread {
{
m_queue.add( new QueueElem( cmd, true, args ) );
if ( m_stopped && ! JNICmd.CMD_NONE.equals(cmd) ) {
DbgUtils.logw( getClass(), "adding %s to stopped thread!!!",
DbgUtils.logw( TAG, "adding %s to stopped thread!!!",
cmd.toString() );
DbgUtils.printStack();
}
@ -732,7 +732,7 @@ public class JNIThread extends Thread {
private void retain_sync()
{
++m_refCount;
DbgUtils.logi( getClass(), "retain_sync(rowid=%d): m_refCount: %d",
DbgUtils.logi( TAG, "retain_sync(rowid=%d): m_refCount: %d",
m_rowid, m_refCount );
}
@ -755,7 +755,7 @@ public class JNIThread extends Thread {
stop = true;
}
}
DbgUtils.logi( getClass(), "release(rowid=%d): m_refCount: %d",
DbgUtils.logi( TAG, "release(rowid=%d): m_refCount: %d",
m_rowid, m_refCount );
if ( stop ) {

View file

@ -71,7 +71,7 @@ public class JNIUtilsImpl implements JNIUtils {
try {
isr = new InputStreamReader( bais, isUTF8? "UTF8" : "ISO8859_1" );
} catch( java.io.UnsupportedEncodingException uee ) {
DbgUtils.logi( getClass(), "splitFaces: %s", uee.toString() );
DbgUtils.logi( TAG, "splitFaces: %s", uee.toString() );
isr = new InputStreamReader( bais );
}
@ -85,7 +85,7 @@ public class JNIUtilsImpl implements JNIUtils {
try {
chr = isr.read();
} catch ( java.io.IOException ioe ) {
DbgUtils.logw( getClass(), ioe.toString() );
DbgUtils.logw( TAG, ioe.toString() );
}
if ( -1 == chr ) {
addFace( faces, face );

View file

@ -69,4 +69,3 @@ public class LocalPlayer {
robotIQ = iq;
}
}

View file

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

View file

@ -31,6 +31,7 @@ import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
// Collection of native methods and a bit of state
public class XwJNI {
private static final String TAG = XwJNI.class.getSimpleName();
public static class GamePtr {
private int m_ptr = 0;
@ -51,7 +52,7 @@ public class XwJNI {
public synchronized GamePtr retain()
{
++m_refCount;
DbgUtils.logd( getClass(), "retain(this=%H, rowid=%d): refCount now %d",
DbgUtils.logd( TAG, "retain(this=%H, rowid=%d): refCount now %d",
this, m_rowid, m_refCount );
return this;
}
@ -61,7 +62,7 @@ public class XwJNI {
public synchronized void release()
{
--m_refCount;
DbgUtils.logd( getClass(), "release(this=%H, rowid=%d): refCount now %d",
DbgUtils.logd( TAG, "release(this=%H, rowid=%d): refCount now %d",
this, m_rowid, m_refCount );
if ( 0 == m_refCount ) {
if ( 0 != m_ptr ) {

View file

@ -38,6 +38,7 @@ import org.eehouse.android.xw4.R;
public class LocDelegate extends ListDelegateBase
implements View.OnClickListener,
OnItemSelectedListener {
private static final String TAG = LocDelegate.class.getSimpleName();
private Activity m_activity;
private LocListAdapter m_adapter;
@ -80,7 +81,7 @@ public class LocDelegate extends ListDelegateBase
protected void onWindowFocusChanged( boolean hasFocus )
{
if ( hasFocus && null != m_lastItem ) {
DbgUtils.logi( getClass(), "updating LocListItem instance %H", m_lastItem );
DbgUtils.logi( TAG, "updating LocListItem instance %H", m_lastItem );
m_lastItem.update();
m_lastItem = null;
}

View file

@ -36,7 +36,7 @@ public class LocIDs extends LocIDsData {
int result = LocIDsData.NOT_FOUND;
if ( null != key && getS_MAP(context).containsKey( key ) ) {
// Assert.assertNotNull( LocIDsData.S_MAP );
DbgUtils.logw( LocIDs.class, "calling get with key %s", key );
DbgUtils.logw( TAG, "calling get with key %s", key );
result = getS_MAP( context ).get( key ); // NPE
}
return result;

View file

@ -33,6 +33,7 @@ import java.util.ArrayList;
*/
public class LocSearcher {
private static final String TAG = LocSearcher.class.getSimpleName();
private String m_contextName;
@ -133,7 +134,7 @@ public class LocSearcher {
} else {
Pair[] usePairs = null != m_lastTerm && term.contains(m_lastTerm)
? m_matchingPairs : m_filteredPairs;
DbgUtils.logi( getClass(), "start: searching %d pairs", usePairs.length );
DbgUtils.logi( TAG, "start: searching %d pairs", usePairs.length );
ArrayList<Pair> matches = new ArrayList<Pair>();
for ( Pair pair : usePairs ) {
if ( pair.matches( term ) ) {

View file

@ -65,6 +65,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class LocUtils {
private static final String TAG = LocUtils.class.getSimpleName();
public static final String CONTEXT_NAME = "CONTEXT_NAME";
protected static final String RES_FORMAT = "%[\\d]\\$[ds]";
private static final int FMT_LEN = 4;
@ -306,7 +307,7 @@ public class LocUtils {
int quantity )
{
if ( XWApp.LOCUTILS_ENABLED ) {
DbgUtils.logw( LocUtils.class, "getQuantityString(%d): punting on locutils stuff for"
DbgUtils.logw( TAG, "getQuantityString(%d): punting on locutils stuff for"
+ " now. FIXME", quantity );
}
String result = context.getResources().getQuantityString( id, quantity );
@ -317,7 +318,7 @@ public class LocUtils {
int quantity, Object... params )
{
if ( XWApp.LOCUTILS_ENABLED ) {
DbgUtils.logw( LocUtils.class, "getQuantityString(%d): punting on locutils stuff for"
DbgUtils.logw( TAG, "getQuantityString(%d): punting on locutils stuff for"
+ " now. FIXME", quantity );
}
String result = context.getResources()
@ -439,7 +440,7 @@ public class LocUtils {
String locale = entry.getString( k_LOCALE );
String newVersion = entry.getString( k_NEW );
JSONArray pairs = entry.getJSONArray( k_PAIRS );
DbgUtils.logi( LocUtils.class, "addXlations: locale %s: got pairs of len %d,"
DbgUtils.logi( TAG, "addXlations: locale %s: got pairs of len %d,"
+ " version %s", locale,
pairs.length(), newVersion );
@ -598,7 +599,7 @@ public class LocUtils {
DBUtils.getXlations( context, getCurLocale( context ) );
s_xlationsLocal = (Map<String,String>)asObjs[0];
s_xlationsBlessed = (Map<String,String>)asObjs[1];
DbgUtils.logi( LocUtils.class, "loadXlations: got %d local strings, %d blessed strings",
DbgUtils.logi( TAG, "loadXlations: got %d local strings, %d blessed strings",
s_xlationsLocal.size(),
s_xlationsBlessed.size() );
}
@ -761,7 +762,7 @@ public class LocUtils {
String locale = getCurLocale( context );
String msg = String.format( "Dropping bad translations for %s", locale );
Utils.showToast( context, msg );
DbgUtils.logw( LocUtils.class, msg );
DbgUtils.logw( TAG, msg );
DBUtils.dropXLations( context, locale );
DBUtils.setStringFor( context, localeKey(locale), "" );

View file

@ -101,10 +101,11 @@ import org.eehouse.android.%s.R;
import org.eehouse.android.%s.DbgUtils;
public class %s {
private static final String TAG = %s.class.getSimpleName();
public static final int NOT_FOUND = -1;
protected static final int[] S_IDS = {
"""
fil.write( lines % (sys.argv[0], variant, variant, variant, name) )
fil.write( lines % (sys.argv[0], variant, variant, variant, name, name) )
keys = pairs.keys()
for ii in range( len( keys ) ):
@ -120,10 +121,8 @@ 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 ) {
@ -131,15 +130,15 @@ public class %s {
if ( strs[ii].equals( fromCtxt ) ) {
++nMatches;
} else {
DbgUtils.logi( %s.class, "unequal strings: \\"%%s\\" vs \\"%%s\\"",
DbgUtils.logi( TAG, "unequal strings: \\"%%s\\" vs \\"%%s\\"",
strs[ii], fromCtxt );
}
}
DbgUtils.logi( %s.class, "checkStrings: %%d of %%d strings matched", nMatches, strs.length );
DbgUtils.logi( TAG, "checkStrings: %%d of %%d strings matched", nMatches, strs.length );
"""
func += " }"
fil.write( func % names )
fil.write( func )
# Now the end of the class
lines = """