• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_PLUGIN_INCLUDE_MANAGE_AUTO_START_APPS_PLUGIN_H
17 #define SERVICES_EDM_PLUGIN_INCLUDE_MANAGE_AUTO_START_APPS_PLUGIN_H
18 
19 #include "ability_manager_interface.h"
20 #include "bundle_mgr_interface.h"
21 #include "message_parcel.h"
22 #include "iplugin.h"
23 #include "iremote_stub.h"
24 #include "manage_auto_start_app_info.h"
25 
26 namespace OHOS {
27 namespace EDM {
28 class ManageAutoStartAppsPlugin : public IPlugin {
29 public:
30     ManageAutoStartAppsPlugin();
31     ErrCode OnHandlePolicy(std::uint32_t funcCode, MessageParcel &data, MessageParcel &reply,
32         HandlePolicyData &policyData, int32_t userId) override;
OnHandlePolicyDone(std::uint32_t funcCode,const std::string & adminName,bool isGlobalChanged,int32_t userId)33     void OnHandlePolicyDone(std::uint32_t funcCode, const std::string &adminName, bool isGlobalChanged,
34         int32_t userId) override{};
35     ErrCode OnGetPolicy(std::string &policyData, MessageParcel &data, MessageParcel &reply, int32_t userId) override;
36     ErrCode OnAdminRemove(const std::string &adminName, const std::string &currentJsonData,
37         const std::string &mergeJsonData, int32_t userId) override;
OnAdminRemoveDone(const std::string & adminName,const std::string & currentJsonData,int32_t userId)38     void OnAdminRemoveDone(const std::string &adminName, const std::string &currentJsonData,
39         int32_t userId) override {};
40     ErrCode GetOthersMergePolicyData(const std::string &adminName, int32_t userId,
41         std::string &othersMergePolicyData) override;
42 
43 private:
44     ErrCode SetOrRemoveOtherModulePolicy(const std::vector<ManageAutoStartAppInfo> &data, bool isSet,
45         std::vector<ManageAutoStartAppInfo> &failedData, int32_t userId);
46     ErrCode OnSetPolicy(std::vector<std::string> &data, bool disallowModify,
47         std::vector<ManageAutoStartAppInfo> &currentData, std::vector<ManageAutoStartAppInfo> &mergeData,
48         int32_t userId);
49     ErrCode OnRemovePolicy(std::vector<std::string> &data,
50         std::vector<ManageAutoStartAppInfo> &currentData, std::vector<ManageAutoStartAppInfo> &mergeData,
51         int32_t userId);
52     ErrCode SetOtherModulePolicy(const std::vector<std::string> &keepAliveApps,
53         int32_t userId, std::vector<ManageAutoStartAppInfo> &failedData, bool disallowModify);
54     bool CheckBundleAndAbilityExited(const std::string &bundleName, const std::string &abilityName);
55     uint32_t maxListSize_ = 0;
56 };
57 } // namespace EDM
58 } // namespace OHOS
59 
60 #endif /* SERVICES_EDM_PLUGIN_INCLUDE_MANAGE_AUTO_START_APPS_PLUGIN_H */