mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1227440 - Reject pin reply by cancelling bond to trigger BondStateChangedNotification, in order to inform gaia setting app, r=shuang
This commit is contained in:
parent
83b65d05d1
commit
cdd3762041
@ -1268,6 +1268,28 @@ private:
|
||||
BluetoothReplyRunnable* mRunnable;
|
||||
};
|
||||
|
||||
class BluetoothServiceBluedroid::CancelBondResultHandler final
|
||||
: public BluetoothCoreResultHandler
|
||||
{
|
||||
public:
|
||||
CancelBondResultHandler(BluetoothReplyRunnable* aRunnable)
|
||||
: mRunnable(aRunnable)
|
||||
{ }
|
||||
|
||||
void CancelBond() override
|
||||
{
|
||||
DispatchReplySuccess(mRunnable);
|
||||
}
|
||||
|
||||
void OnError(BluetoothStatus aStatus) override
|
||||
{
|
||||
DispatchReplyError(mRunnable, aStatus);
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothReplyRunnable* mRunnable;
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::PinReplyInternal(
|
||||
const BluetoothAddress& aDeviceAddress, bool aAccept,
|
||||
@ -1277,8 +1299,14 @@ BluetoothServiceBluedroid::PinReplyInternal(
|
||||
|
||||
ENSURE_BLUETOOTH_IS_ENABLED_VOID(aRunnable);
|
||||
|
||||
sBtCoreInterface->PinReply(aDeviceAddress, aAccept, aPinCode,
|
||||
new PinReplyResultHandler(aRunnable));
|
||||
if (aAccept) {
|
||||
sBtCoreInterface->PinReply(aDeviceAddress, aAccept, aPinCode,
|
||||
new PinReplyResultHandler(aRunnable));
|
||||
} else {
|
||||
// Call CancelBond to trigger BondStateChangedNotification
|
||||
sBtCoreInterface->CancelBond(aDeviceAddress,
|
||||
new CancelBondResultHandler(aRunnable));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -20,6 +20,7 @@ class BluetoothServiceBluedroid
|
||||
, public BluetoothCoreNotificationHandler
|
||||
, public BluetoothNotificationHandler
|
||||
{
|
||||
class CancelBondResultHandler;
|
||||
class CleanupResultHandler;
|
||||
class DisableResultHandler;
|
||||
class DispatchReplyErrorResultHandler;
|
||||
|
Loading…
Reference in New Issue
Block a user