【問題描述】
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