!4522 Maintain the interface of OTA upgrade in TDD test cases

Merge pull request !4522 from 189******51/master
This commit is contained in:
openharmony_ci 2023-08-15 08:52:23 +00:00 committed by Gitee
commit 7046d644bd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
250 changed files with 7194 additions and 0 deletions

View File

@ -176,6 +176,157 @@ ohos_unittest("BmsBundleInstallerTest") {
]
}
ohos_unittest("BmsBundleOtaUpdateTest") {
use_exceptions = true
module_out_path = module_output_path
include_dirs = [ "//third_party/jsoncpp/include" ]
sources = bundle_mgr_source
sources -= [ "${services_path}/bundlemgr/src/system_ability_helper.cpp" ]
sources += [
"${services_path}/bundlemgr/src/aot/aot_executor.cpp",
"${services_path}/bundlemgr/src/installd/installd_host_impl.cpp",
"${services_path}/bundlemgr/src/installd/installd_operator.cpp",
"${services_path}/bundlemgr/test/mock/src/installd_service.cpp",
]
sources += [
"${services_path}/bundlemgr/test/mock/src/accesstoken_kit.cpp",
"${services_path}/bundlemgr/test/mock/src/installd_permission_mgr.cpp",
"${services_path}/bundlemgr/test/mock/src/mock_status_receiver.cpp",
"${services_path}/bundlemgr/test/mock/src/system_ability_helper.cpp",
]
sources += bundle_install_sources
sources -= [ "${services_path}/bundlemgr/src/installd_client.cpp" ]
sources += [ "${services_path}/bundlemgr/test/mock/src/installd_client.cpp" ]
sources += [ "bms_bundle_ota_update_test.cpp" ]
configs = [ "${services_path}/bundlemgr/test:bundlemgr_test_config" ]
cflags = []
if (target_cpu == "arm") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${bundle_framework_path}/test/sceneProject/unittest/ohos_test:copy_ohos_test",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestAplDown:otaUpdateTestAplDown",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestAplUp:otaUpdateTestAplUp",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestAppField:otaUpdateTestAppField",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestBasis:otaUpdateTestBasis",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestBasis/feature1:otaUpdateTestBasisFeature1",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestBasis/feature2:otaUpdateTestBasisFeature2",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestModuleField:otaUpdateTestModuleField",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestSignaIcon:otaUpdateTestSignaIcon",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestSoChanged:otaUpdateTestSoChanged",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestSoChanged/feature1:otaUpdateTestSoChangedFeature1",
"${bundle_framework_path}/test/sceneProject/unittest/test_bundle/otaUpdateTestSoChanged/feature2:otaUpdateTestSoChangedFeature2",
"${core_path}:appexecfwk_core",
]
deps += bundle_install_deps
external_deps = [
"ability_base:want",
"access_token:libprivacy_sdk",
"access_token:libtokenid_sdk",
"appverify:libhapverify",
"common_event_service:cesfwk_innerkits",
"eventhandler:libeventhandler",
"hilog:libhilog",
"hitrace:hitrace_meter",
"init:libbegetutil",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
external_deps += bundle_install_external_deps
defines = []
if (configpolicy_enable) {
external_deps += [ "config_policy:configpolicy_util" ]
defines += [ "CONFIG_POLOCY_ENABLE" ]
}
if (bundle_framework_app_control) {
defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ]
sources += [
"${services_path}/bundlemgr/src/app_control/app_control_manager.cpp",
"${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp",
"${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp",
"${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp",
"${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp",
]
include_dirs += [ "${services_path}/bundlemgr/include/app_control" ]
external_deps += [ "c_utils:utils" ]
}
if (current_cpu == "arm64") {
defines += [ "USE_BUNDLE_EXTENSION" ]
}
if (build_selinux) {
external_deps += [ "selinux_adapter:libhap_restorecon" ]
cflags += [ "-DWITH_SELINUX" ]
}
if (account_enable) {
external_deps += [ "os_account:os_account_innerkits" ]
defines += [ "ACCOUNT_ENABLE" ]
}
if (bundle_framework_free_install) {
sources += aging
sources += free_install
sources += distributed_manager
external_deps += [
"ability_runtime:ability_manager",
"ability_runtime:app_manager",
"battery_manager:batterysrv_client",
"device_info_manager:distributed_device_profile_client",
"device_usage_statistics:usagestatsinner",
"display_manager:displaymgr",
"power_manager:powermgr_client",
"syscap_codec:syscap_interface_shared",
]
defines += [ "BUNDLE_FRAMEWORK_FREE_INSTALL" ]
}
if (ecologic_rule_mgr_enabled) {
external_deps += [ "ecological_rule_mgr:erms_client" ]
defines += [ "SUPPORT_ERMS" ]
include_dirs += [ "${ecological_rule_mgr_path}" ]
}
if (global_resmgr_enable) {
defines += [ "GLOBAL_RESMGR_ENABLE" ]
external_deps += [ "resource_management:global_resmgr" ]
}
if (hicollie_enable) {
external_deps += [ "hicollie:libhicollie" ]
defines += [ "HICOLLIE_ENABLE" ]
}
if (hisysevent_enable) {
sources += [ "${services_path}/bundlemgr/src/inner_event_report.cpp" ]
external_deps += [ "hisysevent:libhisysevent" ]
defines += [ "HISYSEVENT_ENABLE" ]
}
if (bundle_framework_quick_fix) {
include_dirs += [ "${services_path}/bundlemgr/src/include/quick_fix" ]
sources += quick_fix
defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ]
}
if (storage_service_enable) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
defines += [ "STORAGE_SERVICE_ENABLE" ]
}
external_deps += [ "kv_store:distributeddata_inner" ]
configs += [ "../../../../../services/bundlemgr:rdb_config" ]
external_deps += [ "relational_store:native_rdb" ]
sources += [
"${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp",
"${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp",
"${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp",
"${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp",
]
}
ohos_unittest("BmsMultipleBundleInstallerTest") {
use_exceptions = true
module_out_path = module_output_path
@ -866,6 +1017,7 @@ group("unittest") {
":BmsBundleInstallDeviceTypeTest",
":BmsBundleInstallIpcTest",
":BmsBundleInstallerTest",
":BmsBundleOtaUpdateTest",
":BmsMultipleBundleInstallerTest",
":BmsSystemBundleInstallerTest",
]

View File

@ -0,0 +1,480 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define private public
#define protected public
#include <gtest/gtest.h>
#include <chrono>
#include <cstdio>
#include <dirent.h>
#include <fcntl.h>
#include <fstream>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef BUNDLE_FRAMEWORK_APP_CONTROL
#include "app_control_manager_host_impl.h"
#include "app_control_constants.h"
#endif
#include "bundle_info.h"
#include "bundle_installer_host.h"
#include "bundle_mgr_service.h"
#include "directory_ex.h"
#include "install_param.h"
#include "installd/installd_service.h"
#include "installd_client.h"
#include "mock_status_receiver.h"
#include "scope_guard.h"
#include "shared/shared_bundle_installer.h"
#include "system_bundle_installer.h"
#include "want.h"
#include "file_ex.h"
using namespace testing::ext;
using namespace std::chrono_literals;
using namespace OHOS::AppExecFwk;
using OHOS::DelayedSingleton;
namespace OHOS {
namespace {
const std::string RESOURCE_ROOT_PATH = "/data/test/resource/bms/install_bundle/";
const std::string OTAUPDATETESTBASIS_BUNDLE = "otaUpdateTestBasis.hap";
const std::string OTAUPDATETESTBASISFEATURE1_BUNDLE = "otaUpdateTestBasisFeature1.hap";
const std::string OTAUPDATETESTBASISFEATURE2_BUNDLE = "otaUpdateTestBasisFeature2.hap";
const std::string OTAUPDATETESTAPPFIELD_BUNDLE = "otaUpdateTestAppField.hap";
const std::string OTAUPDATETESTMODULEFIELD_BUNDLE = "otaUpdateTestModuleField.hap";
const std::string OTAUPDATETESTSIGNAICON_BUNDLE = "otaUpdateTestSignaIcon.hap";
const std::string OTAUPDATETEAPLUP_BUNDLE = "otaUpdateTestAplUp.hap";
const std::string OTAUPDATETEAPLDOWN_BUNDLE = "otaUpdateTestAplDown.hap";
const std::string OTAUPDATETESTSOCHANGED_BUNDLE = "otaUpdateTestSoChanged.hap";
const std::string OTAUPDATETESTSOCHANGEDFEATURE1_BUNDLE = "otaUpdateTestSoChangedFeature1.hap";
const std::string OTAUPDATETESTSOCHANGEDFEATURE2_BUNDLE = "otaUpdateTestSoChangedFeature2.hap";
const std::string BUNDLE_OTAUPDATETEST_NAME = "com.example.otaupdatetest";
const int32_t WAIT_TIME = 5; // init mocked bms
const int32_t USERID = 100;
const int32_t VERSION_CODE1 = 1000000;
const int32_t VERSION_CODE2 = 2000000;
const std::string VERSION_NAME1 = "1.0.0.0";
const std::string VERSION_NAME2 = "2.0.0.0";
const std::string APL_NORMAL = "normal";
const std::string APL_BASIC = "system_basic";
const std::string APL_CORE = "system_core";
const std::string MODULE_NAME1 = "entry1";
const std::string MODULE_NAME2 = "entry2";
const std::string PROCESS_BASIS = "basis";
const std::string PROCESS_MODULEFIELD = "modulefield";
} // namespace
class BmsBundleOtaUpdateTest : public testing::Test {
public:
BmsBundleOtaUpdateTest();
~BmsBundleOtaUpdateTest();
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp();
void TearDown();
bool InstallSystemBundle(const std::string &filePath) const;
bool OTAInstallSystemBundle(const std::string &filePath) const;
bool OTAInstallSystemBundle(const std::vector<std::string> &filePaths) const;
void CheckFileExist() const;
void CheckFileNonExist() const;
const std::shared_ptr<BundleDataMgr> GetBundleDataMgr() const;
const std::shared_ptr<BundleInstallerManager> GetBundleInstallerManager() const;
void StopInstalldService() const;
void StopBundleService();
void CreateInstallerManager();
void ClearBundleInfo();
void ClearDataMgr();
void ResetDataMgr();
private:
std::shared_ptr<BundleInstallerManager> manager_ = nullptr;
static std::shared_ptr<InstalldService> installdService_;
static std::shared_ptr<BundleMgrService> bundleMgrService_;
};
std::shared_ptr<BundleMgrService> BmsBundleOtaUpdateTest::bundleMgrService_ =
DelayedSingleton<BundleMgrService>::GetInstance();
std::shared_ptr<InstalldService> BmsBundleOtaUpdateTest::installdService_ =
std::make_shared<InstalldService>();
BmsBundleOtaUpdateTest::BmsBundleOtaUpdateTest()
{}
BmsBundleOtaUpdateTest::~BmsBundleOtaUpdateTest()
{}
bool BmsBundleOtaUpdateTest::InstallSystemBundle(const std::string &filePath) const
{
bundleMgrService_->GetDataMgr()->AddUserId(USERID);
auto installer = std::make_unique<SystemBundleInstaller>();
InstallParam installParam;
installParam.userId = USERID;
installParam.isPreInstallApp = true;
installParam.noSkipsKill = false;
installParam.needSendEvent = false;
installParam.needSavePreInstallInfo = true;
installParam.copyHapToInstallPath = false;
return installer->InstallSystemBundle(filePath, installParam, Constants::AppType::SYSTEM_APP);
}
bool BmsBundleOtaUpdateTest::OTAInstallSystemBundle(const std::vector<std::string> &filePaths) const
{
bundleMgrService_->GetDataMgr()->AddUserId(USERID);
auto installer = std::make_unique<SystemBundleInstaller>();
InstallParam installParam;
installParam.userId = USERID;
installParam.isPreInstallApp = true;
installParam.noSkipsKill = false;
installParam.needSendEvent = false;
installParam.needSavePreInstallInfo = true;
installParam.copyHapToInstallPath = false;
return installer->OTAInstallSystemBundle(filePaths, installParam, Constants::AppType::SYSTEM_APP);
}
bool BmsBundleOtaUpdateTest::OTAInstallSystemBundle(const std::string &filePath) const
{
std::vector<std::string> filePaths;
filePaths.push_back(filePath);
return OTAInstallSystemBundle(filePaths);
}
void BmsBundleOtaUpdateTest::SetUpTestCase()
{
}
void BmsBundleOtaUpdateTest::TearDownTestCase()
{
bundleMgrService_->OnStop();
}
void BmsBundleOtaUpdateTest::SetUp()
{
if (!installdService_->IsServiceReady()) {
installdService_->Start();
}
if (!bundleMgrService_->IsServiceReady()) {
bundleMgrService_->OnStart();
std::this_thread::sleep_for(std::chrono::seconds(WAIT_TIME));
}
}
void BmsBundleOtaUpdateTest::TearDown()
{
}
const std::shared_ptr<BundleDataMgr> BmsBundleOtaUpdateTest::GetBundleDataMgr() const
{
return bundleMgrService_->GetDataMgr();
}
/**
* @tc.number: SUB_BMS_OTA_0001
* @tc.name: test the right system bundle file can be installed
* @tc.desc: 1. The system bundle file exists.
* 2. Lower version of the hap is installed successfully.
* 3. It's updated to a higher version successfully.
* 4. Some fields defined in app.json, which will serve as a basis for
* judging the update success, are as follows:
* "versionCode": 1000000 -> 2000000
* "versionName": "1.0.0.0" -> "2.0.0.0"
* "asanEnabled": true -> false
*/
HWTEST_F(BmsBundleOtaUpdateTest, SUB_BMS_OTA_0001, Function | SmallTest | Level3)
{
std::string bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASIS_BUNDLE;
std::string bundleName = BUNDLE_OTAUPDATETEST_NAME;
bool ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
auto dataMgr = GetBundleDataMgr();
ASSERT_NE(dataMgr, nullptr) << "the dataMgr is nullptr";
ApplicationInfo applicationInfo;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(applicationInfo.versionCode, VERSION_CODE1);
EXPECT_EQ(applicationInfo.versionName, VERSION_NAME1);
EXPECT_TRUE(applicationInfo.asanEnabled);
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTAPPFIELD_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the update failed: " << bundleFile;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(applicationInfo.versionCode, VERSION_CODE2);
EXPECT_EQ(applicationInfo.versionName, VERSION_NAME2);
EXPECT_FALSE(applicationInfo.asanEnabled);
auto installer = std::make_unique<SystemBundleInstaller>();
ret = installer->UninstallSystemBundle(bundleName);
EXPECT_TRUE(ret) << "the uninstall failed: " << bundleFile;
}
/**
* @tc.number: SUB_BMS_OTA_0002
* @tc.name: test the right system bundle file can be installed
* @tc.desc: 1. The system bundle file exists.
* 2. A lower version of the hap is installed successfully.
* 3. It's updated to a higher version successfully.
* 4. Some fields defined in module.json, which will serve as a basis for
* judging the update success, are as follows:
* "name": "entry1" -> "entry2"
* "process": "basis" -> "modulefield"
*/
HWTEST_F(BmsBundleOtaUpdateTest, SUB_BMS_OTA_0002, Function | SmallTest | Level3)
{
std::string bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASIS_BUNDLE;
std::string bundleName = BUNDLE_OTAUPDATETEST_NAME;
bool ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
auto dataMgr = GetBundleDataMgr();
ASSERT_NE(dataMgr, nullptr) << "the dataMgr is nullptr";
AbilityInfo abilityInfo;
abilityInfo.bundleName = bundleName;
abilityInfo.package = MODULE_NAME1;
HapModuleInfo hapModuleInfo;
ret = dataMgr->GetHapModuleInfo(abilityInfo, hapModuleInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(hapModuleInfo.name, MODULE_NAME1);
EXPECT_EQ(hapModuleInfo.process, PROCESS_BASIS);
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTMODULEFIELD_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the update failed: " << bundleFile;
abilityInfo.bundleName = bundleName;
abilityInfo.package = MODULE_NAME2;
ret = dataMgr->GetHapModuleInfo(abilityInfo, hapModuleInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(hapModuleInfo.name, MODULE_NAME2);
EXPECT_EQ(hapModuleInfo.process, PROCESS_MODULEFIELD);
auto installer = std::make_unique<SystemBundleInstaller>();
ret = installer->UninstallSystemBundle(bundleName);
EXPECT_TRUE(ret) << "the uninstall failed: " << bundleFile;
}
/**
* @tc.number: SUB_BMS_OTA_0003
* @tc.name: test the right system bundle file can be installed
* @tc.desc: 1. The system bundle file exists.
* 2. A lower version of the hap is installed successfully.
* 3. It's updated to a higher version successfully.
* 4. The signature files of these two versions are different.
*/
HWTEST_F(BmsBundleOtaUpdateTest, SUB_BMS_OTA_0003, Function | SmallTest | Level3)
{
std::string bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASIS_BUNDLE;
std::string bundleName = BUNDLE_OTAUPDATETEST_NAME;
bool ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTSIGNAICON_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the update failed: " << bundleFile;
auto installer = std::make_unique<SystemBundleInstaller>();
ret = installer->UninstallSystemBundle(bundleName);
EXPECT_TRUE(ret) << "the uninstall failed: " << bundleFile;
}
/**
* @tc.number: SUB_BMS_OTA_0004
* @tc.name: test the right system bundle file can be installed
* @tc.desc: 1. the system bundle file exists
* 2. A higher version of the hap is installed successfully.
* 3. It's downgraded to a lower version successfully. However, only by uninstalling
* and installing again can a higher version be replaced with a lower.
* 4. The icons of these two versions are different.
*/
HWTEST_F(BmsBundleOtaUpdateTest, SUB_BMS_OTA_0004, Function | SmallTest | Level3)
{
std::string bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTSIGNAICON_BUNDLE;
std::string bundleName = BUNDLE_OTAUPDATETEST_NAME;
bool ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASIS_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_FALSE(ret) << "the install succeeded: " << bundleFile;
auto installer = std::make_unique<SystemBundleInstaller>();
ret = installer->UninstallSystemBundle(bundleName);
EXPECT_TRUE(ret) << "the uninstall failed: " << bundleFile;
}
/**
* @tc.number: SUB_BMS_OTA_0005
* @tc.name: test the right system bundle file can be installed
* @tc.desc: 1. The system bundle file exists.
* 2. A lower version of the hap with so is installed successfully.
* 3. It's updated to a higher version successfully.
* 4. The change of so of different component, which will serve as a basis for
* judging the update success, are as follows:
* entry: 0 so -> 2 so
* feature1: 2 so -> 0 so
* feature2: 2 so -> 1 so
*/
HWTEST_F(BmsBundleOtaUpdateTest, SUB_BMS_OTA_0005, Function | SmallTest | Level3)
{
std::string bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASIS_BUNDLE;
std::string bundleName = BUNDLE_OTAUPDATETEST_NAME;
bool ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
auto dataMgr = GetBundleDataMgr();
ASSERT_NE(dataMgr, nullptr) << "the dataMgr is nullptr";
ApplicationInfo applicationInfo;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(applicationInfo.nativeLibraryPath, "");
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASISFEATURE1_BUNDLE;
ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASISFEATURE2_BUNDLE;
ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_NE(applicationInfo.nativeLibraryPath, "");
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTSOCHANGED_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the update failed: " << bundleFile;
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTSOCHANGEDFEATURE1_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the update failed: " << bundleFile;
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTSOCHANGEDFEATURE2_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the update failed: " << bundleFile;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_NE(applicationInfo.nativeLibraryPath, "");
auto installer = std::make_unique<SystemBundleInstaller>();
ret = installer->UninstallSystemBundle(bundleName);
EXPECT_TRUE(ret) << "the uninstall failed: " << bundleFile;
}
/**
* @tc.number: SUB_BMS_OTA_0006
* @tc.name: test the right system bundle file can be installed
* @tc.desc: 1. the system bundle file exists
* 2. A lower version of the hap is installed successfully.
* 3. It's updated to a higher version successfully.
* 4. Apl of the lower version is system_basic, while apl of the
* higher version is system_core.
*/
HWTEST_F(BmsBundleOtaUpdateTest, SUB_BMS_OTA_0006, Function | SmallTest | Level3)
{
std::string bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASIS_BUNDLE;
std::string bundleName = BUNDLE_OTAUPDATETEST_NAME;
bool ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
auto dataMgr = GetBundleDataMgr();
ASSERT_NE(dataMgr, nullptr) << "the dataMgr is nullptr";
ApplicationInfo applicationInfo;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(applicationInfo.appPrivilegeLevel, APL_BASIC);
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETEAPLUP_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the update successed: " << bundleFile;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(applicationInfo.appPrivilegeLevel, APL_CORE);
auto installer = std::make_unique<SystemBundleInstaller>();
ret = installer->UninstallSystemBundle(bundleName);
EXPECT_TRUE(ret) << "the uninstall failed: " << bundleFile;
}
/**
* @tc.number: SUB_BMS_OTA_0007
* @tc.name: test the right system bundle file can be installed
* @tc.desc: 1. the system bundle file exists
* 2. A lower version of the hap is installed successfully.
* 3. It's updated to a higher version successfully.
* 4. Apl of the lower version is system_basic, while apl of the
* higher version is normal.
*/
HWTEST_F(BmsBundleOtaUpdateTest, SUB_BMS_OTA_0007, Function | SmallTest | Level3)
{
std::string bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASIS_BUNDLE;
std::string bundleName = BUNDLE_OTAUPDATETEST_NAME;
bool ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
auto dataMgr = GetBundleDataMgr();
ASSERT_NE(dataMgr, nullptr) << "the dataMgr is nullptr";
ApplicationInfo applicationInfo;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(applicationInfo.appPrivilegeLevel, APL_BASIC);
bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETEAPLDOWN_BUNDLE;
ret = OTAInstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the update failed: " << bundleFile;
ret = dataMgr->GetApplicationInfo(bundleName, 0, USERID, applicationInfo);
EXPECT_TRUE(ret);
EXPECT_EQ(applicationInfo.appPrivilegeLevel, APL_NORMAL);
auto installer = std::make_unique<SystemBundleInstaller>();
ret = installer->UninstallSystemBundle(bundleName);
EXPECT_TRUE(ret) << "the uninstall failed: " << bundleFile;
}
/**
* @tc.number: SUB_BMS_OTA_0008
* @tc.name: test the right system bundle file can be installed
* @tc.desc: 1. the system bundle file exists
* 2. It's updated to a higher version successfully.
* 3. The high version has two haps with same bundlename and different
* modulenames so the ota interface needs to be called two times.
*/
HWTEST_F(BmsBundleOtaUpdateTest, SUB_BMS_OTA_0008, Function | SmallTest | Level3)
{
std::string bundleFile = RESOURCE_ROOT_PATH + OTAUPDATETESTBASIS_BUNDLE;
std::string bundleName = BUNDLE_OTAUPDATETEST_NAME;
bool ret = InstallSystemBundle(bundleFile);
EXPECT_TRUE(ret) << "the install failed: " << bundleFile;
auto dataMgr = GetBundleDataMgr();
ASSERT_NE(dataMgr, nullptr) << "the dataMgr is nullptr";
std::vector<string> bundleFiles;
bundleFiles.push_back(RESOURCE_ROOT_PATH + OTAUPDATETESTSOCHANGED_BUNDLE);
bundleFiles.push_back(RESOURCE_ROOT_PATH + OTAUPDATETESTSOCHANGEDFEATURE1_BUNDLE);
bundleFiles.push_back(RESOURCE_ROOT_PATH + OTAUPDATETESTSOCHANGEDFEATURE2_BUNDLE);
ret = OTAInstallSystemBundle(bundleFiles);
EXPECT_TRUE(ret) << "the update failed";
auto installer = std::make_unique<SystemBundleInstaller>();
ret = installer->UninstallSystemBundle(bundleName);
EXPECT_TRUE(ret) << "the uninstall failed: " << bundleFile;
}
} // OHOS

View File

@ -104,6 +104,21 @@
<option name="push" value="test_bundle/devicetype_error.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
</preparer>
</target>
<target name="BmsBundleOtaUpdateTest">
<preparer>
<option name="push" value="test_bundle/otaUpdateTestAppField.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestAplDown.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestAplUp.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestBasis.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestBasisFeature1.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestBasisFeature2.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestModuleField.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestSignaIcon.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestSoChanged.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestSoChangedFeature1.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
<option name="push" value="test_bundle/otaUpdateTestSoChangedFeature2.hap -> /data/test/resource/bms/install_bundle/" src="res"/>
</preparer>
</target>
<target name="BmsBundleManagerTest">
<preparer>
<option name="push" value="test_bundle/backup.hap -> /data/test/resource/bms/install_bundle/" src="res"/>

View File

@ -39,6 +39,17 @@ group("test_bundle") {
"fourth_right:fourth_right",
"moduleJsonTest:moduleJsonTest",
"ninth_right:ninth_right",
"otaUpdateTestAplDown:otaUpdateTestAplDown",
"otaUpdateTestAplUp:otaUpdateTestAplUp",
"otaUpdateTestAppField:otaUpdateTestAppField",
"otaUpdateTestBasis:otaUpdateTestBasis",
"otaUpdateTestBasis/feature1:otaUpdateTestBasisFeature1",
"otaUpdateTestBasis/feature2:otaUpdateTestBasisFeature2",
"otaUpdateTestModuleField:otaUpdateTestModuleField",
"otaUpdateTestSignaIcon:otaUpdateTestSignaIcon",
"otaUpdateTestSoChanged:otaUpdateTestSoChanged",
"otaUpdateTestSoChanged/feature1:otaUpdateTestSoChangedFeature1",
"otaUpdateTestSoChanged/feature2:otaUpdateTestSoChangedFeature2",
"previewTest:previewTest",
"resourceManagerTest:resourceManagerTest",
"rightTest:rightTest",

View File

@ -0,0 +1,17 @@
{
"app": {
"apiReleaseType": "Canary1",
"bundleName": "com.example.otaupdatetest",
"debug": true,
"icon": "$media:app_icon",
"iconId": 16777217,
"label": "$string:app_name",
"labelId": 16777216,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0.0",
"asanEnabled": true
}
}

View File

@ -0,0 +1,8 @@
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}

View File

@ -0,0 +1,61 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("../../../../../appexecfwk.gni")
ohos_hap("otaUpdateTestAplDown") {
hap_profile = "entry/src/main/module.json"
hap_name = "otaUpdateTestAplDown"
subsystem_name = "bundlemanager"
final_hap_path = "$root_out_dir/tests/unittest/bundle_framework/bundlemgrservice/resource/test_bundle/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
shared_libraries = [
":otaUpdateTestAplDownSo1",
":otaUpdateTestAplDownSo2",
]
certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.otaupdatetestapldown.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("hjs_demo_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ohos_shared_library("otaUpdateTestAplDownSo1") {
sources = [ "entry/src/main/cpp/hapso15.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_shared_library("otaUpdateTestAplDownSo2") {
sources = [ "entry/src/main/cpp/hapso16.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo15() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo16() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
@State message: string = 'Default App Test'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,134 @@
{
"module": {
"abilities": [
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "MainAbility",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
},
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "SecondAbility",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
},
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "ThirdAbility",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
}
],
"deliveryWithInstall": true,
"description": "$string:entry_desc",
"descriptionId": 16777220,
"deviceTypes": [
"2in1",
"default",
"phone",
"tablet"
],
"extensionAbilities": [
{
"name": "extensionAbility_A",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "",
"type": "backup"
},
{
"name": "extensionAbility_B",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "",
"type": "backup"
},
{
"name": "extensionAbility_C",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "",
"type": "backup"
}
],
"installationFree": false,
"mainElement": "MainAbility",
"name": "entry",
"pages": "$profile:main_pages",
"srcEntry": "./ets/Application/AbilityStage.ts",
"type": "entry",
"virtualMachine": "ark",
"compressNativeLibs": false,
"libIsolation": false
}
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "MainAbility_desc",
"value": "i am an entry for phone"
},
{
"name": "MainAbility_label",
"value": "the phone entry ability"
},
{
"name": "entry_desc",
"value": "ActsContextTest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,61 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("../../../../../../appexecfwk.gni")
ohos_hap("otaUpdateTestAplDownFeature1") {
hap_profile = "src/main/module.json"
hap_name = "otaUpdateTestAplDownFeature1"
subsystem_name = "bundlemanager"
final_hap_path = "$root_out_dir/tests/systemtest/bundle_framework/bundlemgrsst/resource/testHapSo/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
shared_libraries = [
":otaUpdateTestAplDownFt1So1",
":otaUpdateTestAplDownFt1So2",
]
certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.otaUpdateTestAplDown.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "../AppScope/app.json"
sources = [ "../AppScope/resources" ]
}
ohos_resources("hjs_demo_resources") {
sources = [ "src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "src/main/module.json"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "src/main/ets"
}
ohos_shared_library("otaUpdateTestAplDownFt1So1") {
sources = [ "src/main/cpp/hapso23.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_shared_library("otaUpdateTestAplDownFt1So2") {
sources = [ "src/main/cpp/hapso24.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo23() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo24() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
@State message: string = 'Default App Test'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,45 @@
{
"module": {
"abilities": [
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "MainAbility",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
}
],
"deliveryWithInstall": true,
"description": "$string:entry_desc",
"descriptionId": 16777220,
"deviceTypes": [
"2in1",
"default",
"phone",
"tablet"
],
"installationFree": false,
"mainElement": "MainAbility",
"name": "feature1",
"pages": "$profile:main_pages",
"srcEntry": "./ets/Application/AbilityStage.ts",
"type": "feature",
"virtualMachine": "ark",
"compressNativeLibs": true,
"libIsolation": false
}
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "MainAbility_desc",
"value": "i am an entry for phone"
},
{
"name": "MainAbility_label",
"value": "the phone entry ability"
},
{
"name": "entry_desc",
"value": "ActsContextTest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,61 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("../../../../../../appexecfwk.gni")
ohos_hap("otaUpdateTestAplDownFeature2") {
hap_profile = "src/main/module.json"
hap_name = "otaUpdateTestAplDownFeature2"
subsystem_name = "bundlemanager"
final_hap_path = "$root_out_dir/tests/systemtest/bundle_framework/bundlemgrsst/resource/testHapSo/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
shared_libraries = [
":otaUpdateTestAplDownFt2So1",
":otaUpdateTestAplDownFt2So2",
]
certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.otaUpdateTestAplDown.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "../AppScope/app.json"
sources = [ "../AppScope/resources" ]
}
ohos_resources("hjs_demo_resources") {
sources = [ "src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "src/main/module.json"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "src/main/ets"
}
ohos_shared_library("otaUpdateTestAplDownFt2So1") {
sources = [ "src/main/cpp/hapso33.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_shared_library("otaUpdateTestAplDownFt2So2") {
sources = [ "src/main/cpp/hapso34.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo33() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo34() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
@State message: string = 'Default App Test'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,45 @@
{
"module": {
"abilities": [
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "MainAbility",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
}
],
"deliveryWithInstall": true,
"description": "$string:entry_desc",
"descriptionId": 16777220,
"deviceTypes": [
"2in1",
"default",
"phone",
"tablet"
],
"installationFree": false,
"mainElement": "MainAbility",
"name": "feature2",
"pages": "$profile:main_pages",
"srcEntry": "./ets/Application/AbilityStage.ts",
"type": "feature",
"virtualMachine": "ark",
"compressNativeLibs": false,
"libIsolation": true
}
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "MainAbility_desc",
"value": "i am an entry for phone"
},
{
"name": "MainAbility_label",
"value": "the phone entry ability"
},
{
"name": "entry_desc",
"value": "ActsContextTest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,17 @@
{
"app": {
"apiReleaseType": "Canary1",
"bundleName": "com.example.otaupdatetest",
"debug": true,
"icon": "$media:app_icon",
"iconId": 16777217,
"label": "$string:app_name",
"labelId": 16777216,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0.0",
"asanEnabled": true
}
}

View File

@ -0,0 +1,8 @@
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}

View File

@ -0,0 +1,61 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("../../../../../appexecfwk.gni")
ohos_hap("otaUpdateTestAplUp") {
hap_profile = "entry/src/main/module.json"
hap_name = "otaUpdateTestAplUp"
subsystem_name = "bundlemanager"
final_hap_path = "$root_out_dir/tests/unittest/bundle_framework/bundlemgrservice/resource/test_bundle/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
shared_libraries = [
":otaUpdateTestAplUpSo1",
":otaUpdateTestAplUpSo2",
]
certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.otaupdatetestaplup.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("hjs_demo_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ohos_shared_library("otaUpdateTestAplUpSo1") {
sources = [ "entry/src/main/cpp/hapso15.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_shared_library("otaUpdateTestAplUpSo2") {
sources = [ "entry/src/main/cpp/hapso16.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo15() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo16() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
@State message: string = 'Default App Test'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,134 @@
{
"module": {
"abilities": [
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "MainAbility",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
},
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "SecondAbility",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
},
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "ThirdAbility",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
}
],
"deliveryWithInstall": true,
"description": "$string:entry_desc",
"descriptionId": 16777220,
"deviceTypes": [
"2in1",
"default",
"phone",
"tablet"
],
"extensionAbilities": [
{
"name": "extensionAbility_A",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "",
"type": "backup"
},
{
"name": "extensionAbility_B",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "",
"type": "backup"
},
{
"name": "extensionAbility_C",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "",
"type": "backup"
}
],
"installationFree": false,
"mainElement": "MainAbility",
"name": "entry",
"pages": "$profile:main_pages",
"srcEntry": "./ets/Application/AbilityStage.ts",
"type": "entry",
"virtualMachine": "ark",
"compressNativeLibs": false,
"libIsolation": false
}
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "MainAbility_desc",
"value": "i am an entry for phone"
},
{
"name": "MainAbility_label",
"value": "the phone entry ability"
},
{
"name": "entry_desc",
"value": "ActsContextTest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,61 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("../../../../../../appexecfwk.gni")
ohos_hap("otaUpdateTestAplUpFeature1") {
hap_profile = "src/main/module.json"
hap_name = "otaUpdateTestAplUpFeature1"
subsystem_name = "bundlemanager"
final_hap_path = "$root_out_dir/tests/systemtest/bundle_framework/bundlemgrsst/resource/testHapSo/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
shared_libraries = [
":otaUpdateTestAplUpFt1So1",
":otaUpdateTestAplUpFt1So2",
]
certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.otaUpdateTestAplUp.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "../AppScope/app.json"
sources = [ "../AppScope/resources" ]
}
ohos_resources("hjs_demo_resources") {
sources = [ "src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "src/main/module.json"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "src/main/ets"
}
ohos_shared_library("otaUpdateTestAplUpFt1So1") {
sources = [ "src/main/cpp/hapso23.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_shared_library("otaUpdateTestAplUpFt1So2") {
sources = [ "src/main/cpp/hapso24.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo23() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo24() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
@State message: string = 'Default App Test'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,45 @@
{
"module": {
"abilities": [
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "MainAbility",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
}
],
"deliveryWithInstall": true,
"description": "$string:entry_desc",
"descriptionId": 16777220,
"deviceTypes": [
"2in1",
"default",
"phone",
"tablet"
],
"installationFree": false,
"mainElement": "MainAbility",
"name": "feature1",
"pages": "$profile:main_pages",
"srcEntry": "./ets/Application/AbilityStage.ts",
"type": "feature",
"virtualMachine": "ark",
"compressNativeLibs": true,
"libIsolation": false
}
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "MainAbility_desc",
"value": "i am an entry for phone"
},
{
"name": "MainAbility_label",
"value": "the phone entry ability"
},
{
"name": "entry_desc",
"value": "ActsContextTest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,61 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("../../../../../../appexecfwk.gni")
ohos_hap("otaUpdateTestAplUpFeature2") {
hap_profile = "src/main/module.json"
hap_name = "otaUpdateTestAplUpFeature2"
subsystem_name = "bundlemanager"
final_hap_path = "$root_out_dir/tests/systemtest/bundle_framework/bundlemgrsst/resource/testHapSo/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
shared_libraries = [
":otaUpdateTestAplUpFt2So1",
":otaUpdateTestAplUpFt2So2",
]
certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.otaUpdateTestAplUp.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "../AppScope/app.json"
sources = [ "../AppScope/resources" ]
}
ohos_resources("hjs_demo_resources") {
sources = [ "src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "src/main/module.json"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "src/main/ets"
}
ohos_shared_library("otaUpdateTestAplUpFt2So1") {
sources = [ "src/main/cpp/hapso33.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_shared_library("otaUpdateTestAplUpFt2So2") {
sources = [ "src/main/cpp/hapso34.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo33() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo34() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
@State message: string = 'Default App Test'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,45 @@
{
"module": {
"abilities": [
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "MainAbility",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
}
],
"deliveryWithInstall": true,
"description": "$string:entry_desc",
"descriptionId": 16777220,
"deviceTypes": [
"2in1",
"default",
"phone",
"tablet"
],
"installationFree": false,
"mainElement": "MainAbility",
"name": "feature2",
"pages": "$profile:main_pages",
"srcEntry": "./ets/Application/AbilityStage.ts",
"type": "feature",
"virtualMachine": "ark",
"compressNativeLibs": false,
"libIsolation": true
}
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "MainAbility_desc",
"value": "i am an entry for phone"
},
{
"name": "MainAbility_label",
"value": "the phone entry ability"
},
{
"name": "entry_desc",
"value": "ActsContextTest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,17 @@
{
"app": {
"apiReleaseType": "Canary1",
"bundleName": "com.example.otaupdatetest",
"debug": true,
"icon": "$media:app_icon",
"iconId": 16777217,
"label": "$string:app_name",
"labelId": 16777216,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"vendor": "example",
"versionCode": 2000000,
"versionName": "2.0.0.0",
"asanEnabled": false
}
}

View File

@ -0,0 +1,8 @@
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}

View File

@ -0,0 +1,44 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("../../../../../appexecfwk.gni")
ohos_hap("otaUpdateTestAppField") {
hap_profile = "entry/src/main/module.json"
hap_name = "otaUpdateTestAppField"
subsystem_name = "bundlemanager"
final_hap_path = "$root_out_dir/tests/unittest/bundle_framework/bundlemgrservice/resource/test_bundle/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
shared_libraries = []
certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.otaupdatetest.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("hjs_demo_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "entry/src/main/module.json"
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo15() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo16() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
@State message: string = 'Default App Test'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,134 @@
{
"module": {
"abilities": [
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "MainAbility",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
},
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "SecondAbility",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
},
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "ThirdAbility",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
}
],
"deliveryWithInstall": true,
"description": "$string:entry_desc",
"descriptionId": 16777220,
"deviceTypes": [
"2in1",
"default",
"phone",
"tablet"
],
"extensionAbilities": [
{
"name": "extensionAbility_A",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "",
"type": "backup"
},
{
"name": "extensionAbility_B",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "",
"type": "backup"
},
{
"name": "extensionAbility_C",
"skills": [
{
"actions": [
"action.hello"
],
"entities": [
"entity.hello"
]
}
],
"srcEntry": "",
"type": "backup"
}
],
"installationFree": false,
"mainElement": "MainAbility",
"name": "entry",
"pages": "$profile:main_pages",
"srcEntry": "./ets/Application/AbilityStage.ts",
"type": "entry",
"virtualMachine": "ark",
"compressNativeLibs": false,
"libIsolation": false
}
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "MainAbility_desc",
"value": "i am an entry for phone"
},
{
"name": "MainAbility_label",
"value": "the phone entry ability"
},
{
"name": "entry_desc",
"value": "ActsContextTest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,61 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("../../../../../../appexecfwk.gni")
ohos_hap("otaUpdateTestAppFieldFeature1") {
hap_profile = "src/main/module.json"
hap_name = "otaUpdateTestAppFieldFeature1"
subsystem_name = "bundlemanager"
final_hap_path = "$root_out_dir/tests/systemtest/bundle_framework/bundlemgrsst/resource/testHapSo/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
shared_libraries = [
":otaUpdateTestAppFieldFt1So1",
":otaUpdateTestAppFieldFt1So2",
]
certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.hapversfield.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "../AppScope/app.json"
sources = [ "../AppScope/resources" ]
}
ohos_resources("hjs_demo_resources") {
sources = [ "src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "src/main/module.json"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "src/main/ets"
}
ohos_shared_library("otaUpdateTestAppFieldFt1So1") {
sources = [ "src/main/cpp/hapso23.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_shared_library("otaUpdateTestAppFieldFt1So2") {
sources = [ "src/main/cpp/hapso24.cpp" ]
visibility = [ ":*" ]
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo23() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace OHOS {
namespace AppExecFwk {
void HapSo24() {}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
@State message: string = 'Default App Test'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,45 @@
{
"module": {
"abilities": [
{
"description": "$string:MainAbility_desc",
"descriptionId": 16777218,
"icon": "$media:icon",
"iconId": 16777221,
"label": "$string:MainAbility_label",
"labelId": 16777219,
"name": "MainAbility",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
],
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"exported": true
}
],
"deliveryWithInstall": true,
"description": "$string:entry_desc",
"descriptionId": 16777220,
"deviceTypes": [
"2in1",
"default",
"phone",
"tablet"
],
"installationFree": false,
"mainElement": "MainAbility",
"name": "feature1",
"pages": "$profile:main_pages",
"srcEntry": "./ets/Application/AbilityStage.ts",
"type": "feature",
"virtualMachine": "ark",
"compressNativeLibs": true,
"libIsolation": false
}
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "MainAbility_desc",
"value": "i am an entry for phone"
},
{
"name": "MainAbility_label",
"value": "the phone entry ability"
},
{
"name": "entry_desc",
"value": "ActsContextTest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Some files were not shown because too many files have changed in this diff Show More