• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
23 #define LAUNCHER_BUNDLE_NAME "com.huawei.launcher"
24 #define JS_BUNDLE_NAME "com.app.example"
25 #define JS_APP_PATH "/data/panel" // "/data/js"
26 
StartLauncherApp()27 void StartLauncherApp()
28 {
29     InstallLauncher();
30     Want want = {nullptr};
31     ElementName element = {nullptr};
32     SetElementBundleName(&element, LAUNCHER_BUNDLE_NAME);
33     SetWantElement(&want, element);
34     StartAbility(&want);
35     ClearElement(&element);
36     ClearWant(&want);
37 }
38 
StartJSApp()39 void StartJSApp()
40 {
41     Want want = {nullptr};
42     ElementName element = {nullptr};
43     SetElementBundleName(&element, JS_BUNDLE_NAME);
44     SetWantElement(&want, element);
45     SetWantData(&want, JS_APP_PATH, strlen(JS_APP_PATH) + 1);
46     StartAbility(&want);
47     ClearElement(&element);
48     ClearWant(&want);
49 }
50