• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INSTALLD_SERVICE_H
17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INSTALLD_SERVICE_H
18 
19 #include <memory>
20 
21 #include "installd/installd_host_impl.h"
22 #include "ipc/installd_host.h"
23 
24 namespace OHOS {
25 namespace AppExecFwk {
26 
27 class InstalldService {
28 public:
29     InstalldService();
30     virtual ~InstalldService();
31     /**
32      * @brief Start the installd service.
33      * @return
34      */
35     void Start();
36     /**
37      * @brief Stop the installd service.
38      * @return
39      */
40     void Stop();
41     /**
42      * @brief Check whether if the installd service is ready.
43      * @return Returns true if the installd service is ready; returns false otherwise.
44      */
IsServiceReady()45     bool IsServiceReady() const
46     {
47         return isReady_;
48     }
49 
50 private:
51     /**
52      * @brief Initialize the installd service context.
53      * @return Returns true if initialized successfully; returns false otherwise.
54      */
55     bool Init();
56     /**
57      * @brief Initialize to create a directory.
58      * @param path Indicates the directory path to create.
59      * @return Returns true if directory created successfully; returns false otherwise.
60      */
61     bool InitDir(const std::string &path);
62 
63 private:
64     bool isReady_ = false;
65     sptr<InstalldHostImpl> hostImpl_;
66 
67     DISALLOW_COPY_AND_MOVE(InstalldService);
68 };
69 
70 }  // namespace AppExecFwk
71 }  // namespace OHOS
72 #endif  // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INSTALLD_SERVICE_H