avoid crashes when BT turned off

Test at enqueueWork() and onHandleWorkImpl(). Seems to do it. Maybe
turning it off mid-send will still crash...
This commit is contained in:
Eric House 2019-02-08 22:22:03 -08:00
parent 601eaf395c
commit 2afce586a3

View file

@ -292,17 +292,15 @@ public class BTService extends XWJIService {
private static void enqueueWork( Context context, Intent intent )
{
if ( BTEnabled() ) {
enqueueWork( context, BTService.class, sJobID, intent );
Log.d( TAG, "called enqueueWork(cmd=%s)",
cmdFrom( intent, BTAction.values() ) );
}
}
public static void onACLConnected( Context context )
{
Log.d( TAG, "onACLConnected()" );
enqueueWork( context,
getIntentTo( context, BTAction.ACL_CONN ) );
}
public static void radioChanged( Context context, boolean cameOn )
@ -417,6 +415,7 @@ public class BTService extends XWJIService {
@Override
void onHandleWorkImpl( Intent intent, XWJICmds jicmd, long timestamp )
{
if ( BTEnabled() ) {
BTAction cmd = (BTAction)jicmd;
switch( cmd ) {
case ACL_CONN: // just forces onCreate to run
@ -527,6 +526,7 @@ public class BTService extends XWJIService {
default:
Assert.fail();
}
}
} // onHandleWorkImpl()
private void add( BTQueueElem elem )