mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-20 23:55:24 -04:00
IssueNo:#I4JV8A
Description:add insert pre app info list Sig:appexecfwk Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wangdengjia <wangdengjia@huawei.com> Change-Id: I1df32ba33961c4a63f081f3ac927a51fccc99660 Signed-off-by: wangdengjia <wangdengjia@huawei.com>
This commit is contained in:
@@ -55,6 +55,12 @@ public:
|
||||
|
||||
uint8_t GetBundleInfosNoReplication(const int flags, BundleInfo **bundleInfos, int32_t *len) const;
|
||||
|
||||
PreAppList *InitPreAppInfo(void) const;
|
||||
|
||||
void InsertPreAppInfo(const char *filePath, PreAppList *list) const;
|
||||
|
||||
void SetPreAppInfo(PreAppList *list) const;
|
||||
|
||||
private:
|
||||
BundleMsClient() = default;
|
||||
|
||||
|
||||
@@ -43,4 +43,19 @@ uint8_t GetBundleInfosNoReplication(const int flags, BundleInfo **bundleInfos, i
|
||||
{
|
||||
return OHOS::BundleMsClient::GetInstance().GetBundleInfosNoReplication(flags, bundleInfos, len);
|
||||
}
|
||||
|
||||
PreAppList *InitPreAppInfo(void)
|
||||
{
|
||||
return OHOS::BundleMsClient::GetInstance().InitPreAppInfo();
|
||||
}
|
||||
|
||||
void InsertPreAppInfo(const char *filePath, PreAppList *list)
|
||||
{
|
||||
OHOS::BundleMsClient::GetInstance().InsertPreAppInfo(filePath, list);
|
||||
}
|
||||
|
||||
void SetPreAppInfo(PreAppList *list)
|
||||
{
|
||||
OHOS::BundleMsClient::GetInstance().SetPreAppInfo(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,4 +204,28 @@ uint8_t BundleMsClient::GetBundleInfosNoReplication (const int flags, BundleInfo
|
||||
}
|
||||
return bmsProxy_->GetBundleInfosNoReplication(flags, bundleInfos, len);
|
||||
}
|
||||
|
||||
PreAppList *BundleMsClient::InitPreAppInfo () const
|
||||
{
|
||||
if (!Initialize()) {
|
||||
return nullptr;
|
||||
}
|
||||
return bmsProxy_->InitPreAppInfo();
|
||||
}
|
||||
|
||||
void BundleMsClient::InsertPreAppInfo (const char *filePath, PreAppList *list) const
|
||||
{
|
||||
if (!Initialize()) {
|
||||
return;
|
||||
}
|
||||
bmsProxy_->InsertPreAppInfo(filePath, list);
|
||||
}
|
||||
|
||||
void BundleMsClient::SetPreAppInfo(PreAppList *list) const
|
||||
{
|
||||
if (!Initialize()) {
|
||||
return;
|
||||
}
|
||||
bmsProxy_->SetPreAppInfo(list);
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -54,6 +54,9 @@ struct BmsSliteInterface {
|
||||
bool (*RegisterInstallerCallback)(InstallerCallback installerCallback);
|
||||
void (*UpdateBundleInfoList)();
|
||||
uint8_t (*GetBundleInfosNoReplication)(const int flags, BundleInfo **bundleInfos, int32_t *len);
|
||||
PreAppList *(*InitPreAppInfo)(void);
|
||||
void (*InsertPreAppInfo)(const char *filePath, PreAppList *list);
|
||||
void (*SetPreAppInfo)(PreAppList *list);
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "bundle_manager.h"
|
||||
#include "los_list.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -26,6 +27,7 @@ extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define MAX_APP_FILE_PATH_LEN 100
|
||||
typedef enum {
|
||||
BUNDLE_INSTALL_DOING = 0,
|
||||
BUNDLE_INSTALL_OK = 1,
|
||||
@@ -44,6 +46,11 @@ typedef struct {
|
||||
uint8_t installProcess;
|
||||
} BundleInstallMsg;
|
||||
|
||||
typedef struct {
|
||||
LOS_DL_LIST appDoubleList;
|
||||
char filePath[MAX_APP_FILE_PATH_LEN];
|
||||
} PreAppList;
|
||||
|
||||
/**
|
||||
* @brief Get the install state and install process of the bundle.
|
||||
*
|
||||
@@ -95,6 +102,31 @@ void UpdateBundleInfoList(void);
|
||||
*/
|
||||
uint8_t GetBundleInfosNoReplication(const int flags, BundleInfo **bundleInfos, int32_t *len);
|
||||
|
||||
/**
|
||||
* @brief Initializing preset application information.
|
||||
*
|
||||
* @return Returns an empty PreAppList.
|
||||
*
|
||||
*/
|
||||
PreAppList *InitPreAppInfo(void);
|
||||
|
||||
/**
|
||||
* @brief Insert preset application information to the list.
|
||||
*
|
||||
* @param filePath Indicates the file path of the preconfigured application.
|
||||
* @param list Indicates the inserted list.
|
||||
*
|
||||
*/
|
||||
void InsertPreAppInfo(const char *filePath, PreAppList *list);
|
||||
|
||||
/**
|
||||
* @brief Setting the preset application list.
|
||||
*
|
||||
* @param list Indicates the preset application list.
|
||||
*
|
||||
*/
|
||||
void SetPreAppInfo(PreAppList *list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ public:
|
||||
static bool RegisterInstallerCallback(InstallerCallback installerCallback);
|
||||
static void UpdateBundleInfoList();
|
||||
static uint8_t GetBundleInfosNoReplication(const int flags, BundleInfo **bundleInfos, int32_t *len);
|
||||
static PreAppList *InitPreAppInfo();
|
||||
static void InsertPreAppInfo(const char *filePath, PreAppList *list);
|
||||
static void SetPreAppInfo(PreAppList *list);
|
||||
|
||||
static BundleMgrSliteFeature *GetInstance()
|
||||
{
|
||||
|
||||
@@ -26,11 +26,9 @@
|
||||
#include "install_param.h"
|
||||
#include "bundle_install_msg.h"
|
||||
#include "bundle_manager.h"
|
||||
#include "los_list.h"
|
||||
#include "ohos_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
#define MAX_APP_FILE_PATH_LEN 100
|
||||
struct ToBeInstalledApp {
|
||||
bool isSystemApp;
|
||||
bool isUpdated;
|
||||
@@ -38,10 +36,6 @@ struct ToBeInstalledApp {
|
||||
char *installedPath;
|
||||
char *appId;
|
||||
};
|
||||
struct AppInfoList {
|
||||
LOS_DL_LIST appDoubleList;
|
||||
char filePath[MAX_APP_FILE_PATH_LEN];
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
BUNDLE_INSTALL,
|
||||
@@ -81,6 +75,9 @@ public:
|
||||
bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess);
|
||||
uint32_t GetBundleSize(const char *bundleName);
|
||||
bool RegisterInstallerCallback(InstallerCallback installerCallback);
|
||||
PreAppList *InitPreAppInfo(void);
|
||||
void InsertPreAppInfo(const char *filePath, PreAppList *list);
|
||||
void SetPreAppInfo(PreAppList *list);
|
||||
|
||||
private:
|
||||
GtManagerService();
|
||||
@@ -100,11 +97,9 @@ private:
|
||||
void TransformJsToBcWhenRestart(const char *codePath, const char *bundleName);
|
||||
void TransformJsToBc(const char *codePath, const char *bundleJsonPath, cJSON *installRecordObj);
|
||||
bool IsSystemBundleInstalledPath(const char *appPath, const List<ToBeInstalledApp *> *systemPathList);
|
||||
AppInfoList *APP_InitAllAppInfo(void);
|
||||
void APP_QueryAppInfo(const char *appDir, AppInfoList *list);
|
||||
void APP_InsertAppInfo(char *filePath, AppInfoList *list);
|
||||
void APP_FreeAllAppInfo(const AppInfoList *list);
|
||||
void InstallPreBundle(List<ToBeInstalledApp *> systemPathList, InstallerCallback installerCallback);
|
||||
void QueryPreAppInfo(const char *appDir, PreAppList *list);
|
||||
void FreePreAppInfo(const PreAppList *list);
|
||||
|
||||
GtBundleInstaller *installer_;
|
||||
BundleMap *bundleMap_;
|
||||
@@ -113,6 +108,7 @@ private:
|
||||
char *jsEngineVer_;
|
||||
uint32_t installedThirdBundleNum_;
|
||||
List<ToBeInstalledApp *> systemPathList_;
|
||||
PreAppList *preAppList_;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ BundleMgrSliteFeatureImpl g_bmsSliteImpl = {
|
||||
.RegisterInstallerCallback = BundleMgrSliteFeature::RegisterInstallerCallback,
|
||||
.UpdateBundleInfoList = BundleMgrSliteFeature::UpdateBundleInfoList,
|
||||
.GetBundleInfosNoReplication = BundleMgrSliteFeature::GetBundleInfosNoReplication,
|
||||
.InitPreAppInfo = BundleMgrSliteFeature::InitPreAppInfo,
|
||||
.InsertPreAppInfo = BundleMgrSliteFeature::InsertPreAppInfo,
|
||||
.SetPreAppInfo = BundleMgrSliteFeature::SetPreAppInfo,
|
||||
DEFAULT_IUNKNOWN_ENTRY_END
|
||||
};
|
||||
|
||||
@@ -150,4 +153,19 @@ uint8_t BundleMgrSliteFeature::GetBundleInfosNoReplication(const int flags, Bund
|
||||
{
|
||||
return OHOS::GtManagerService::GetInstance().GetBundleInfosNoReplication(flags, bundleInfos, len);
|
||||
}
|
||||
|
||||
PreAppList *BundleMgrSliteFeature::InitPreAppInfo()
|
||||
{
|
||||
return OHOS::GtManagerService::GetInstance().InitPreAppInfo();
|
||||
}
|
||||
|
||||
void BundleMgrSliteFeature::InsertPreAppInfo(const char *filePath, PreAppList *list)
|
||||
{
|
||||
OHOS::GtManagerService::GetInstance().InsertPreAppInfo(filePath, list);
|
||||
}
|
||||
|
||||
void BundleMgrSliteFeature::SetPreAppInfo(PreAppList *list)
|
||||
{
|
||||
OHOS::GtManagerService::GetInstance().SetPreAppInfo(list);
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -50,6 +50,7 @@ GtManagerService::GtManagerService()
|
||||
bundleInstallMsg_ = nullptr;
|
||||
jsEngineVer_ = nullptr;
|
||||
installedThirdBundleNum_ = 0;
|
||||
preAppList_ = nullptr;
|
||||
}
|
||||
|
||||
GtManagerService::~GtManagerService()
|
||||
@@ -267,6 +268,21 @@ bool GtManagerService::RegisterInstallerCallback(InstallerCallback installerCall
|
||||
|
||||
void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList, InstallerCallback installerCallback)
|
||||
{
|
||||
// get third system bundle uninstall record
|
||||
cJSON *uninstallRecord = BundleUtil::GetJsonStream(UNINSTALL_THIRD_SYSTEM_BUNDLE_JSON);
|
||||
if (uninstallRecord == nullptr) {
|
||||
(void) unlink(UNINSTALL_THIRD_SYSTEM_BUNDLE_JSON);
|
||||
}
|
||||
|
||||
// scan system apps and third system apps
|
||||
ScanSystemApp(uninstallRecord, &systemPathList_);
|
||||
if (uninstallRecord != nullptr) {
|
||||
cJSON_Delete(uninstallRecord);
|
||||
}
|
||||
|
||||
// scan third apps
|
||||
ScanThirdApp(INSTALL_PATH, &systemPathList_);
|
||||
|
||||
if (!BundleUtil::IsDir(JSON_PATH_NO_SLASH_END)) {
|
||||
BundleUtil::MkDirs(JSON_PATH_NO_SLASH_END);
|
||||
InstallAllSystemBundle(installerCallback);
|
||||
@@ -275,14 +291,15 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
|
||||
}
|
||||
for (auto node = systemPathList.Begin(); node != systemPathList.End(); node = node->next_) {
|
||||
ToBeInstalledApp *toBeInstalledApp = node->value_;
|
||||
if (!BundleUtil::IsFile(toBeInstalledApp->path) ||
|
||||
!BundleUtil::EndWith(toBeInstalledApp->path, INSTALL_FILE_SUFFIX)) {
|
||||
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] Pre install file path is invalid");
|
||||
continue;
|
||||
}
|
||||
if (toBeInstalledApp->isUpdated) {
|
||||
(void) ReloadBundleInfo(toBeInstalledApp->installedPath, toBeInstalledApp->appId,
|
||||
toBeInstalledApp->isSystemApp);
|
||||
}
|
||||
if (!BundleUtil::IsFile(toBeInstalledApp->path) ||
|
||||
!BundleUtil::EndWith(toBeInstalledApp->path, INSTALL_FILE_SUFFIX)) {
|
||||
return;
|
||||
}
|
||||
(void) Install(toBeInstalledApp->path, nullptr, installerCallback);
|
||||
}
|
||||
RemoveSystemAppPathList(&systemPathList);
|
||||
@@ -290,27 +307,28 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
|
||||
|
||||
void GtManagerService::InstallAllSystemBundle(InstallerCallback installerCallback)
|
||||
{
|
||||
AppInfoList *list = GtManagerService::APP_InitAllAppInfo();
|
||||
PreAppList *list = preAppList_;
|
||||
if (list == nullptr) {
|
||||
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] InstallAllSystemBundle InitAllAppInfo fail, list is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
AppInfoList *currentNode = nullptr;
|
||||
AppInfoList *nextNode = nullptr;
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, AppInfoList, appDoubleList) {
|
||||
if ((strcmp(((AppInfoList *)currentNode)->filePath, ".") == 0) ||
|
||||
(strcmp(((AppInfoList *)currentNode)->filePath, "..") == 0)) {
|
||||
PreAppList *currentNode = nullptr;
|
||||
PreAppList *nextNode = nullptr;
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, PreAppList, appDoubleList) {
|
||||
if ((strcmp(((PreAppList *)currentNode)->filePath, ".") == 0) ||
|
||||
(strcmp(((PreAppList *)currentNode)->filePath, "..") == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!BundleUtil::IsFile(((AppInfoList *)currentNode)->filePath) ||
|
||||
!BundleUtil::EndWith(((AppInfoList *)currentNode)->filePath, INSTALL_FILE_SUFFIX)) {
|
||||
if (!BundleUtil::IsFile(((PreAppList *)currentNode)->filePath) ||
|
||||
!BundleUtil::EndWith(((PreAppList *)currentNode)->filePath, INSTALL_FILE_SUFFIX)) {
|
||||
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] Install all system bundle file path is invalid");
|
||||
return;
|
||||
}
|
||||
(void) Install(((AppInfoList *)currentNode)->filePath, nullptr, installerCallback);
|
||||
(void) Install(((PreAppList *)currentNode)->filePath, nullptr, installerCallback);
|
||||
}
|
||||
GtManagerService::APP_FreeAllAppInfo(list);
|
||||
GtManagerService::FreePreAppInfo(list);
|
||||
}
|
||||
|
||||
void GtManagerService::ClearSystemBundleInstallMsg()
|
||||
@@ -351,21 +369,6 @@ void GtManagerService::ScanPackages()
|
||||
if (jsEngineVer_ == nullptr) {
|
||||
HILOG_WARN(HILOG_MODULE_AAFWK, "[BMS] get jsEngine version fail when restart!");
|
||||
}
|
||||
|
||||
// get third system bundle uninstall record
|
||||
cJSON *uninstallRecord = BundleUtil::GetJsonStream(UNINSTALL_THIRD_SYSTEM_BUNDLE_JSON);
|
||||
if (uninstallRecord == nullptr) {
|
||||
(void) unlink(UNINSTALL_THIRD_SYSTEM_BUNDLE_JSON);
|
||||
}
|
||||
|
||||
// scan system apps and third system apps
|
||||
ScanSystemApp(uninstallRecord, &systemPathList_);
|
||||
if (uninstallRecord != nullptr) {
|
||||
cJSON_Delete(uninstallRecord);
|
||||
}
|
||||
|
||||
// scan third apps
|
||||
ScanThirdApp(INSTALL_PATH, &systemPathList_);
|
||||
}
|
||||
|
||||
void GtManagerService::RemoveSystemAppPathList(List<ToBeInstalledApp *> *systemPathList)
|
||||
@@ -385,7 +388,7 @@ void GtManagerService::RemoveSystemAppPathList(List<ToBeInstalledApp *> *systemP
|
||||
|
||||
void GtManagerService::ScanSystemApp(const cJSON *uninstallRecord, List<ToBeInstalledApp *> *systemPathList)
|
||||
{
|
||||
AppInfoList *list = GtManagerService::APP_InitAllAppInfo();
|
||||
PreAppList *list = preAppList_;
|
||||
if (list == nullptr) {
|
||||
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] ScanSystemApp InitAllAppInfo fail, list is nullptr");
|
||||
return;
|
||||
@@ -394,25 +397,25 @@ void GtManagerService::ScanSystemApp(const cJSON *uninstallRecord, List<ToBeInst
|
||||
uint8_t scanFlag = 0;
|
||||
char *bundleName = nullptr;
|
||||
int32_t versionCode = -1;
|
||||
AppInfoList *currentNode = nullptr;
|
||||
AppInfoList *nextNode = nullptr;
|
||||
PreAppList *currentNode = nullptr;
|
||||
PreAppList *nextNode = nullptr;
|
||||
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, AppInfoList, appDoubleList) {
|
||||
if ((strcmp(((AppInfoList *)currentNode)->filePath, ".") == 0) ||
|
||||
(strcmp(((AppInfoList *)currentNode)->filePath, "..") == 0)) {
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, PreAppList, appDoubleList) {
|
||||
if ((strcmp(((PreAppList *)currentNode)->filePath, ".") == 0) ||
|
||||
(strcmp(((PreAppList *)currentNode)->filePath, "..") == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (BundleUtil::StartWith(((AppInfoList *)currentNode)->filePath, SYSTEM_BUNDLE_PATH)) {
|
||||
if (BundleUtil::StartWith(((PreAppList *)currentNode)->filePath, SYSTEM_BUNDLE_PATH)) {
|
||||
scanFlag = SYSTEM_APP_FLAG;
|
||||
} else if (BundleUtil::StartWith(((AppInfoList *)currentNode)->filePath, THIRD_SYSTEM_BUNDLE_PATH)) {
|
||||
} else if (BundleUtil::StartWith(((PreAppList *)currentNode)->filePath, THIRD_SYSTEM_BUNDLE_PATH)) {
|
||||
scanFlag = THIRD_SYSTEM_APP_FLAG;
|
||||
} else {
|
||||
continue; // skip third app
|
||||
}
|
||||
|
||||
// scan system app
|
||||
bool res = CheckSystemBundleIsValid(((AppInfoList *)currentNode)->filePath, &bundleName, versionCode);
|
||||
bool res = CheckSystemBundleIsValid(((PreAppList *)currentNode)->filePath, &bundleName, versionCode);
|
||||
if (!res) {
|
||||
APP_ERRCODE_EXTRA(EXCE_ACE_APP_SCAN, EXCE_ACE_APP_SCAN_INVALID_SYSTEM_APP);
|
||||
AdapterFree(bundleName);
|
||||
@@ -426,11 +429,11 @@ void GtManagerService::ScanSystemApp(const cJSON *uninstallRecord, List<ToBeInst
|
||||
continue;
|
||||
}
|
||||
|
||||
ReloadEntireBundleInfo(((AppInfoList *)currentNode)->filePath, bundleName,
|
||||
ReloadEntireBundleInfo(((PreAppList *)currentNode)->filePath, bundleName,
|
||||
systemPathList, versionCode, scanFlag);
|
||||
AdapterFree(bundleName);
|
||||
}
|
||||
GtManagerService::APP_FreeAllAppInfo(list);
|
||||
GtManagerService::FreePreAppInfo(list);
|
||||
}
|
||||
|
||||
void GtManagerService::ScanThirdApp(const char *appDir, const List<ToBeInstalledApp *> *systemPathList)
|
||||
@@ -929,26 +932,23 @@ int32_t GtManagerService::ReportUninstallCallback(uint8_t errCode, uint8_t insta
|
||||
return 0;
|
||||
}
|
||||
|
||||
AppInfoList *GtManagerService::APP_InitAllAppInfo()
|
||||
PreAppList *GtManagerService::InitPreAppInfo()
|
||||
{
|
||||
AppInfoList *list = (AppInfoList *)AdapterMalloc(sizeof(AppInfoList));
|
||||
PreAppList *list = (PreAppList *)AdapterMalloc(sizeof(PreAppList));
|
||||
if (list == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (memset_s(list, sizeof(AppInfoList), 0, sizeof(AppInfoList)) != EOK) {
|
||||
if (memset_s(list, sizeof(PreAppList), 0, sizeof(PreAppList)) != EOK) {
|
||||
AdapterFree(list);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LOS_ListInit(&list->appDoubleList);
|
||||
|
||||
APP_QueryAppInfo(SYSTEM_BUNDLE_PATH, list);
|
||||
APP_QueryAppInfo(THIRD_SYSTEM_BUNDLE_PATH, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
void GtManagerService::APP_QueryAppInfo(const char *appDir, AppInfoList *list)
|
||||
void GtManagerService::QueryPreAppInfo(const char *appDir, PreAppList *list)
|
||||
{
|
||||
struct dirent *ent = nullptr;
|
||||
if (appDir == nullptr) {
|
||||
@@ -989,24 +989,24 @@ void GtManagerService::APP_QueryAppInfo(const char *appDir, AppInfoList *list)
|
||||
continue;
|
||||
}
|
||||
|
||||
APP_InsertAppInfo(appPath, (AppInfoList *)&list->appDoubleList);
|
||||
InsertPreAppInfo(appPath, (PreAppList *)&list->appDoubleList);
|
||||
AdapterFree(appPath);
|
||||
}
|
||||
AdapterFree(fileName);
|
||||
}
|
||||
|
||||
void GtManagerService::APP_InsertAppInfo(char *filePath, AppInfoList *list)
|
||||
void GtManagerService::InsertPreAppInfo(const char *filePath, PreAppList *list)
|
||||
{
|
||||
if ((filePath == nullptr) || (list == nullptr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AppInfoList *app = (AppInfoList *)AdapterMalloc(sizeof(AppInfoList));
|
||||
PreAppList *app = (PreAppList *)AdapterMalloc(sizeof(PreAppList));
|
||||
if (app == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (memset_s(app, sizeof(AppInfoList), 0, sizeof(AppInfoList)) != 0) {
|
||||
if (memset_s(app, sizeof(PreAppList), 0, sizeof(PreAppList)) != 0) {
|
||||
AdapterFree(app);
|
||||
return;
|
||||
}
|
||||
@@ -1020,15 +1020,24 @@ void GtManagerService::APP_InsertAppInfo(char *filePath, AppInfoList *list)
|
||||
return;
|
||||
}
|
||||
|
||||
void GtManagerService::APP_FreeAllAppInfo(const AppInfoList *list)
|
||||
void GtManagerService::SetPreAppInfo(PreAppList *list)
|
||||
{
|
||||
if (list == nullptr) {
|
||||
return;
|
||||
}
|
||||
preAppList_ = list;
|
||||
return;
|
||||
}
|
||||
|
||||
void GtManagerService::FreePreAppInfo(const PreAppList *list)
|
||||
{
|
||||
if (list == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
AppInfoList *currentNode = nullptr;
|
||||
AppInfoList *nextNode = nullptr;
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, AppInfoList, appDoubleList) {
|
||||
PreAppList *currentNode = nullptr;
|
||||
PreAppList *nextNode = nullptr;
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, PreAppList, appDoubleList) {
|
||||
if (currentNode != nullptr) {
|
||||
LOS_ListDelete(&(currentNode->appDoubleList));
|
||||
AdapterFree(currentNode);
|
||||
|
||||
Reference in New Issue
Block a user