OSDN Git Service

Fix Bluetooth pairing dialogue crash
authorJack He <siyuanh@google.com>
Tue, 1 Nov 2016 22:38:38 +0000 (15:38 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Thu, 19 Jan 2017 22:39:17 +0000 (22:39 +0000)
commite51972868cf6645d8bc3023496e2af68272d7a35
tree65fd61a8f5e2599cf458ba1bb662f32378b64e7a
parent0446865d68f82e956479b0e0db80505c85774e3a
Fix Bluetooth pairing dialogue crash

When pairing passkey is invalid, onCreate() should return early to
prevent any dialog from displaying, which will then call onDestroy()
to destroy the activity. However mReceiver should be registered before
onDestroy() is called as onDestroy() will call unregisterReceiver(mReceiver)
that will throw an IllegalArgumentException when mReceiver was not registered.

This fix adds a flag that tracks whether mReceiver has been registered.
In addition, this fix fails the passkey confirmation request upon invalid
passkey.

Bug: 32577328
Test: Test with PTS TC_SERVER_SA_BI_01_C
Change-Id: Ifc047bad6bd99abca04404af9cd54d2034cd35aa
(cherry picked from commit 6f8e9eda2d9ed830d47971d93327792906db2dc1)
src/com/android/settings/bluetooth/BluetoothPairingDialog.java