pass context and use to post lock-failure toast

This commit is contained in:
Eric House 2019-02-06 19:43:54 -08:00
parent f5c9962b66
commit e62e51f9cd
5 changed files with 9 additions and 6 deletions

View file

@ -1373,7 +1373,7 @@ public class BTService extends XWService {
String btAddr ) String btAddr )
{ {
BTCmd result; BTCmd result;
if ( mHelper.handleInvitation( nli, btName, if ( mHelper.handleInvitation( this, nli, btName,
DictFetchOwner.OWNER_BT ) ) { DictFetchOwner.OWNER_BT ) ) {
result = BTCmd.INVITE_ACCPT; result = BTCmd.INVITE_ACCPT;
} else { } else {

View file

@ -303,7 +303,8 @@ public class RelayService extends JobIntentService
{ {
Log.d( TAG, "receiveInvitation: got nli from %d: %s", srcDevID, Log.d( TAG, "receiveInvitation: got nli from %d: %s", srcDevID,
nli.toString() ); nli.toString() );
if ( !mHelper.handleInvitation( nli, null, DictFetchOwner.OWNER_RELAY ) ) { if ( !mHelper.handleInvitation( this, nli, null,
DictFetchOwner.OWNER_RELAY ) ) {
Log.d( TAG, "handleInvitation() failed" ); Log.d( TAG, "handleInvitation() failed" );
} }
} }

View file

@ -495,7 +495,7 @@ public class SMSService extends XWService {
private void makeForInvite( String phone, NetLaunchInfo nli ) private void makeForInvite( String phone, NetLaunchInfo nli )
{ {
if ( nli != null ) { if ( nli != null ) {
mHelper.handleInvitation( nli, phone, DictFetchOwner.OWNER_SMS ); mHelper.handleInvitation( this, nli, phone, DictFetchOwner.OWNER_SMS );
ackInvite( phone, nli.gameID() ); ackInvite( phone, nli.gameID() );
} }
} }

View file

@ -767,7 +767,7 @@ public class WiDirService extends XWService {
NetLaunchInfo nli = NetLaunchInfo.makeFrom( this, nliData ); NetLaunchInfo nli = NetLaunchInfo.makeFrom( this, nliData );
String returnMac = intent.getStringExtra( KEY_SRC ); String returnMac = intent.getStringExtra( KEY_SRC );
if ( !mHelper.handleInvitation( nli, returnMac, DictFetchOwner.OWNER_P2P ) ) { if ( !mHelper.handleInvitation( this, nli, returnMac, DictFetchOwner.OWNER_P2P ) ) {
Log.d( TAG, "handleInvitation() failed" ); Log.d( TAG, "handleInvitation() failed" );
} }
} }

View file

@ -117,8 +117,8 @@ abstract class XWServiceHelper {
} }
} }
protected boolean handleInvitation( NetLaunchInfo nli, String device, protected boolean handleInvitation( Context context, NetLaunchInfo nli,
DictFetchOwner dfo ) String device, DictFetchOwner dfo )
{ {
boolean success = nli.isValid() && checkNotInFlight( nli ); boolean success = nli.isValid() && checkNotInFlight( nli );
if ( success ) { if ( success ) {
@ -141,6 +141,8 @@ abstract class XWServiceHelper {
GamePtr gamePtr = GameUtils GamePtr gamePtr = GameUtils
.loadMakeGame( mService, gi, lock ); .loadMakeGame( mService, gi, lock );
gamePtr.release(); gamePtr.release();
} else {
DbgUtils.toastNoLock( TAG, context, "handleInvitation()" );
} }
} }