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