Merge "Update PackageAppFilter API" into tizen_2.1
authorDuyoung Jang <duyoung.jang@samsung.com>
Thu, 11 Apr 2013 01:55:16 +0000 (10:55 +0900)
committerGerrit Code Review <gerrit2@kim11>
Thu, 11 Apr 2013 01:55:16 +0000 (10:55 +0900)
src/app/inc/FAppPkg_PackageManagerImpl.h
src/app/package/FAppPkg_PackageManagerImpl.cpp

index 317a7be..8764e03 100644 (file)
@@ -67,7 +67,9 @@ static const wchar_t PACKAGE_FILTER_APP_SETTING[] = L"http://tizen.org/package/a
 
 // PackageAppFilter
 static const wchar_t PACKAGE_APP_FILTER_MENUICON_VISIBLE[] = L"http://tizen.org/package/app/menuiconvisible";
-static const wchar_t PACKAGE_APP_FILTER_CATEGORY[] = L"http://tizen.org/package/app/category";
+static const wchar_t PACKAGE_APP_FILTER_CATEGORY_HOMEAPP[] = L"http://tizen.org/category/homeapp";
+static const wchar_t PACKAGE_APP_FILTER_CATEGORY_LOCKAPP[] = L"http://tizen.org/category/lockapp";
+static const wchar_t PACKAGE_APP_FILTER_CATEGORY_MENUAPP[] = L"http://tizen.org/category/menuapp";
 
 enum PackageStorageType
 {
index 156f074..0fd3e8d 100755 (executable)
@@ -953,20 +953,22 @@ _PackageManagerImpl::GetPackageAppInfoListN(const IMap& packageAppFilterMap) con
                        res = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, nodisplay);
                        SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_pkginfo_filter_add_bool(NODISPLAY, %d) is failed. [%d]", nodisplay, res);
                }
-               else if ((*pKey) == PACKAGE_APP_FILTER_CATEGORY)
+               else if ((*pKey) == PACKAGE_APP_FILTER_CATEGORY_HOMEAPP || (*pKey) == PACKAGE_APP_FILTER_CATEGORY_LOCKAPP
+                                               || (*pKey) == PACKAGE_APP_FILTER_CATEGORY_MENUAPP)
                {
                        definedKey = true;
 
-                       String* pVal = static_cast< String* >(pEnum->GetValue());
-                       SysTryCatch(NID_APP, pVal, , E_INVALID_ARG, "GetValue() is failed.");
+                       std::unique_ptr<char[]> pDefinedKey(_StringConverter::CopyToCharArrayN(*pKey));
+                       SysTryCatch(NID_APP, pDefinedKey, , E_OUT_OF_MEMORY, "pDefinedKey is null.");
 
-                       SysLog(NID_APP, "Key[%ls], Value[%ls]", pKey->GetPointer(), pVal->GetPointer());
+                       Boolean* pVal = static_cast< Boolean* >(pEnum->GetValue());
+                       SysTryCatch(NID_APP, pVal, , E_INVALID_ARG, "GetValue() is failed.");
 
-                       std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pVal));
-                       SysTryCatch(NID_APP, pValue, , E_OUT_OF_MEMORY, "pValue is null.");
+                       SysLog(NID_APP, "Key[%ls], Value[%d]", pKey->GetPointer(), pVal->ToBool());
+                       SysTryCatch(NID_APP, pVal->ToBool() == true, , E_INVALID_ARG, "Value(false) is not allowed.");
 
-                       res = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_CATEGORY, pValue.get());
-                       SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_appinfo_filter_add_string(CATEGORY, %s) is failed. [%d]", pValue.get(), res);
+                       res = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_CATEGORY, pDefinedKey.get());
+                       SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_appinfo_filter_add_string(CATEGORY, %s) is failed. [%d]", pDefinedKey.get(), res);
                }
                else
                {
@@ -983,8 +985,16 @@ _PackageManagerImpl::GetPackageAppInfoListN(const IMap& packageAppFilterMap) con
                        std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pVal));
                        SysTryCatch(NID_APP, pValue, , E_OUT_OF_MEMORY, "pValue is null.");
 
-                       res = pkgmgrinfo_appinfo_metadata_filter_add(metaHandle, pMetaKey.get(), pValue.get());
-                       SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_appinfo_metadata_filter_add(%s, %s) is failed. [%d]", pMetaKey.get(), pValue.get(), res);
+                       if ((*pVal) == L"*")
+                       {
+                               res = pkgmgrinfo_appinfo_metadata_filter_add(metaHandle, pMetaKey.get(), null);
+                               SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_appinfo_metadata_filter_add(%s, null) is failed. [%d]", pMetaKey.get(), res);
+                       }
+                       else
+                       {
+                               res = pkgmgrinfo_appinfo_metadata_filter_add(metaHandle, pMetaKey.get(), pValue.get());
+                               SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_appinfo_metadata_filter_add(%s, %s) is failed. [%d]", pMetaKey.get(), pValue.get(), res);
+                       }
                }
        }