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_test.h" 16 17 #include <cstring> 18 19 #include "ability_info.h" 20 #include "ability_manager.h" 21 #include "element_name.h" 22 #include "module_info.h" 23 #include "want.h" 24 25 #define LAUNCHER_BUNDLE_NAME "com.huawei.launcher" 26 #define JS_BUNDLE_NAME "com.app.music_player" 27 #define JS_APP_PATH "/data/player" // "/data/js" 28 29 StartJSApp()30void StartJSApp() 31 { 32 Want want = {nullptr}; 33 ElementName element = {nullptr}; 34 SetElementBundleName(&element, JS_BUNDLE_NAME); 35 SetWantElement(&want, element); 36 SetWantData(&want, JS_APP_PATH, strlen(JS_APP_PATH) + 1); 37 StartAbility(&want); 38 ClearElement(&element); 39 ClearWant(&want); 40 } 41