• 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 HIVIEW_SERVICE_AGENT_H
17 #define HIVIEW_SERVICE_AGENT_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "hiview_file_info.h"
23 #include "iremote_broker.h"
24 
25 namespace OHOS {
26 namespace HiviewDFX {
27 class HiviewServiceAgent {
28 public:
29     static int32_t List(const std::string& logType, std::vector<HiviewFileInfo>& fileInfos);
30     static int32_t Copy(const std::string& logType, const std::string& logName, const std::string& dest);
31     static int32_t Move(const std::string& logType, const std::string& logName, const std::string& dest);
32     static int32_t Remove(const std::string& logType, const std::string& logName);
33 
34 private:
35     HiviewServiceAgent() = default;
36     ~HiviewServiceAgent() = default;
37 
38     static int32_t CopyOrMoveFile(
39         const std::string& logType, const std::string& logName, const std::string& dest, bool isMove);
40     static bool CheckAndCreateHiviewDir(const std::string& destDir);
41     static bool CreateDestDirs(const std::string& rootDir, const std::string& destDir);
42     static bool CreateAndGrantAclPermission(const std::string& dirPath);
43     static sptr<IRemoteObject> GetRemoteService();
44 };
45 } // namespace HiviewDFX
46 } // namespace OHOS
47 #endif