CtsVerifier-Bluetooth-LE-SEcure-ClientServer-Test测试pass但是无法选择PassButton

Posted houser0323

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CtsVerifier-Bluetooth-LE-SEcure-ClientServer-Test测试pass但是无法选择PassButton相关的知识,希望对你有一定的参考价值。

【问题描述】

CtsVerifier-Bluetooth-LE-SEcure-ClientServer-Test测试pass但是无法选择Pass-Button
工具版本:9.0-r11
其他信息:
上个版本正常,verifier版本相同
分析过程中结合代码咨询测试,印证只有Client无法选中,Server正常

【问题结论】

蓝牙驱动修改引入,已定位回退,需要bsp进一步修改

verifier的该项测试流程:
Client测试pass后做出先关闭mAdapter.disable()后打开mAdapter.enable()的动作,
经梳理蓝牙框流程发现,蓝牙关闭后再次打开超时失败,由此导致verifier的该项测试Activity无法收到广播将按钮设置为可选enable

AuthBlog:秋城https://www.cnblogs.com/houser0323

【分析详细】

Bluetooth-LE-SEcure-ClientServer-Test

流程概述
1.启动BleSecureClientStartActivity
该测试页面只是一个activity-ui。主要的方法实现和流程动作都在父类Activity中,重点关注父类。
2.调用父类BleClientTestBaseActivity的onCreate()完成:
页面显示
设置底部pass-fail-button按键的监听
设置pass-button为disable不可选
初始化页面的测试项ListView
回到子类继续onCreate():
显示info提示信息的dialog
启动BleClientService准备测试

3.调用父类BleClientTestBaseActivity的onResume():
注册测试服务BleClientService的广播监听BroadcastReceiver mBroadcast

4.开始测试
这个测试是俩设备Server-Client配对测试,自动触发,细节略,和Server端之间的蓝牙通信有关
listview每一条测试结束都会有广播发出,接收广播后将mPassed做或运算,如果一切顺利mPassed的运算结果是PASS_FLAG_ALL
这代表测试项全部通过

private static final int PASS_FLAG_ALL = 0x3FFFF;

然后Client端将蓝牙关闭mAdapter.disable()再打开mAdapter.enable(),打开成功情况下Activity才会将Pass-Button设置为可选择
由于驱动代码出问题,遂enable()失败,无法设置按钮可选

测试代码
1.测试Activity,提供ui无业务代码
cts/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureClientStartActivity.java
2.上面(1)的父类,测试结果处理
cts/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientTestBaseActivity.java
3.测试Service,真正的测试项执行
cts/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java

关键日志

测试All-PASS

04-21 16:52:05.901 D/BluetoothGatt( 6338): onClientConnectionState() - status=0 clientIf=6 device=7B:D0:42:AC:47:B6
04-21 16:52:05.901 D/BleClientService( 6338): onConnectionStateChange: status= 0, newState= 0
04-21 16:52:05.901 D/BluetoothGatt( 6338): close()
04-21 16:52:05.901 D/BluetoothGatt( 6338): unregisterApp() - mClientIf=6
04-21 16:52:05.915 D/BleClientTestBase( 6338): Processing com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_DISCONNECTED
04-21 16:52:05.921 D/BleClientTestBase( 6338): Passed Flags has changed from 0x0003FDFF to 0x0003FFFF. Delta=0x00000200
04-21 16:52:05.921 D/BleClientTestBase( 6338): All Tests Passed.

蓝牙正常关闭

04-21 16:52:06.927 D/BluetoothManagerService( 3297): disable(): mBluetooth = android.bluetooth.IBluetooth$Stub$Proxy@3e1ba1b mBinding = false
04-21 16:52:06.927 D/BluetoothManagerService( 3297): Persisting Bluetooth Setting: 0
04-21 16:52:06.928 D/BluetoothManagerService( 3297): MESSAGE_DISABLE: mBluetooth = android.bluetooth.IBluetooth$Stub$Proxy@3e1ba1b
04-21 16:52:06.929 V/SettingsProvider( 3297): Notifying for 0: content://settings/global/bluetooth_on
04-21 16:52:06.930 D/BluetoothManagerService( 3297): Sending off request.
04-21 16:52:06.931 D/BluetoothAdapterService( 3406): disable() called with mRunningProfiles.size() = 7
04-21 16:52:06.931 I/AdapterState( 3406): TURNING_OFF : entered 
04-21 16:52:06.931 D/AdapterProperties( 3406): Setting state to TURNING_OFF
04-21 16:52:06.932 D/BluetoothAdapterService( 3406): updateAdapterState() - Broadcasting state TURNING_OFF to 1 receivers.
04-21 16:52:06.936 D/BluetoothManagerService( 3297): MESSAGE_BLUETOOTH_STATE_CHANGE: ON > TURNING_OFF
04-21 16:52:06.936 D/BluetoothManagerService( 3297): Sending BLE State Change: ON > TURNING_OFF
04-21 16:52:06.939 D/BluetoothMapService( 3406): onReceive
04-21 16:52:06.939 D/BluetoothActiveDeviceManager( 3406): handleMessage(MESSAGE_ADAPTER_ACTION_STATE_CHANGED): newState=13
04-21 16:52:06.939 D/BluetoothMapService( 3406): onReceive: android.bluetooth.adapter.action.STATE_CHANGED
04-21 16:52:06.939 D/BluetoothMapService( 3406): STATE_TURNING_OFF
......
04-21 16:52:07.038 I/AdapterState( 3406): BLE_TURNING_OFF : entered 
04-21 16:52:07.039 D/BluetoothManagerService( 3297): MESSAGE_BLUETOOTH_STATE_CHANGE: BLE_ON > BLE_TURNING_OFF
04-21 16:52:07.039 D/BluetoothManagerService( 3297): Sending BLE State Change: BLE_ON > BLE_TURNING_OFF
04-21 16:52:07.044 D/BluetoothActiveDeviceManager( 3406): handleMessage(MESSAGE_ADAPTER_ACTION_STATE_CHANGED): newState=10
04-21 16:52:07.054 I/bt_btif_core( 3406): btif_disable_bluetooth entered
04-21 16:52:07.054 I/AdapterState( 3406): OFF : entered 
04-21 16:52:07.054 D/AdapterProperties( 3406): Setting state to OFF
04-21 16:52:07.054 D/BluetoothAdapterService( 3406): updateAdapterState() - Broadcasting state OFF to 1 receivers.
04-21 16:52:07.055 E/bt_stack( 3406): [ERROR:bta_jv_act.cc(607)] bta_jv_disable
04-21 16:52:07.056 D/BluetoothManagerService( 3297): MESSAGE_BLUETOOTH_STATE_CHANGE: BLE_TURNING_OFF > OFF
04-21 16:52:07.056 D/BluetoothManagerService( 3297): Bluetooth is complete send Service Down
04-21 16:52:07.056 W/bt_osi_thread( 3406): run_thread: thread id 3907, thread name btif_sock exited
04-21 16:52:07.056 D/BluetoothManagerService( 3297): Broadcasting onBluetoothServiceDown() to 9 receivers.
04-21 16:52:07.057 W/bt_btif ( 3406): bta_dm_disable BTA_DISABLE_DELAY set to 200 ms
04-21 16:52:07.057 I/bt_btif_core( 3406): btif_disable_bluetooth finished

蓝牙开启超时

04-21 16:52:17.051 D/BluetoothManagerService( 3297): enable(com.android.cts.verifier):  mBluetooth =null mBinding = false mState = OFF
04-21 16:52:17.052 D/BluetoothManagerService( 3297): MESSAGE_ENABLE(0): mBluetooth = null
04-21 16:52:17.057 D/BluetoothManagerService( 3297): enable returning
04-21 16:52:17.253 D/BluetoothAdapterService( 7058): onCreate()
04-21 16:52:17.287 I/AdapterState( 7058): BLE_TURNING_ON : entered 
04-21 16:52:17.287 D/AdapterProperties( 7058): Setting state to BLE_TURNING_ON
04-21 16:52:17.287 D/BluetoothAdapterService( 7058): updateAdapterState() - Broadcasting state BLE_TURNING_ON to 1 receivers.
04-21 16:52:17.288 D/BluetoothAdapterService( 7058): bleOnProcessStart()
04-21 16:52:17.290 D/BluetoothManagerService( 3297): MESSAGE_BLUETOOTH_STATE_CHANGE: OFF > BLE_TURNING_ON
04-21 16:52:17.290 D/BluetoothManagerService( 3297): Sending BLE State Change: OFF > BLE_TURNING_ON
04-21 16:52:17.291 I/AdapterProperties( 7058): init(), maxConnectedAudioDevices, default=5, propertyOverlayed=5, finalValue=5
04-21 16:52:17.294 D/BluetoothAdapterService( 7058): bleOnProcessStart() - Make Bond State Machine
04-21 16:52:17.294 D/BluetoothBondStateMachine( 7058): make
04-21 16:52:17.300 I/BluetoothBondStateMachine( 7058): StableState(): Entering Off State
04-21 16:52:17.301 I/BtGatt.JNI( 7058): classInitNative(L875): classInitNative: Success!
04-21 16:52:17.303 D/BtGatt.DebugUtils( 7058): handleDebugAction() action=null
......
04-21 16:52:21.292 E/AdapterState( 7058): BLE_TURNING_ON : BLE_START_TIMEOUT
04-21 16:52:21.293 I/AdapterState( 7058): BLE_TURNING_OFF : entered 
04-21 16:52:24.712 E/BluetoothManagerService( 3297): MESSAGE_TIMEOUT_BIND

蓝牙Crash信息

04-21 16:52:31.900 I/crash_dump32( 7118): performing dump of process 7058 (target tid = 7077)
04-21 16:52:31.922 F/DEBUG   ( 7118): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-21 16:52:31.922 F/DEBUG   ( 7118): Build fingerprint: ‘x:user/release-keys‘
04-21 16:52:31.923 F/DEBUG   ( 7118): Revision: ‘0‘
04-21 16:52:31.923 F/DEBUG   ( 7118): ABI: ‘arm‘
04-21 16:52:31.923 F/DEBUG   ( 7118): pid: 7058, tid: 7077, name: alarm_default_c  >>> com.android.bluetooth <<<
04-21 16:52:31.923 F/DEBUG   ( 7118): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
04-21 16:52:31.923 F/DEBUG   ( 7118):     r0  00000000  r1  00001ba5  r2  00000006  r3  a65df918
04-21 16:52:31.923 F/DEBUG   ( 7118):     r4  00001b92  r5  00001ba5  r6  8fd0621c  r7  0000010c
04-21 16:52:31.923 F/DEBUG   ( 7118):     r8  9024b4fd  r9  00000000  r10 9c7f4838  r11 00000000
04-21 16:52:31.923 F/DEBUG   ( 7118):     ip  00000041  sp  8fd06208  lr  a656e0e5  pc  a6565e72
04-21 16:52:31.973 F/DEBUG   ( 7118): 
04-21 16:52:31.973 F/DEBUG   ( 7118): backtrace:
04-21 16:52:31.973 F/DEBUG   ( 7118):     #00 pc 0001ce72  /system/lib/libc.so (abort+62)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #01 pc 0010e549  /system/lib/libbluetooth.so (hci_timeout_abort(void*)+76)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #02 pc 001abe0d  /system/lib/libbluetooth.so (alarm_ready_generic(alarm_t*, std::__1::unique_lock<std::__1::mutex>&)+164)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #03 pc 001abd2b  /system/lib/libbluetooth.so (alarm_queue_ready(fixed_queue_t*, void*)+66)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #04 pc 001ae881  /system/lib/libbluetooth.so (internal_dequeue_ready(void*)+48)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #05 pc 001b09bf  /system/lib/libbluetooth.so (run_reactor(reactor_t*, int)+218)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #06 pc 001b08b9  /system/lib/libbluetooth.so (reactor_start(reactor_t*)+44)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #07 pc 001b1a53  /system/lib/libbluetooth.so (run_thread(void*)+142)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #08 pc 00063c15  /system/lib/libc.so (__pthread_start(void*)+22)
04-21 16:52:31.973 F/DEBUG   ( 7118):     #09 pc 0001e065  /system/lib/libc.so (__start_thread+22)
04-21 16:52:32.702 E//system/bin/tombstoned( 3160): Tombstone written to: /data/tombstones/tombstone_07

以上是关于CtsVerifier-Bluetooth-LE-SEcure-ClientServer-Test测试pass但是无法选择PassButton的主要内容,如果未能解决你的问题,请参考以下文章