Revert "bluetooth: Introduce org.chromium.BluetoothDevice interface"
This reverts commit a7d513a042964b3311834d8bde1cc67252e66f3d.
Reason for revert: causing b:144183487.
Original change's description:
> bluetooth: Introduce org.chromium.BluetoothDevice interface
>
> Introduce the basic structure of the device plugin interface handler.
> This new interface is needed to support chromium plugin APIs. Similarly
> to the device interface, the device plugin interface need to attach to
> the newly discovered device and expose the methods to the D-Bus.
>
> BUG=b:141929301
> TEST=build and manual test
>
> dbus-send --system --type=method_call --print-reply --dest=org.\
> chromium.Bluetooth /org/bluez/hci0/dev_C8_4B_05_6A_1C_6B org.chromium.\
> BluetoothDevice.GetConnInfo
>
> Change-Id: I40ee7f1eebf9370817bc32054713041a01b708d1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1867439
> Tested-by: Michael Sun <michaelfsun@google.com>
> Commit-Queue: Michael Sun <michaelfsun@google.com>
> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Bug: b:141929301
Change-Id: I8ac25b6210f732272add532f7fac7c0862adb1e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1907300
Commit-Queue: Michael Sun <michaelfsun@google.com>
Tested-by: Michael Sun <michaelfsun@google.com>
Reviewed-by: Michael Sun <michaelfsun@google.com>
diff --git a/bluetooth/newblued/device_interface_handler.cc b/bluetooth/newblued/device_interface_handler.cc
index f861621..95267ce 100644
--- a/bluetooth/newblued/device_interface_handler.cc
+++ b/bluetooth/newblued/device_interface_handler.cc
@@ -324,8 +324,6 @@
dbus::ObjectPath device_path(ConvertDeviceAddressToObjectPath(address));
exported_object_manager_wrapper_->RemoveExportedInterface(
device_path, bluetooth_device::kBluetoothDeviceInterface);
- exported_object_manager_wrapper_->RemoveExportedInterface(
- device_path, bluetooth_plugin_device::kBluetoothPluginInterface);
discovered_devices_.erase(address);
return true;
}
@@ -394,16 +392,12 @@
dbus::ObjectPath device_path(
ConvertDeviceAddressToObjectPath(device->address.c_str()));
- auto device_interface =
+ ExportedInterface* device_interface =
exported_object_manager_wrapper_->GetExportedInterface(
device_path, bluetooth_device::kBluetoothDeviceInterface);
- auto device_plugin_interface =
- exported_object_manager_wrapper_->GetExportedInterface(
- device_path, bluetooth_plugin_device::kBluetoothPluginInterface);
// The first time a device of this address is discovered, create the D-Bus
- // object representing that device. device_plugin_interface and
- // device_interface have to go hand in hand.
- if (!device_interface) {
+ // object representing that device.
+ if (device_interface == nullptr) {
VLOG(1) << base::StringPrintf(
"Discovered a new device with %s address %s, rssi %d",
device->is_random_address ? "random" : "public",
@@ -414,19 +408,11 @@
device_path, bluetooth_device::kBluetoothDeviceInterface,
base::Bind(
&ExportedObjectManagerWrapper::SetupStandardPropertyHandlers));
- exported_object_manager_wrapper_->AddExportedInterface(
- device_path, bluetooth_plugin_device::kBluetoothPluginInterface,
- base::Bind(
- &ExportedObjectManagerWrapper::SetupStandardPropertyHandlers));
device_interface = exported_object_manager_wrapper_->GetExportedInterface(
device_path, bluetooth_device::kBluetoothDeviceInterface);
- device_plugin_interface =
- exported_object_manager_wrapper_->GetExportedInterface(
- device_path, bluetooth_plugin_device::kBluetoothPluginInterface);
AddDeviceMethodHandlers(device_interface);
- AddDevicePluginMethodHandlers(device_plugin_interface);
device_interface
->EnsureExportedPropertyRegistered<dbus::ObjectPath>(
@@ -444,10 +430,8 @@
// The property updates above have to be done before ExportAndBlock() to make
// sure that client receives the newly added object complete with its
// populated properties.
- if (is_new_device) {
+ if (is_new_device)
device_interface->ExportAndBlock();
- device_plugin_interface->ExportAndBlock();
- }
ClearPropertiesUpdated(device);
}
@@ -477,20 +461,6 @@
base::Unretained(this)));
}
-void DeviceInterfaceHandler::AddDevicePluginMethodHandlers(
- ExportedInterface* device_plugin_interface) {
- CHECK(device_plugin_interface);
-
- device_plugin_interface->AddMethodHandlerWithMessage(
- bluetooth_plugin_device::kGetConnInfo,
- base::Bind(&DeviceInterfaceHandler::HandleGetConnInfo,
- base::Unretained(this)));
- device_plugin_interface->AddMethodHandlerWithMessage(
- bluetooth_plugin_device::kSetLEConnectionParameters,
- base::Bind(&DeviceInterfaceHandler::HandleSetLEConnectionParameters,
- base::Unretained(this)));
-}
-
void DeviceInterfaceHandler::HandlePair(
std::unique_ptr<brillo::dbus_utils::DBusMethodResponse<>> response,
dbus::Message* message) {
@@ -608,24 +578,6 @@
bluetooth_device::kErrorFailed, "Not implemented");
}
-void DeviceInterfaceHandler::HandleGetConnInfo(
- std::unique_ptr<brillo::dbus_utils::DBusMethodResponse<>> response,
- dbus::Message* message) {
- CHECK(message);
-
- response->ReplyWithError(FROM_HERE, brillo::errors::dbus::kDomain,
- bluetooth_device::kErrorFailed, "Not implemented");
-}
-
-void DeviceInterfaceHandler::HandleSetLEConnectionParameters(
- std::unique_ptr<brillo::dbus_utils::DBusMethodResponse<>> response,
- dbus::Message* message) {
- CHECK(message);
-
- response->ReplyWithError(FROM_HERE, brillo::errors::dbus::kDomain,
- bluetooth_device::kErrorFailed, "Not implemented");
-}
-
void DeviceInterfaceHandler::ConnectInternal(
const std::string& device_address,
std::unique_ptr<brillo::dbus_utils::DBusMethodResponse<>> connect_response,
diff --git a/bluetooth/newblued/device_interface_handler.h b/bluetooth/newblued/device_interface_handler.h
index cf2ed0d..07ec550 100644
--- a/bluetooth/newblued/device_interface_handler.h
+++ b/bluetooth/newblued/device_interface_handler.h
@@ -244,9 +244,6 @@
// Installs org.bluez.Device1 method handlers.
void AddDeviceMethodHandlers(ExportedInterface* device_interface);
- // Installs org.chromium.BluetoothDevice method handlers.
- void AddDevicePluginMethodHandlers(
- ExportedInterface* device_plugin_interface);
// D-Bus method handlers for device objects.
void HandlePair(
@@ -264,15 +261,6 @@
void HandleExecuteWrite(
std::unique_ptr<brillo::dbus_utils::DBusMethodResponse<>> response,
dbus::Message* message);
- // D-Bus method handlers for device objects on org.chromium.BluetoothDevice
- // interface.
- void HandleGetConnInfo(
- std::unique_ptr<brillo::dbus_utils::DBusMethodResponse<>> response,
- dbus::Message* message);
- void HandleSetLEConnectionParameters(
- std::unique_ptr<brillo::dbus_utils::DBusMethodResponse<>> response,
- dbus::Message* message);
-
// TODO(mcchou): Handle the rest of the D-Bus methods of the device interface.
// ConnectProfile() - No op, but we may need dummy implementation later.
// DisconnectPorfile() - No op, but we may need dummy implementation later.
diff --git a/bluetooth/newblued/newblue_daemon_test.cc b/bluetooth/newblued/newblue_daemon_test.cc
index 8abea8c..6c65233 100644
--- a/bluetooth/newblued/newblue_daemon_test.cc
+++ b/bluetooth/newblued/newblue_daemon_test.cc
@@ -200,30 +200,6 @@
Return(true)));
}
- // Expects that the methods on org.chromium.BluetoothDevice interface are
- // exported.
- void ExpectDevicePluginMethodsExported(
- scoped_refptr<dbus::MockExportedObject> exported_object,
- MethodHandlerMap method_handlers) {
- EXPECT_CALL(
- *exported_object,
- ExportMethodAndBlock(bluetooth_plugin_device::kBluetoothPluginInterface,
- bluetooth_plugin_device::kGetConnInfo, _))
- .WillOnce(
- DoAll(SaveArg<2>(GetMethodHandler(
- method_handlers, bluetooth_plugin_device::kGetConnInfo)),
- Return(true)));
- EXPECT_CALL(*exported_object,
- ExportMethodAndBlock(
- bluetooth_plugin_device::kBluetoothPluginInterface,
- bluetooth_plugin_device::kSetLEConnectionParameters, _))
- .WillOnce(
- DoAll(SaveArg<2>(GetMethodHandler(
- method_handlers,
- bluetooth_plugin_device::kSetLEConnectionParameters)),
- Return(true)));
- }
-
// Expects that the methods on org.bluez.Device1 interface are exported.
void ExpectDeviceMethodsExported(
scoped_refptr<dbus::MockExportedObject> exported_object,
@@ -267,22 +243,6 @@
Return(true)));
}
- // Expects that the methods on org.chromium.BluetoothDevice interface are
- // unexported.
- void ExpectDevicePluginMethodsUnExported(
- scoped_refptr<dbus::MockExportedObject> exported_object) {
- EXPECT_CALL(*exported_object,
- UnexportMethodAndBlock(
- bluetooth_plugin_device::kBluetoothPluginInterface,
- bluetooth_plugin_device::kGetConnInfo))
- .WillOnce(Return(true));
- EXPECT_CALL(*exported_object,
- UnexportMethodAndBlock(
- bluetooth_plugin_device::kBluetoothPluginInterface,
- bluetooth_plugin_device::kSetLEConnectionParameters))
- .WillOnce(Return(true));
- }
-
// Expects that the methods on org.bluez.Device1 interface are unexported.
void ExpectDeviceMethodsUnexported(
scoped_refptr<dbus::MockExportedObject> exported_object) {
@@ -372,7 +332,6 @@
MethodHandlerMap method_handlers) {
scoped_refptr<dbus::MockExportedObject> exported_dev_object =
AddOrGetMockExportedObject(device_object_path);
- ExpectDevicePluginMethodsExported(exported_dev_object, method_handlers);
ExpectDeviceMethodsExported(exported_dev_object, method_handlers);
ExpectPropertiesMethodsExported(exported_dev_object, method_handlers);
EXPECT_CALL(*bus_, GetExportedObject(device_object_path))
@@ -384,7 +343,6 @@
const dbus::ObjectPath& device_object_path) {
scoped_refptr<dbus::MockExportedObject> exported_dev_object =
AddOrGetMockExportedObject(device_object_path);
- ExpectDevicePluginMethodsUnExported(exported_dev_object);
ExpectDeviceMethodsUnexported(exported_dev_object);
EXPECT_CALL(*exported_dev_object, Unregister()).Times(1);
}