1 /*
2 * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved.
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 #include <ability_info.h>
16 #include <ability_manager.h>
17 #include <element_name.h>
18 #include <module_info.h>
19 #include <want.h>
20 #include "launcher.h"
21 #include "ability_test.h"
22
StartLauncherApp(void)23 void StartLauncherApp(void)
24 {
25 InstallLauncher();
26 Want want = {nullptr};
27 ElementName element = {nullptr};
28 const char *launcherBundleName = "com.huawei.launcher";
29 SetElementBundleName(&element, launcherBundleName);
30 SetWantElement(&want, element);
31 StartAbility(&want);
32 ClearElement(&element);
33 ClearWant(&want);
34 }
35
StartJSApp(void)36 void StartJSApp(void)
37 {
38 Want want = {nullptr};
39 ElementName element = {nullptr};
40 const char *jsBundleName = "com.app.example";
41 SetElementBundleName(&element, jsBundleName);
42 SetWantElement(&want, element);
43 const char *jsAppPath = "/data/js";
44 SetWantData(&want, (const void *)jsAppPath, strlen(jsAppPath) + 1);
45 StartAbility(&want);
46 ClearElement(&element);
47 ClearWant(&want);
48 }
49