2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file InstallerUtil.cpp
19 * @brief This is the implementation file for %InstallerUtil class.
26 #include <unique_ptr.h>
28 #include <FBaseErrorDefine.h>
30 #include <FIoDirectory.h>
31 #include <FAppPkgPackageAppInfo.h>
32 #include <FAppPkgPackageInfo.h>
33 #include <FBase_StringConverter.h>
34 #include <FSecCryptoSha2Hash.h>
36 #include <FAppPkg_PackageManagerImpl.h>
37 #include <FAppPkg_PackageInfoImpl.h>
38 #include <FAppPkg_PackageAppInfoImpl.h>
40 #include "InstallerDefs.h"
41 #include "InstallerUtil.h"
42 #include "InstallerManager.h"
43 #include "SmackManager.h"
45 using namespace Tizen::Base;
46 using namespace Tizen::Base::Collection;
47 using namespace Tizen::Base::Utility;
48 using namespace Tizen::App;
49 using namespace Tizen::App::Package;
50 using namespace Tizen::Io;
51 using namespace Tizen::Security::Crypto;
53 InstallerUtil::InstallerUtil(void)
57 InstallerUtil::~InstallerUtil(void)
62 InstallerUtil::Remove(const Tizen::Base::String& filePath)
68 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
69 TryReturn(pFilePath, false, "pFilePath is null");
71 err = lstat(pFilePath.get(), &fileinfo);
74 AppLog("Remove(): [%s] - %s[errno(%d)]: skip", pFilePath.get(), strerror(errno), errno);
78 if (S_ISLNK(fileinfo.st_mode))
80 AppLog("Remove(): symlink=[%s]", pFilePath.get());
81 err = unlink(pFilePath.get());
82 TryReturn(err >= 0, false, "unlink() failed(%s), file=[%s]", strerror(errno), pFilePath.get());
84 else if (S_ISDIR(fileinfo.st_mode))
86 AppLog("Remove(): directory=[%ls]", filePath.GetPointer());
87 r = Directory::Remove(filePath, true);
88 TryReturn(!IsFailed(r), false, "Directory::Remove() failed, filePath=%ls", filePath.GetPointer());
92 AppLog("Remove(): file=[%ls]", filePath.GetPointer());
93 r = File::Remove(filePath);
94 TryReturn(!IsFailed(r), false, "File::Remove() failed, filePath=%ls", filePath.GetPointer());
101 InstallerUtil::Copy(const String& srcFilePath, const String& destFilePath)
105 result r = E_SUCCESS;
107 // AppLog("+ Copy(): src=[%ls], dest=[%ls]", srcFilePath.GetPointer(), destFilePath.GetPointer());
112 std::unique_ptr<char[]> pBuf(new (std::nothrow) char[bufSize]);
113 TryReturn(pBuf, false, "pBuf is null");
115 r = srcFile.Construct(srcFilePath, L"r");
116 TryReturn(!IsFailed(r), false, "srcFile.Construct is failed");
118 r = destFile.Construct(destFilePath, L"w");
119 TryReturn(!IsFailed(r), false, "destFile.Construct is failed");
123 readBytes = srcFile.Read(pBuf.get(), bufSize);
126 r = destFile.Write(pBuf.get(), readBytes);
127 TryReturn(!IsFailed(r), false, "destFile.Write is failed");
130 while (readBytes > 0);
136 InstallerUtil::CopyDirectory(const String& srcFilePath, const String& destFilePath)
138 result r = E_SUCCESS;
141 res = File::IsFileExist(srcFilePath);
144 AppLog("CopyDirectory(): src=[%ls]: skip", srcFilePath.GetPointer());
148 std::unique_ptr<Directory> pDir(new (std::nothrow) Directory);
149 TryReturn(pDir, false, "pDir is null.");
151 r = pDir->Construct(srcFilePath);
152 TryReturn(!IsFailed(r), false, "pDir->Construct() failed, srcFilePath=[%ls].", srcFilePath.GetPointer());
154 std::unique_ptr<DirEnumerator> pDirEnum(pDir->ReadN());
155 TryReturn(pDirEnum, false, "pDirEnum is null.");
157 while (pDirEnum->MoveNext() == E_SUCCESS)
159 DirEntry entry = pDirEnum->GetCurrentDirEntry();
161 String entryName = entry.GetName();
162 String srcEntryDir = srcFilePath;
164 srcEntryDir += entryName;
166 if (entryName == L"." || entryName == L"..")
171 // if file or directory is symbolic link, skip this.
172 if (InstallerUtil::IsSymlink(srcEntryDir) == true)
177 String destEntryDir = destFilePath;
178 destEntryDir += L"/";
179 destEntryDir += entryName;
181 if (entry.IsDirectory() == false)
184 Directory::Create(destFilePath, true);
185 InstallerUtil::Copy(srcEntryDir, destEntryDir);
189 Directory::Create(destEntryDir, true);
190 CopyDirectory(srcEntryDir, destEntryDir);
194 AppLog("CopyDirectory(): src=[%ls], dest=[%ls]", srcFilePath.GetPointer(), destFilePath.GetPointer());
199 InstallerUtil::IsSymlink(const Tizen::Base::String& filePath)
202 struct stat fileinfo;
204 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
205 TryReturn(pFilePath, false, "pFilePath is null");
207 err = lstat(pFilePath.get(), &fileinfo);
208 TryReturn(err >= 0, false, "lstat() failed(%s), file=[%s]", strerror(errno), pFilePath.get());
210 if (S_ISLNK(fileinfo.st_mode))
219 InstallerUtil::GetRealPath(const String& filePath, String& realPath)
221 char* pRealPath = null;
223 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
224 TryReturn(pFilePath, false, "pFilePath is null");
226 char tmpPath[PATH_MAX] = {0};
227 pRealPath = realpath(pFilePath.get(), tmpPath);
228 TryReturn(pRealPath, false, "pRealPath is null");
232 AppLog("GetRealPath(): path=[%ls], realPath=[%ls]", filePath.GetPointer(), realPath.GetPointer());
238 InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath)
243 res = File::IsFileExist(oldPath);
246 AppLog("CreateSymlink(): oldPath=[%ls] not found", oldPath.GetPointer());
250 std::unique_ptr<char[]> pOldPath(_StringConverter::CopyToCharArrayN(oldPath));
251 TryReturn(pOldPath, false, "pOldPath is null");
253 std::unique_ptr<char[]> pNewPath(_StringConverter::CopyToCharArrayN(newPath));
254 TryReturn(pNewPath, false, "pNewPath is null");
256 err = symlink(pOldPath.get(), pNewPath.get());
257 TryReturn(err == 0, false, "symlink() is failed(%s), oldpath=[%s], newpath=[%s]", strerror(errno), pOldPath.get(), pNewPath.get());
259 SmackManager smackManager;
261 smackManager.AddLabelDir(label, newPath);
263 AppLog("CreateSymlink(): [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer());
269 InstallerUtil::ChangeMode(const String& filePath, int mode)
273 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
274 TryReturn(pFilePath, false, "pFilePath is null");
276 err = chmod(pFilePath.get(), mode);
277 TryReturn(err == 0, false, "chmod() is failed(%s), file=[%s], mode=[%o]", strerror(errno), pFilePath.get(), mode);
283 InstallerUtil::ChangeOwner(const String& filePath)
287 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
288 TryReturn(pFilePath, false, "pFilePath is null");
290 err = chown(pFilePath.get(), APP_OWNER_ID, APP_GROUP_ID);
291 TryReturn(err == 0, false, "chown() is failed(%s), file=[%s]", strerror(errno), pFilePath.get());
297 InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode, bool appOwner)
299 result r = E_SUCCESS;
302 res = File::IsFileExist(filePath);
305 AppLog("path=[%ls]: skip", filePath.GetPointer());
309 std::unique_ptr<Directory> pDir(new (std::nothrow) Directory);
310 TryReturn(pDir, false, "pDir is null.");
312 r = pDir->Construct(filePath);
313 TryReturn(!IsFailed(r), false, "pDir->Construct() failed, filePath=[%ls]", filePath.GetPointer());
315 std::unique_ptr<DirEnumerator> pDirEnum(pDir->ReadN());
316 TryReturn(pDirEnum, false, "pDirEnum is null.");
318 while (pDirEnum->MoveNext() == E_SUCCESS)
320 DirEntry entry = pDirEnum->GetCurrentDirEntry();
321 String entryName = entry.GetName();
322 if (entryName.IsEmpty() == true)
324 AppLog("entryName is empty.", entryName.GetPointer());
328 String entryDir = filePath;
330 entryDir += entryName;
332 if (entryName == L".")
334 if (appOwner == true)
336 InstallerUtil::ChangeOwner(entryDir);
338 InstallerUtil::ChangeMode(entryDir, mode | PERM_EXECUTE);
341 else if (entryName == L"..")
346 if (entry.IsDirectory() == false)
348 if (appOwner == true)
350 InstallerUtil::ChangeOwner(entryDir);
352 InstallerUtil::ChangeMode(entryDir, mode);
356 ChangeDirectoryPermission(entryDir, mode, appOwner);
357 if (appOwner == true)
359 InstallerUtil::ChangeOwner(entryDir);
361 InstallerUtil::ChangeMode(entryDir, mode | PERM_EXECUTE);
365 AppLog("path=[%ls], mode=[%04o], appOwner=[%s]",
366 filePath.GetPointer(), mode, appOwner?"true":"false");
372 InstallerUtil::IsDrmFile(const String& path)
378 InstallerUtil::DecryptPackage(const String& packagePath)
384 InstallerUtil::GetCategory(int categoryType)
388 if (categoryType == CATEGORY_TYPE_IME)
392 else if (categoryType == CATEGORY_TYPE_HOME_SCREEN)
394 category = L"home-screen";
396 else if (categoryType == CATEGORY_TYPE_LOCK_SCREEN)
398 category = L"lock-screen";
405 InstallerUtil::GetCategoryType(char* pCategory)
407 CategoryType category = CATEGORY_TYPE_NONE;
409 if (strcasecmp(pCategory, "Ime") == 0)
411 category = CATEGORY_TYPE_IME;
413 else if (strcasecmp(pCategory, "home-screen") == 0)
415 category = CATEGORY_TYPE_HOME_SCREEN;
417 else if (strcasecmp(pCategory, "lock-screen") == 0)
419 category = CATEGORY_TYPE_LOCK_SCREEN;
426 InstallerUtil::CreateSymlinkForAppDirectory(const String& inPath, String& outPath)
430 int length = inPath.GetLength();
431 inPath.SubString(length - PACKAGE_ID_LENGTH, PACKAGE_ID_LENGTH, appId);
434 newPath = PATH_OPT_APPS;
438 if (inPath != newPath)
440 InstallerUtil::CreateSymlink(inPath, newPath);
444 AppLog("CreateSymlinkForAppDirectory(): output path=[%ls]", outPath.GetPointer());
450 InstallerUtil::CreateInfoFile(const String& filePath, const String* pContext)
452 result r = E_SUCCESS;
455 r = file.Construct(filePath, "w");
456 TryReturn(!IsFailed(r), false, "file.Construct() failed, filePath=[%ls]", filePath.GetPointer());
458 AppLog("------------------------------------------");
459 AppLog("CreateInfoFile(), filePath = [%ls]", filePath.GetPointer());
463 r = file.Write(*pContext);
464 TryReturn(!IsFailed(r), false, "file.Write() failed, filePath=[%ls]", filePath.GetPointer());
465 AppLog("string = [%ls]", pContext->GetPointer());
467 AppLog("------------------------------------------");
473 InstallerUtil::DumpLog(const char* pBuf)
475 TryReturn(pBuf, false, "pBuf is null");
477 char temp[4096] = {0};
478 int bufLen = strlen(pBuf);
479 strncpy(temp, pBuf, sizeof(temp)-1);
481 char* pStart = &temp[0];
483 for (int i = 0; i < bufLen; i++)
488 AppLog("%s", pStart);
489 pStart = temp + i + 1;
496 #define LOG_PRINT_LINE_MAX 20
497 #define LOG_BUFFER_COUNT_MAX 4096
499 InstallerUtil::DumpLogData(char *pData, int dataLen)
501 const char *szData = (const char*)pData;
503 int i = 0, j = 0, idx = 0, idx2 = 0, high = 0, low = 0, temp = 0;
505 char buf[LOG_PRINT_LINE_MAX + 2] = {0};
506 char buf2[(LOG_PRINT_LINE_MAX + 2) * 3] = {0};
507 char buf_out[sizeof(buf) + sizeof(buf2) + 1] = {0};
510 if (dataLen > LOG_BUFFER_COUNT_MAX)
512 dataLen = LOG_BUFFER_COUNT_MAX;
515 // 16 characters by 20 line are proper. // too many logs decrease performance.
516 // if (dataLen > 16*20)
519 AppLog("------------------------------------------");
521 while (i < (int)dataLen)
525 /* make ascii table */
526 if (ch >= 32 && ch <= 128)
534 high = (ch & 0xf0)>>4;
537 buf2[idx2++] = LogChangeHexToStr(high);
538 buf2[idx2++] = LogChangeHexToStr(low);
541 if (idx >= LOG_PRINT_LINE_MAX)
543 memcpy(buf_out, buf2, idx2);
545 buf_out[idx2++] = ' ';
546 buf_out[idx2++] = ' ';
548 memcpy(buf_out + idx2, buf, idx);
549 buf_out[idx2+idx] = '\0';
554 AppLog("%s\n", buf_out);
563 memcpy(buf_out, buf2, idx2);
566 for (j = 0; j < (LOG_PRINT_LINE_MAX * 3) - temp; j++)
568 buf_out[idx2++] = ' ';
571 buf_out[idx2++] = ' ';
572 buf_out[idx2++] = ' ';
574 memcpy(buf_out+idx2, buf, idx);
575 buf_out[idx2+idx] = '\0';
577 AppLog("%s\n", buf_out);
580 AppLog("------------------------------------------");
586 InstallerUtil::LogChangeHexToStr(int hex)
590 const static char hexValues[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 0};
593 if (hex >= 0 && hex <= 0x0F)
599 AppLog("LogChangeHexToStr: Error! [Hex Val: %d]\n", hex);
606 InstallerUtil::CreateLog(const String& logFile)
610 result r = file.Construct(logFile, "w");
620 InstallerUtil::AppendLog(const char* pFunction, int lineNumber, bool fatal, const char* pFormat, ...)
624 InstallerManager *pManager = InstallerManager::GetInstance();
625 if (pManager == null)
630 if (pManager->IsFileLogOn() == false)
635 String logFile = pManager->GetLogFilePath();
636 result r = file.Construct(logFile, "a");
643 va_start(args, pFormat);
644 const int bufSize = 1024;
645 char logs[bufSize+1] = {0};
646 char logs2[bufSize+1] = {0};
649 snprintf(logs, bufSize, " | %s (%d). > %s", (char*)pFunction, lineNumber, pFormat);
653 snprintf(logs, bufSize, "[TRY]| %s (%d). > %s", (char*)pFunction, lineNumber, pFormat);
656 vsnprintf(logs2, bufSize, logs, args);
657 int length = strlen(logs2);
658 logs2[length] = '\n';
660 r = file.Write(logs2, length+1);
667 if (pManager->IsHistoryFileLogOn() == true)
670 String historyLogFilePath = pManager->GetHistoryLogFilePath();
671 r = historyLogFile.Construct(historyLogFilePath, "a");
674 r = historyLogFile.Write(logs2, length+1);
688 InstallerUtil::PrintLog(const String& logFile)
690 InstallerManager *pManager = InstallerManager::GetInstance();
691 if (pManager == null)
696 if (pManager->IsFileLogOn() == false)
702 FileAttributes attribute;
704 result r = File::GetAttributes(logFile, attribute);
711 std::unique_ptr<char[]> pBuf(new (std::nothrow) char[bufSize]);
717 r = file.Construct(logFile, "r");
726 memset(pBuf.get(), 0, bufSize);
727 readBytes = file.Read(pBuf.get(), bufSize);
730 fprintf(stderr, "%s", pBuf.get());
733 while (readBytes > 0);
739 InstallerUtil::GetRdsList(const PackageId& packageId, IList* pDeletedList, IList* pAddedList, IList* pModifiedList)
743 char rdsFilePath[1024] = {0};
744 char buffer[1024] = {0};
745 InstallerRdsState state = INSTALLER_RDS_STATE_NONE;
747 snprintf(rdsFilePath, sizeof(rdsFilePath), "%s/%ls/%s", DIR_APPLICATIONS_TMP, packageId.GetPointer(), INSTALLER_RDS_FILE_NAME);
749 fp = fopen(rdsFilePath, "r");
750 TryReturn(fp, false, "fp is null.");
751 AppLog(".rds_delta file");
754 while (fgets(buffer, sizeof(buffer), fp) != null)
756 bool isMetadata = false;
758 if (buffer[0] == '#')
760 if (strcasestr(buffer, INSTALLER_RDS_DELETE_STR))
762 state = INSTALLER_RDS_STATE_DELETE;
764 else if (strcasestr(buffer, INSTALLER_RDS_ADD_STR))
766 state = INSTALLER_RDS_STATE_ADD;
768 else if (strcasestr(buffer, INSTALLER_RDS_MODIFY_STR))
770 state = INSTALLER_RDS_STATE_MODIFY;
776 if (state == INSTALLER_RDS_STATE_NONE)
778 AppLog("Unknown RDS State, INSTALLER_RDS_STATE_NONE");
782 std::unique_ptr<String> pStr(new (std::nothrow) String(buffer));
783 TryCatch(pStr, res = false, "pStr is null.");
784 TryCatch(pStr->IsEmpty() == false, res = false, "pStr is empty.");
787 AppLog(".rds_delta: line(%03d)=[%ls]", line, pStr->GetPointer());
790 if (isMetadata == true)
793 if (state == INSTALLER_RDS_STATE_DELETE)
795 pDeletedList->Add(pStr.release());
797 else if (state == INSTALLER_RDS_STATE_ADD)
799 pAddedList->Add(pStr.release());
801 else if (state == INSTALLER_RDS_STATE_MODIFY)
803 pModifiedList->Add(pStr.release());
806 memset(buffer, 0, sizeof(buffer));
815 InstallerUtil::GetInstallerOperationString(int operation)
817 if (operation == INSTALLER_OPERATION_INSTALL)
821 else if (operation == INSTALLER_OPERATION_UNINSTALL)
825 else if (operation == INSTALLER_OPERATION_REINSTALL)
834 InstallerUtil::GetFileDigest(const String& filePath, String& digestValue)
836 const int bufSize = 64*1024;
838 result r = E_SUCCESS;
841 std::unique_ptr<Sha2Hash> pHash(new (std::nothrow) Sha2Hash());
843 r = pHash->SetAlgorithm("SHA2/256");
844 TryReturn(!IsFailed(r), false, "pHash->SetAlgorithm() is failed.");
846 r = pHash->Initialize();
847 TryReturn(!IsFailed(r), false, "pHash->Initialize() is failed.");
849 std::unique_ptr<char[]> pBuf(new (std::nothrow) char[bufSize]);
850 TryReturn(pBuf, false, "pBuf is null");
852 r = file.Construct(filePath, L"r");
853 TryReturn(!IsFailed(r), false, "file.Construct() is failed.");
857 readBytes = file.Read(pBuf.get(), bufSize);
858 AppLog("readBytes for Hash=[%d]", readBytes);
863 r = buffer.Construct((const byte*)pBuf.get(), 0, readBytes, bufSize);
864 TryReturn(!IsFailed(r), false, "buffer.Construct() is failed.");
866 r = pHash->Update(buffer);
867 TryReturn(!IsFailed(r), false, "pHash->Update() is failed.");
870 while (readBytes > 0);
872 std::unique_ptr<ByteBuffer> pResultBuf(pHash->FinalizeN());
873 TryReturn(pResultBuf, false, "pResultBuf is null.");
875 r = StringUtil::EncodeToBase64String(*pResultBuf, digestValue);
876 TryReturn(!IsFailed(r), false, "EncodeToBase64String() is failed.");
882 InstallerUtil::ParseN(const String& str, const String& tokenDelimiter)
884 TryReturn(str.IsEmpty() == false, null, "str is empty.");
885 TryReturn(tokenDelimiter.IsEmpty() == false, null, "tokenDelimiter is empty.");
887 std::unique_ptr< HashMap > pMap(new (std::nothrow) HashMap);
888 TryReturn(pMap, null, "pMap is null.");
890 result r = pMap->Construct();
891 TryReturn(!IsFailed(r), null, "pMap->Construct() is failed.");
893 StringTokenizer strTok(str, tokenDelimiter);
894 while(strTok.HasMoreTokens() == true)
897 r = strTok.GetNextToken(token);
898 TryReturn(!IsFailed(r), null, "strTok.GetNextToken() is failed.");
900 AppLog("token = [%ls]", token.GetPointer());
902 StringTokenizer infoTok(token, L"=");
904 if (infoTok.GetTokenCount() != 2)
906 AppLog("'=' is not existed.");
910 std::unique_ptr< String > pKey(new (std::nothrow) String);
911 r = infoTok.GetNextToken(*pKey);
912 TryReturn(!IsFailed(r), null, "infoTok.GetNextToken(*pKey) is failed.");
913 AppLog(" - key = [%ls]", pKey->GetPointer());
915 std::unique_ptr< String > pValue(new (std::nothrow) String);
916 r = infoTok.GetNextToken(*pValue);
917 TryReturn(!IsFailed(r), null, "infoTok.GetNextToken(*pValue) is failed.");
918 AppLog(" - value = [%ls]", pValue->GetPointer());
920 r = pMap->Add(pKey.release(), pValue.release());
921 TryReturn(!IsFailed(r), null, "pMap->Add() is failed.");
924 if (pMap->GetCount() <= 0)
926 AppLog("pMap->GetCount() is invalid.");
930 return pMap.release();
934 InstallerUtil::TerminateApp(const AppId& appId)
938 if (_Aul::IsRunning(appId) == true)
940 AppLog("App(%ls) is running.", appId.GetPointer());
942 result r = _Aul::TerminateApplication(appId);
943 TryReturn(r == E_SUCCESS, false, "TerminateApplication() failed. [%ls]", appId.GetPointer());
945 for (int j = 0; j < TERMINATE_RETRY_COUNT; j++)
947 res = _Aul::IsRunning(appId);
950 AppLog("App(%ls) is terminated.", appId.GetPointer());
955 AppLog("App(%ls) is not terminated yet. wait count = [%d]", appId.GetPointer(), j);
962 AppLog("App(%ls) can't be terminated.", appId.GetPointer());
968 AppLog("App(%ls) is not running.", appId.GetPointer());
975 InstallerUtil::TerminateApps(const PackageId& packageId)
977 std::unique_ptr< PackageInfo > pPackageInfo(_PackageManagerImpl::GetInstance()->GetPackageInfoN(packageId));
979 _PackageInfoImpl* pPackageInfoImpl = _PackageInfoImpl::GetInstance(pPackageInfo.get());
980 TryReturn(pPackageInfoImpl, false, "GetInstance() failed.");
982 std::unique_ptr< IList > pPackageAppList(pPackageInfoImpl->GetPackageAppInfoListN());
983 TryReturn(pPackageAppList, false, "GetPackageAppInfoListN() failed.");
985 for (int i = 0; i < pPackageAppList->GetCount(); i++)
987 PackageAppInfo* pPackageAppInfo = dynamic_cast < PackageAppInfo* >(pPackageAppList->GetAt(i));
988 TryReturn(pPackageAppInfo, false, "pPackageAppList->GetAt(%d) failed.", i);
990 AppId appId = pPackageAppInfo->GetAppId();