1. ホーム
  2. android

[解決済み] Android Bluetooth Low Energy - ScanFiltersの使用方法

2022-02-26 03:31:04

質問

現在、Bluetooth Low Energyのスキャン用Androidアプリを制作しています。Android 5.0では、ScanFiltersのオプションが導入されました。一般的に動作していますが、フィルタの数が制限されているようです(?)

13種類以上のフィルターを使用すると、BLEデバイスが見つからなくなり、何も見つからずにバックグラウンドで継続しているにもかかわらず、アプリが停止した旨の通知が表示されます。警告やエラーメッセージは表示されません。使用するフィルタを13個より少なくすると、すべてがうまく機能します。また、フィルタリングに使用するアドレスは、問題の原因にはなりません。どうやら最大数になるようです...。

コードです。 スキャンは独自のスレッドで実行されます。

[...]
BluetoothLeScanner myScanner = myBluetoothAdapter.getBluetoothLeScanner();
ScanSettings settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();


//The list for the filters
filters = new ArrayList<>(); 

//mac adresses of ble devices
String[] filterlist = {
                    "D4:B4:C8:7E:D1:35",
                    "C8:86:3A:91:0C:0C",
                    "FD:49:FD:36:04:B4",
                    "E9:91:4A:42:AC:3B",
                    //... some 20 more addresses
};

//adding the mac adresses to the filters list
for (int i=0; i< filterlist.length ; i++) {
    ScanFilter filter = new ScanFilter.Builder().setDeviceAddress(filterlist[i]).build();
    filters.add(filter);
    Log.v("Filter: "," "+ filters.get(i).getDeviceAddress());
}



[...]
while (scanning) {
    final ScanCallback callback = new ScanCallback() {
        @Override
        public void onScanResult(int callbackType, ScanResult result) {
           Log.v("Callback","in the callback");
    }
    @Override
    public void onScanFailed(int errorCode) {
        super.onScanFailed(errorCode);
        Log.v("ScanTask", "Some error occurred");
    });

    [...]

    //starting the scan with the filters
    myScanner.startScan(filters, settings, callback);

    //creating some delay and then end the scan
    Thread.sleep(myScanTime);
    myScanner.stopScan(callback);

    [...]
}

コード内は問題ないようです。しかし、なぜフィルタの最大数に制限があるのでしょうか?どなたか正しい方向に導いてくださるか、回避策をご存じですか?

UPDATEしてください。 Logcatでappフィルターを削除すると、エラーメッセージが表示されるので、参考になるかもしれません。これはLogcatです。

03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ EC:2F:08:1E:99:DC
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ F0:5E:4A:36:D5:4F
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ E1:24:88:12:B7:20
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ D1:F7:F3:73:00:43
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ D4:B6:92:2B:7C:EB
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ DE:6D:4A:07:DB:36
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:CD:19
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C3:3B
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C6:F2
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C2:DF
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C6:EA
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C7:7C
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C2:D1
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C7:78
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C7:74
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C2:B8
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C3:3A
03-25 09:35:32.889  18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:CD:2F

03-25 09:35:33.899  18922-19072/? D/BtGatt.GattService﹕ registerClient() - UUID=9f64337e-6700-4c26-a1f1-64ddc5b874c1
03-25 09:35:33.909  18922-18940/? D/BtGatt.GattService﹕ onClientRegistered() - UUID=9f64337e-6700-4c26-a1f1-64ddc5b874c1, clientIf=6
03-25 09:35:33.919  18166-18180/com.example.install.bluetooth_app D/BluetoothLeScanner﹕ onClientRegistered() - status=0 clientIf=6
03-25 09:35:33.919  18922-18931/? D/BtGatt.GattService﹕ start scan with filters
03-25 09:35:33.929  18922-18944/? D/BtGatt.ScanManager﹕ handling starting scan
03-25 09:35:33.929  18922-18944/? D/BluetoothAdapterService﹕ getAdapterService() - returning com.android.bluetooth.btservice.AdapterService@90e686a
03-25 09:35:33.929  18166-19305/com.example.install.bluetooth_app V/ScanTask﹕ Scan is started
03-25 09:35:33.929  18166-19305/com.example.install.bluetooth_app V/ScanTask﹕ Filters: 18
03-25 09:35:33.929  18166-19305/com.example.install.bluetooth_app V/ScanTask﹕ ScanTime: 5000
03-25 09:35:33.929  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.939  18922-19015/? D/bt_upio﹕ proc btwrite assertion
03-25 09:35:33.949  18922-18940/? D/BtGatt.GattService﹕ onScanFilterEnableDisabled() - clientIf=6, status=0, action=1
03-25 09:35:33.949  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.949  18922-18944/? D/BtGatt.ScanManager﹕ allow scan with filters
03-25 09:35:33.949  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 3 for clientIf= 6
03-25 09:35:33.949  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.949  18922-18944/? D/BtGatt.ScanManager﹕ add address EC:2F:08:1E:99:DC
03-25 09:35:33.949  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.949  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.949  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=47
03-25 09:35:33.949  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.949  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.949  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.949  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=15
03-25 09:35:33.949  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.949  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 4 for clientIf= 6
03-25 09:35:33.949  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.949  18922-18944/? D/BtGatt.ScanManager﹕ add address F0:5E:4A:36:D5:4F
03-25 09:35:33.959  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.959  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.959  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=46
03-25 09:35:33.959  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.959  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.959  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.959  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=14
03-25 09:35:33.959  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.959  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 5 for clientIf= 6
03-25 09:35:33.959  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.959  18922-18944/? D/BtGatt.ScanManager﹕ add address E1:24:88:12:B7:20
03-25 09:35:33.959  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.959  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.959  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=45
03-25 09:35:33.959  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.969  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.969  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.969  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=13
03-25 09:35:33.969  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.969  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 6 for clientIf= 6
03-25 09:35:33.969  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.969  18922-18944/? D/BtGatt.ScanManager﹕ add address D1:F7:F3:73:00:43
03-25 09:35:33.969  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.969  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.969  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=44
03-25 09:35:33.969  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.969  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.969  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.969  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=12
03-25 09:35:33.969  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.979  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 7 for clientIf= 6
03-25 09:35:33.979  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.979  18922-18944/? D/BtGatt.ScanManager﹕ add address D4:B6:92:2B:7C:EB
03-25 09:35:33.979  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.979  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.979  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=43
03-25 09:35:33.979  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.979  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.979  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.979  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=11
03-25 09:35:33.979  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.979  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 8 for clientIf= 6
03-25 09:35:33.979  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.979  18922-18944/? D/BtGatt.ScanManager﹕ add address DE:6D:4A:07:DB:36
03-25 09:35:33.979  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.979  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.979  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=42
03-25 09:35:33.979  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.989  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.989  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.989  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=10
03-25 09:35:33.989  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.989  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 9 for clientIf= 6
03-25 09:35:33.989  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.989  18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:CD:19
03-25 09:35:33.989  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.989  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.989  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=41
03-25 09:35:33.989  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.989  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.989  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.989  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=9
03-25 09:35:33.989  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.989  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 10 for clientIf= 6
03-25 09:35:33.989  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.989  18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C3:3B
03-25 09:35:33.989  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.989  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.999  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=40
03-25 09:35:33.999  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.999  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.999  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.999  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=8
03-25 09:35:33.999  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.999  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 11 for clientIf= 6
03-25 09:35:33.999  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.999  18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C6:F2
03-25 09:35:33.999  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.999  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=39
03-25 09:35:34.009  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.009  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.009  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=7
03-25 09:35:34.009  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.009  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 12 for clientIf= 6
03-25 09:35:34.009  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:34.009  18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C2:DF
03-25 09:35:34.009  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ onSignalStrengthsChanged signalStrength=SignalStrength: 12 99 -120 -160 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 0x4 gsm|lte level=4
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ updateTelephonySignalStrength: hasService=true ss=SignalStrength: 12 99 -120 -160 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 0x4 gsm|lte
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ updateTelephonySignalStrength: iconLevel=4
03-25 09:35:34.009  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ updateTelephonySignalStrength, No signal level. mPhoneSignalIconId = com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mDataSignalIconId = com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mQSPhoneSignalIconId = com.android.systemui:drawable/ic_qs_signal_4 mContentDescriptionPhoneSignal = Volle Signalstärke
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ refreshViews connected={ wifi } level=4 combinedSignalIconId=0x7f020495/com.android.systemui:drawable/stat_sys_wifi_signal_4 mobileLabel=3 AT wifiLabel="W_ISPACE01"xxxxXXXXxxxxXXXX emergencyOnly=false combinedLabel="W_ISPACE01"xxxxXXXXxxxxXXXX mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId=0x7f020440/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mQSPhoneSignalIconId=0x7f020115/com.android.systemui:drawable/ic_qs_signal_4 mDataDirectionIconId=0x0/(null) mDataSignalIconId=0x7f020440/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mDataTypeIconId=0x7f0202c9/com.android.systemui:drawable/stat_sys_data_connected_h mQSDataTypeIconId=0x7f02011f/com.android.systemui:drawable/ic_qs_signal_h mNoSimIconId=0x0/(null) mWifiIconId=0x7f020495/com.android.systemui:drawable/stat_sys_wifi_signal_4 mQSWifiIconId=0x7f02012b/com.android.systemui:drawable/ic_qs_wifi_4 mWifiActivityIconId=0x7f020464/com.android.systemui:drawable/stat_sys_signal_in mBluetoothTetherIconId=0x1080907/android:drawable/stat_sys_tether_bluetooth
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ refreshSignalCluster - setNWBoosterIndicators(false)
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ applyOpen
03-25 09:35:34.009  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=38
03-25 09:35:34.009  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ refreshSignalCluster - setNWBoosterIndicators(false)
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ applyOpen
03-25 09:35:34.009  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.009  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ refreshSignalCluster - setNWBoosterIndicators(false)
03-25 09:35:34.009  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=6
03-25 09:35:34.009  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.009  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 13 for clientIf= 6
03-25 09:35:34.009  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:34.009  18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C6:EA
03-25 09:35:34.009  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.009  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009    1158-1158/? D/StatusBar.NetworkController﹕ applyOpen
03-25 09:35:34.019  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=37
03-25 09:35:34.019  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.019  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.019  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.019    1158-1158/? D/StatusBar.NetworkController﹕ refreshSignalCluster - setNWBoosterIndicators(false)
03-25 09:35:34.019    1158-1158/? D/StatusBar.NetworkController﹕ applyOpen
03-25 09:35:34.019  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=5
03-25 09:35:34.019  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.019  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 14 for clientIf= 6
03-25 09:35:34.019  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:34.019  18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C7:7C
03-25 09:35:34.019  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.019  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.019  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=36
03-25 09:35:34.019  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.019  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.019  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.019  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=4
03-25 09:35:34.019  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.019  18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 15 for clientIf= 6
03-25 09:35:34.019  18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:34.019  18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C2:D1
03-25 09:35:34.019  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.019  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.029  18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=35
03-25 09:35:34.029  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.029  18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.029  18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.029  18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=3
03-25 09:35:34.029  18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.029  18922-18944/? E/AndroidRuntime﹕ FATAL EXCEPTION: BluetoothScanManager
    Process: com.android.bluetooth, PID: 18922
    java.util.NoSuchElementException
            at java.util.ArrayDeque.removeFirst(ArrayDeque.java:248)
            at java.util.ArrayDeque.pop(ArrayDeque.java:483)
            at com.android.bluetooth.gatt.ScanManager$ScanNative.configureScanFilters(ScanManager.java:738)
            at com.android.bluetooth.gatt.ScanManager$ScanNative.startRegularScan(ScanManager.java:529)
            at com.android.bluetooth.gatt.ScanManager$ClientHandler.handleStartScan(ScanManager.java:212)
            at com.android.bluetooth.gatt.ScanManager$ClientHandler.handleMessage(ScanManager.java:179)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:145)
            at android.os.HandlerThread.run(HandlerThread.java:61)

フィルタの使用可能スペースに変数があり、フィルタの追加数に関係なく常に15に設定されているようです(?)

onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=15

フィルタを1つ追加するごとに1つずつ減っていき、3つ以下になるとNoSuchElementExceptionが発生します。

どのように解決するのですか?

この問題は、明らかにAndroid 5.0のバグです。 新しいバージョンのAndroid(5.0.2でテスト)では、バグが修正され、この問題は発生しなくなりました。 ありがとうございました。