1 /*
2  * Copyright (c) 2022 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 #include <ability_info.h>
17 #include <ability_manager.h>
18 #include <element_name.h>
19 #include <module_info.h>
20 #include <want.h>
21 #include "launcher.h"
22 #include "ability_test.h"
23 
StartLauncherApp(void)24 void StartLauncherApp(void)
25 {
26     const char LAUNCHER_BUNDLE_NAME[] = "com.huawei.launcher";
27 
28     InstallLauncher();
29     Want want = {nullptr};
30     ElementName element = {nullptr};
31     SetElementBundleName(&element, LAUNCHER_BUNDLE_NAME);
32     SetWantElement(&want, element);
33     StartAbility(&want);
34     ClearElement(&element);
35     ClearWant(&want);
36 }
37 
StartJSApp(void)38 void StartJSApp(void)
39 {
40     const char JS_BUNDLE_NAME[] = "com.app.example";
41     const char JS_APP_PATH[] = "/data/panel";
42 
43     Want want = {nullptr};
44     ElementName element = {nullptr};
45     SetElementBundleName(&element, JS_BUNDLE_NAME);
46     SetWantElement(&want, element);
47     SetWantData(&want, JS_APP_PATH, strlen(JS_APP_PATH) + 1);
48     StartAbility(&want);
49     ClearElement(&element);
50     ClearWant(&want);
51 }
52