1 /* 2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SERVICES_EDM_INCLUDE_EDM_ENTERPRISE_DEVICE_MGR_STUB_ABILITY_H 17 #define SERVICES_EDM_INCLUDE_EDM_ENTERPRISE_DEVICE_MGR_STUB_ABILITY_H 18 19 #include <map> 20 21 #include "edm_log.h" 22 #include "external_manager_factory.h" 23 #include "func_code.h" 24 #include "ienterprise_device_mgr.h" 25 #include "iexternal_manager_factory.h" 26 #include "iremote_stub.h" 27 #include "permission_checker.h" 28 #include "enterprise_device_mgr_idl_stub.h" 29 30 namespace OHOS { 31 namespace EDM { 32 class EnterpriseDeviceMgrStub : public EnterpriseDeviceMgrIdlStub, public IEnterpriseDeviceMgr { 33 public: 34 EnterpriseDeviceMgrStub(); 35 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 36 37 protected: 38 virtual std::shared_ptr<IExternalManagerFactory> GetExternalManagerFactory(); 39 40 private: 41 std::vector<uint32_t> systemCodeList; 42 void InitSystemCodeList(); 43 ErrCode HandleDevicePolicyInner(uint32_t code, MessageParcel &data, MessageParcel &reply, int32_t userId); 44 ErrCode GetDevicePolicyInner(uint32_t code, MessageParcel &data, MessageParcel &reply, 45 int32_t userId, int32_t hasUserId = 1); 46 ErrCode CheckAndGetAdminProvisionInfoInner(uint32_t code, MessageParcel &data, MessageParcel &reply, int32_t 47 userId); 48 #ifdef EDM_SUPPORT_ALL_ENABLE 49 ErrCode OnRemoteRequestIdl(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); 50 #endif 51 std::shared_ptr<IExternalManagerFactory> externalManagerFactory_ = std::make_shared<ExternalManagerFactory>(); 52 }; 53 } // namespace EDM 54 } // namespace OHOS 55 #endif // SERVICES_EDM_INCLUDE_EDM_ENTERPRISE_DEVICE_MGR_STUB_ABILITY_H 56