mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
don't try to connect to non-phones
When a device is paired but not a phone (or computer, which is how tablets identify), don't bother trying to scan it.
This commit is contained in:
parent
051aeba57c
commit
95c11eec07
2 changed files with 13 additions and 10 deletions
|
@ -969,15 +969,20 @@ public class BTService extends XWService {
|
||||||
Set<BluetoothDevice> pairedDevs = m_adapter.getBondedDevices();
|
Set<BluetoothDevice> pairedDevs = m_adapter.getBondedDevices();
|
||||||
// DbgUtils.logf( "ping: got %d paired devices", pairedDevs.size() );
|
// DbgUtils.logf( "ping: got %d paired devices", pairedDevs.size() );
|
||||||
for ( BluetoothDevice dev : pairedDevs ) {
|
for ( BluetoothDevice dev : pairedDevs ) {
|
||||||
String btAddr = dev.getAddress();
|
// Skip things that can't host an Android app
|
||||||
|
int clazz = dev.getBluetoothClass().getMajorDeviceClass();
|
||||||
if ( sendPing( dev, 0 ) ) { // did we get a reply?
|
if ( Major.PHONE == clazz || Major.COMPUTER == clazz ) {
|
||||||
if ( null != addrs ) {
|
if ( sendPing( dev, 0 ) ) { // did we get a reply?
|
||||||
addrs.add( dev );
|
if ( null != addrs ) {
|
||||||
}
|
addrs.add( dev );
|
||||||
if ( null != event ) {
|
}
|
||||||
postEvent( event, dev.getName() );
|
if ( null != event ) {
|
||||||
|
postEvent( event, dev.getName() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log.d( TAG, "skipping %s; not an android device!",
|
||||||
|
dev.getName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,6 @@ public class XWApp extends Application implements LifecycleObserver {
|
||||||
public static final boolean LOCUTILS_ENABLED = false;
|
public static final boolean LOCUTILS_ENABLED = false;
|
||||||
public static final boolean CONTEXT_MENUS_ENABLED = true;
|
public static final boolean CONTEXT_MENUS_ENABLED = true;
|
||||||
public static final boolean OFFER_DUALPANE = false;
|
public static final boolean OFFER_DUALPANE = false;
|
||||||
// BT class "COMPUTERS" includes tablets like the Nexus 9
|
|
||||||
public static final boolean BT_SCAN_COMPUTERS = true;
|
|
||||||
|
|
||||||
public static final String SMS_PUBLIC_HEADER = "-XW4";
|
public static final String SMS_PUBLIC_HEADER = "-XW4";
|
||||||
public static final int MAX_TRAY_TILES = 7; // comtypes.h
|
public static final int MAX_TRAY_TILES = 7; // comtypes.h
|
||||||
|
|
Loading…
Reference in a new issue