• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 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 OHOS_APP_MANAGE_H
17 #define OHOS_APP_MANAGE_H
18 
19 #include <ability_info.h>
20 #include <ability_slice.h>
21 #include <bundle_manager.h>
22 #include <element_name.h>
23 #include <module_info.h>
24 #include <want.h>
25 
26 #include "app_info.h"
27 #include "ui_config.h"
28 #include "view_group_page.h"
29 
30 namespace OHOS {
31 class AppManage {
32 public:
33     AppManage() = default;
34     ~AppManage();
35     // start all app ,get all app info
36 
37     bool LauncherApp(BundleInfo** info, int& count);
38     bool InstallApp(AppInfo* app);
39     bool UnInstallApp(AppInfo* app);
40     bool StartApp(AppInfo* app);
41     static void SetViewGroup(funcClick click, funcLongPress press, ViewGroupPage* viewPage[MAX_VIEWGROUP], int size);
42 
43 private:
44     static void MyBundleStateCallback(const uint8_t installType, const uint8_t resultCode, const void* resultMessage,
45         const char* bundleName, void* data);
46     static void MyBundleOwnCallback(const uint8_t resultCode, const void* resultMessage);
47     static bool GetAailityInfosByBundleName(const char* bundleName, AppInfo* pApp);
48     static bool GetAppInstallInfo(const char* bundleName);
49 
50 private:
51     BundleStatusCallback callBackParam_ { nullptr };
52     static ViewGroupPage* viewPage_[MAX_VIEWGROUP];
53     static int size_;
54     static funcClick installFuncclick_;
55     static funcLongPress installFunclPress_;
56 };
57 } // namespace OHOS
58 #endif