From: Tomasz Marciniak Date: Thu, 30 Apr 2015 12:21:42 +0000 (+0200) Subject: [Bluetooth] Moved checking privileges to JS layer. X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~107 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e2fa04538acf45e71a1d03bc65406057e3af314;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Bluetooth] Moved checking privileges to JS layer. [Verification] Code compiles without errors. Change-Id: I13cb9c82ee862e869cd079ba85eef23fd1ecda44 Signed-off-by: Tomasz Marciniak --- diff --git a/src/bluetooth/bluetooth.gyp b/src/bluetooth/bluetooth.gyp index 3ce1d82a..4ce4d8d6 100644 --- a/src/bluetooth/bluetooth.gyp +++ b/src/bluetooth/bluetooth.gyp @@ -27,8 +27,6 @@ 'bluetooth_health_profile_handler.h', 'bluetooth_instance.cc', 'bluetooth_instance.h', - 'bluetooth_privilege.cc', - 'bluetooth_privilege.h', 'bluetooth_service_handler.cc', 'bluetooth_service_handler.h', 'bluetooth_socket.cc', diff --git a/src/bluetooth/bluetooth_adapter.cc b/src/bluetooth/bluetooth_adapter.cc index d9596239..ca8a0f46 100644 --- a/src/bluetooth/bluetooth_adapter.cc +++ b/src/bluetooth/bluetooth_adapter.cc @@ -32,7 +32,6 @@ #include "bluetooth/bluetooth_class.h" #include "bluetooth/bluetooth_device.h" #include "bluetooth/bluetooth_instance.h" -#include "bluetooth/bluetooth_privilege.h" #include "bluetooth/bluetooth_socket.h" #include "bluetooth/bluetooth_util.h" @@ -440,8 +439,6 @@ bool BluetoothAdapter::is_initialized() const { void BluetoothAdapter::SetName(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothAdmin, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); const auto& args = util::GetArguments(data); const auto name = FromJson(args, "name"); @@ -495,8 +492,6 @@ void BluetoothAdapter::SetName(const picojson::value& data, picojson::object& ou void BluetoothAdapter::SetPowered(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothAdmin, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); const auto& args = util::GetArguments(data); const auto new_powered = FromJson(args, "powered"); @@ -532,8 +527,6 @@ void BluetoothAdapter::SetPowered(const picojson::value& data, picojson::object& void BluetoothAdapter::SetVisible(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothManager, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); const auto& args = util::GetArguments(data); const auto visible = FromJson(args, "visible"); @@ -605,8 +598,6 @@ void BluetoothAdapter::SetVisible(const picojson::value& data, picojson::object& void BluetoothAdapter::DiscoverDevices(const picojson::value& /* data */, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out); - PlatformResult result = PlatformResult(ErrorCode::NO_ERROR); if (!is_initialized_) { @@ -639,8 +630,6 @@ void BluetoothAdapter::DiscoverDevices(const picojson::value& /* data */, picojs void BluetoothAdapter::StopDiscovery(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); PlatformResult result = PlatformResult(ErrorCode::NO_ERROR); @@ -687,8 +676,6 @@ void BluetoothAdapter::StopDiscovery(const picojson::value& data, picojson::obje void BluetoothAdapter::GetKnownDevices(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); auto get_known_devices = [this](const std::shared_ptr& response) -> void { @@ -736,8 +723,6 @@ void BluetoothAdapter::GetKnownDevices(const picojson::value& data, picojson::ob void BluetoothAdapter::GetDevice(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); const auto& args = util::GetArguments(data); @@ -836,8 +821,6 @@ class BondingHandler { void BluetoothAdapter::CreateBonding(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); const auto& args = util::GetArguments(data); @@ -942,8 +925,6 @@ void BluetoothAdapter::DestroyBonding(const picojson::value& data, picojson::obj { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); const auto& args = util::GetArguments(data); @@ -1042,8 +1023,6 @@ void BluetoothAdapter::DestroyBonding(const picojson::value& data, picojson::obj void BluetoothAdapter::RegisterRFCOMMServiceByUUID(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out); - const auto callback_handle = util::GetAsyncCallbackHandle(data); const auto& args = util::GetArguments(data); diff --git a/src/bluetooth/bluetooth_api.js b/src/bluetooth/bluetooth_api.js index eb0c617b..84a3a3ee 100644 --- a/src/bluetooth/bluetooth_api.js +++ b/src/bluetooth/bluetooth_api.js @@ -7,6 +7,7 @@ var T = xwalk.utils.type; var Converter = xwalk.utils.converter; var AV = xwalk.utils.validator; +var Privilege = xwalk.utils.privilege; var native = new xwalk.utils.NativeManager(extension); @@ -149,12 +150,9 @@ var BluetoothClass = function(data) { }); }; -var _PRIVILEGE_BLUETOOTH_GAP = 'http://tizen.org/privilege/bluetooth.gap'; - BluetoothClass.prototype.hasService = function() { console.log('Entered BluetoothClass.hasService()'); - - xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_GAP); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP); var args = AV.validateMethod(arguments, [ { @@ -234,6 +232,7 @@ var BluetoothSocket = function(data) { BluetoothSocket.prototype.writeData = function() { console.log('Entered BluetoothSocket.writeData()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP); var args = AV.validateMethod(arguments, [ { @@ -259,6 +258,7 @@ BluetoothSocket.prototype.writeData = function() { BluetoothSocket.prototype.readData = function() { console.log('Entered BluetoothSocket.readData()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP); var callArgs = { id : this._id @@ -275,6 +275,7 @@ BluetoothSocket.prototype.readData = function() { BluetoothSocket.prototype.close = function() { console.log('Entered BluetoothSocket.close()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP); if (_BLUETOOTH_SOCKET_STATE_CLOSED !== this.state) { var callArgs = { @@ -358,6 +359,7 @@ var BluetoothDevice = function(data) { BluetoothDevice.prototype.connectToServiceByUUID = function() { console.log('Entered BluetoothDevice.connectToServiceByUUID()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP); var args = AV.validateMethod(arguments, [ { @@ -459,6 +461,8 @@ var BluetoothServiceHandler = function(data) { BluetoothServiceHandler.prototype.unregister = function() { console.log('Entered BluetoothServiceHandler.unregister()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP); + var args = AV.validateMethod(arguments, [ { name : 'successCallback', @@ -554,6 +558,8 @@ var BluetoothHealthApplication = function(data) { BluetoothHealthApplication.prototype.unregister = function() { console.log('Entered BluetoothHealthApplication.unregister()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH); + var args = AV.validateMethod(arguments, [ { name : 'successCallback', @@ -610,6 +616,7 @@ BluetoothHealthProfileHandler.prototype.constructor = BluetoothProfileHandler; BluetoothHealthProfileHandler.prototype.registerSinkApplication = function() { console.log('Entered BluetoothHealthProfileHandler.registerSinkApplication()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH); var args = AV.validateMethod(arguments, [ { @@ -652,6 +659,7 @@ BluetoothHealthProfileHandler.prototype.registerSinkApplication = function() { BluetoothHealthProfileHandler.prototype.connectToSource = function() { console.log('Entered BluetoothHealthProfileHandler.connectToSource()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH); var args = AV.validateMethod(arguments, [ { @@ -718,6 +726,7 @@ var BluetoothHealthChannel = function(data) { BluetoothHealthChannel.prototype.close = function() { console.log('Entered BluetoothHealthChannel.close()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH); if (this.isConnected) { var callArgs = { @@ -737,6 +746,7 @@ BluetoothHealthChannel.prototype.close = function() { BluetoothHealthChannel.prototype.sendData = function() { console.log('Entered BluetoothHealthChannel.sendData()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH); var args = AV.validateMethod(arguments, [ { @@ -785,10 +795,10 @@ function _BluetoothHealthChannelChangeCallback(event) { } } -var _PRIVILEGE_BLUETOOTH_HEALTH = 'http://tizen.org/privilege/bluetooth.health'; - BluetoothHealthChannel.prototype.setListener = function() { console.log('Entered BluetoothHealthChannel.setListener()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH); + var args = AV.validateMethod(arguments, [ { name : 'changeCallback', @@ -797,8 +807,6 @@ BluetoothHealthChannel.prototype.setListener = function() { } ]); - xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_HEALTH); - if (T.isEmptyObject(_healthListeners)) { native.addListener('BluetoothHealthChannelChangeCallback', _BluetoothHealthChannelChangeCallback); @@ -808,8 +816,7 @@ BluetoothHealthChannel.prototype.setListener = function() { BluetoothHealthChannel.prototype.unsetListener = function() { console.log('Entered BluetoothHealthChannel.unsetListener ()'); - - xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_HEALTH); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH); delete _healthListeners[this._id]; @@ -887,6 +894,8 @@ var BluetoothAdapter = function() { BluetoothAdapter.prototype.setName = function() { console.log('Entered BluetoothAdapter.setName()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_ADMIN); + var args = AV.validateMethod(arguments, [ { name : 'name', @@ -925,6 +934,8 @@ BluetoothAdapter.prototype.setName = function() { BluetoothAdapter.prototype.setPowered = function() { console.log('Entered BluetoothAdapter.setPowered()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_ADMIN); + var args = AV.validateMethod(arguments, [ { name : 'powered', @@ -963,6 +974,8 @@ BluetoothAdapter.prototype.setPowered = function() { BluetoothAdapter.prototype.setVisible = function() { console.log('Entered BluetoothAdapter.setVisible()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTHMANAGER); + var args = AV.validateMethod(arguments, [ { name : 'visible', @@ -1120,6 +1133,8 @@ function _BluetoothDiscoverDevicesErrorCallback(event) { BluetoothAdapter.prototype.discoverDevices = function() { console.log('Entered BluetoothAdapter.discoverDevices()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP); + var args = AV.validateMethod(arguments, [ { name : 'successCallback', @@ -1154,6 +1169,8 @@ BluetoothAdapter.prototype.discoverDevices = function() { BluetoothAdapter.prototype.stopDiscovery = function() { console.log('Entered BluetoothAdapter.stopDiscovery()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP); + var args = AV.validateMethod(arguments, [ { name : 'successCallback', @@ -1184,6 +1201,8 @@ BluetoothAdapter.prototype.stopDiscovery = function() { BluetoothAdapter.prototype.getKnownDevices = function() { console.log('Entered BluetoothAdapter.getKnownDevices()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP); + var args = AV.validateMethod(arguments, [ { name : 'successCallback', @@ -1217,6 +1236,8 @@ BluetoothAdapter.prototype.getKnownDevices = function() { BluetoothAdapter.prototype.getDevice = function() { console.log('Entered BluetoothAdapter.getDevice()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP); + var args = AV.validateMethod(arguments, [ { name : 'address', @@ -1249,6 +1270,8 @@ BluetoothAdapter.prototype.getDevice = function() { BluetoothAdapter.prototype.createBonding = function() { console.log('Entered BluetoothAdapter.createBonding()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP); + var args = AV.validateMethod(arguments, [ { name : 'address', @@ -1287,6 +1310,8 @@ BluetoothAdapter.prototype.createBonding = function() { BluetoothAdapter.prototype.destroyBonding = function() { console.log('Entered BluetoothAdapter.destroyBonding()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP); + var args = AV.validateMethod(arguments, [ { name : 'address', @@ -1325,6 +1350,8 @@ BluetoothAdapter.prototype.destroyBonding = function() { BluetoothAdapter.prototype.registerRFCOMMServiceByUUID = function() { console.log('Entered BluetoothAdapter.registerRFCOMMServiceByUUID()'); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP); + var args = AV.validateMethod(arguments, [ { name : 'uuid', @@ -1418,7 +1445,7 @@ var BluetoothManager = function() { BluetoothManager.prototype.getDefaultAdapter = function() { console.log('Entered BluetoothManager.getDefaultAdapter()'); - xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_GAP); + xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP); return new BluetoothAdapter(); }; diff --git a/src/bluetooth/bluetooth_device.cc b/src/bluetooth/bluetooth_device.cc index f9166fff..999e839e 100644 --- a/src/bluetooth/bluetooth_device.cc +++ b/src/bluetooth/bluetooth_device.cc @@ -22,7 +22,6 @@ #include "bluetooth_adapter.h" #include "bluetooth_class.h" -#include "bluetooth_privilege.h" #include "bluetooth_util.h" namespace extension { @@ -104,8 +103,6 @@ void BluetoothDevice::ToJson(bt_adapter_device_discovery_info_s *info, picojson: void BluetoothDevice::ConnectToServiceByUUID(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out); - const auto& args = util::GetArguments(data); adapter_.ConnectToServiceByUUID(FromJson(args, "address"), diff --git a/src/bluetooth/bluetooth_health_application.cc b/src/bluetooth/bluetooth_health_application.cc index aec0358f..d8144e0f 100644 --- a/src/bluetooth/bluetooth_health_application.cc +++ b/src/bluetooth/bluetooth_health_application.cc @@ -21,7 +21,6 @@ #include "common/extension.h" #include "bluetooth_health_profile_handler.h" -#include "bluetooth_privilege.h" #include "bluetooth_util.h" namespace extension { @@ -43,8 +42,6 @@ BluetoothHealthApplication::BluetoothHealthApplication( void BluetoothHealthApplication::Unregister(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out); - const auto& args = util::GetArguments(data); handler_.UnregisterSinkAppAsync(FromJson(args, "id"), diff --git a/src/bluetooth/bluetooth_health_channel.cc b/src/bluetooth/bluetooth_health_channel.cc index 0a9a2366..695ec551 100644 --- a/src/bluetooth/bluetooth_health_channel.cc +++ b/src/bluetooth/bluetooth_health_channel.cc @@ -23,7 +23,6 @@ #include "common/extension.h" #include "bluetooth_device.h" -#include "bluetooth_privilege.h" #include "bluetooth_util.h" namespace extension { @@ -43,8 +42,6 @@ const std::string kId = "_id"; void BluetoothHealthChannel::Close(const picojson::value& data , picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out); - const auto& args = util::GetArguments(data); unsigned int channel = common::stol(FromJson(args, "channel")); @@ -61,8 +58,6 @@ void BluetoothHealthChannel::Close(const picojson::value& data , picojson::objec void BluetoothHealthChannel::SendData(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out); - const auto& args = util::GetArguments(data); unsigned int channel = common::stol(FromJson(args, "channel")); diff --git a/src/bluetooth/bluetooth_health_profile_handler.cc b/src/bluetooth/bluetooth_health_profile_handler.cc index e46d9c00..ae1bd31c 100644 --- a/src/bluetooth/bluetooth_health_profile_handler.cc +++ b/src/bluetooth/bluetooth_health_profile_handler.cc @@ -25,7 +25,6 @@ #include "bluetooth/bluetooth_instance.h" #include "bluetooth/bluetooth_health_application.h" #include "bluetooth/bluetooth_health_channel.h" -#include "bluetooth/bluetooth_privilege.h" #include "bluetooth/bluetooth_util.h" namespace extension { @@ -226,8 +225,6 @@ void BluetoothHealthProfileHandler::OnDataReceived(unsigned int channel, void BluetoothHealthProfileHandler::RegisterSinkApp(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out); - const auto& args = util::GetArguments(data); const auto data_type = static_cast(FromJson(args, "dataType")); const auto& name = FromJson(args, "name"); @@ -287,8 +284,6 @@ void BluetoothHealthProfileHandler::RegisterSinkApp(const picojson::value& data, void BluetoothHealthProfileHandler::ConnectToSource(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out); - const auto& args = util::GetArguments(data); const auto& address = FromJson(args, "address"); const auto& app_id = FromJson(args, "appId"); diff --git a/src/bluetooth/bluetooth_privilege.cc b/src/bluetooth/bluetooth_privilege.cc deleted file mode 100644 index 4f433e90..00000000 --- a/src/bluetooth/bluetooth_privilege.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "bluetooth_privilege.h" - -namespace extension { -namespace bluetooth { - -namespace Privilege { -const std::string kBluetoothAdmin = "http://tizen.org/privilege/bluetooth.admin"; -const std::string kBluetoothManager = "http://tizen.org/privilege/bluetoothmanager"; -const std::string kBluetoothGap = "http://tizen.org/privilege/bluetooth.gap"; -const std::string kBluetoothSpp = "http://tizen.org/privilege/bluetooth.spp"; -const std::string kBluetoothHealth = "http://tizen.org/privilege/bluetooth.health"; -} // namespace Privilege - -} // namespace bluetooth -} // namespace extension diff --git a/src/bluetooth/bluetooth_privilege.h b/src/bluetooth/bluetooth_privilege.h deleted file mode 100644 index 13a87d67..00000000 --- a/src/bluetooth/bluetooth_privilege.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef BLUETOOTH_BLUETOOTH_PRIVILEGE_H_ -#define BLUETOOTH_BLUETOOTH_PRIVILEGE_H_ - -#include - -namespace extension { -namespace bluetooth { - -namespace Privilege { - -extern const std::string kBluetoothAdmin; -extern const std::string kBluetoothManager; -extern const std::string kBluetoothGap; -extern const std::string kBluetoothSpp; -extern const std::string kBluetoothHealth; - -} // namespace Privilege - -} // namespace bluetooth -} // namespace extension - -#endif // BLUETOOTH_BLUETOOTH_PRIVILEGE_H_ diff --git a/src/bluetooth/bluetooth_service_handler.cc b/src/bluetooth/bluetooth_service_handler.cc index 0f04c6a3..20ba473a 100644 --- a/src/bluetooth/bluetooth_service_handler.cc +++ b/src/bluetooth/bluetooth_service_handler.cc @@ -21,7 +21,6 @@ #include "common/extension.h" #include "bluetooth_adapter.h" -#include "bluetooth_privilege.h" #include "bluetooth_util.h" namespace extension { @@ -36,8 +35,6 @@ BluetoothServiceHandler::BluetoothServiceHandler(BluetoothAdapter& adapter) void BluetoothServiceHandler::Unregister(const picojson::value& data, picojson::object& out) { LoggerD("Entered"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out); - const auto& args = util::GetArguments(data); adapter_.UnregisterUUID(FromJson(args, "uuid"), diff --git a/src/bluetooth/bluetooth_socket.cc b/src/bluetooth/bluetooth_socket.cc index 3771f1e4..9ed2a961 100644 --- a/src/bluetooth/bluetooth_socket.cc +++ b/src/bluetooth/bluetooth_socket.cc @@ -24,7 +24,6 @@ #include "bluetooth_adapter.h" #include "bluetooth_device.h" -#include "bluetooth_privilege.h" #include "bluetooth_util.h" namespace extension { @@ -50,8 +49,6 @@ BluetoothSocket::BluetoothSocket(BluetoothAdapter& adapter) void BluetoothSocket::WriteData(const picojson::value& data, picojson::object& out) { LoggerD("Enter"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out); - const auto& args = util::GetArguments(data); int socket = common::stol(FromJson(args, "id")); @@ -76,8 +73,6 @@ void BluetoothSocket::WriteData(const picojson::value& data, picojson::object& o void BluetoothSocket::ReadData(const picojson::value& data, picojson::object& out) { LoggerD("Enter"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out); - const auto& args = util::GetArguments(data); int socket = common::stol(FromJson(args, "id")); @@ -98,8 +93,6 @@ void BluetoothSocket::ReadData(const picojson::value& data, picojson::object& ou void BluetoothSocket::Close(const picojson::value& data, picojson::object& out) { LoggerD("Enter"); - CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out); - const auto& args = util::GetArguments(data); int socket = common::stol(FromJson(args, "id"));