/* * Copyright (c) 2023 Huawei Device Co., Ltd. * 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 "disallowed_tethering_plugin.h" #include "bool_serializer.h" #include "edm_ipc_interface_code.h" #include "parameters.h" #include "iplugin_manager.h" namespace OHOS { namespace EDM { const bool REGISTER_RESULT = IPluginManager::GetInstance()->AddPlugin(DisallowedTetheringPlugin::GetPlugin()); void DisallowedTetheringPlugin::InitPlugin(std::shared_ptr> ptr) { EDMLOGI("DisallowedTetheringPlugin InitPlugin..."); std::map typePermissions; typePermissions.emplace(IPlugin::PermissionType::SUPER_DEVICE_ADMIN, EdmPermission::PERMISSION_ENTERPRISE_MANAGE_RESTRICTIONS); typePermissions.emplace(IPlugin::PermissionType::BYOD_DEVICE_ADMIN, EdmPermission::PERMISSION_PERSONAL_MANAGE_RESTRICTIONS); IPlugin::PolicyPermissionConfig config = IPlugin::PolicyPermissionConfig(typePermissions, IPlugin::ApiType::PUBLIC); ptr->InitAttribute(EdmInterfaceCode::DISALLOWED_TETHERING, PolicyName::POLICY_DISALLOWED_TETHERING, config, true); ptr->SetSerializer(BoolSerializer::GetInstance()); ptr->SetOnHandlePolicyListener(&DisallowedTetheringPlugin::OnSetPolicy, FuncOperateType::SET); ptr->SetOnAdminRemoveListener(&DisallowedTetheringPlugin::OnAdminRemove); persistParam_ = "persist.edm.tethering_disallowed"; } } // namespace EDM } // namespace OHOS