Apply directory permissions and home/lock-screen categories are not shown in taskmgr.
authorDongeup Ham <dongeup.ham@samsung.com>
Thu, 27 Dec 2012 12:02:54 +0000 (21:02 +0900)
committerDongeup Ham <dongeup.ham@samsung.com>
Thu, 27 Dec 2012 12:02:54 +0000 (21:02 +0900)
Change-Id: I738974df4b07653135de7b4eed57a677b349928b
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
inc/InstallerDefs.h
src/Manager/PermissionManager.cpp
src/Util/InstallerUtil.cpp
src/Util/InstallerUtil.h
src/XmlHandler/ManifestGenerator.cpp

index 967442b..586d983 100755 (executable)
@@ -21,7 +21,7 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = [2012/12/27]_RC[1]"
+#define OSP_INSTALLER_VERSION "osp-installer version = [2012/12/27]_RC[2]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
 #define DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP   L"/opt/storage/sdcard/apps/__@@osp_tmp@@__"
 #define DIR_MEMORYCARD_INSTALLATION                            L"/opt/storage/sdcard/installtosdcard"
 
+#define PERM_BASE                                                              (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)         // 0644
+#define PERM_EXECUTE                                                   (S_IXUSR | S_IXGRP | S_IXOTH)
+#define PERM_WRITE                                                             (S_IWUSR | S_IWGRP | S_IWOTH)
+
 static const int BLOCK_SIZE = 4096;
 
 #define OSP_INSTALLER  "osp-installer"
index e5efd97..b5e1564 100755 (executable)
@@ -62,40 +62,40 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
        pPackageInfoImpl = pContext->GetPackageInfoImpl();
        appRootPath = pPackageInfoImpl->GetAppRootPath();
 
-       // appRoot(rx for app)
-       InstallerUtil::ChangeOwner(appRootPath);
-       InstallerUtil::ChangeMode(appRootPath, S_IRUSR | S_IXUSR);
+       // appRoot
+       // InstallerUtil::ChangeOwner(appRootPath);
+       InstallerUtil::ChangeMode(appRootPath, PERM_BASE | PERM_EXECUTE);
 
-       // appRoot/bin(rx for app)
+       // appRoot/bin
        destPath = appRootPath + DIR_BIN;
-       InstallerUtil::ChangeDirectoryPermission(destPath, S_IRUSR | S_IXUSR);
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE);
 
-       // appRoot/info(rx for app)
+       // appRoot/info
        destPath = appRootPath + DIR_INFO;
-       InstallerUtil::ChangeDirectoryPermission(destPath, S_IRUSR | S_IXUSR);
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
 
-       // appRoot/res(rx for app)
+       // appRoot/res
        destPath = appRootPath + DIR_RES;
-       InstallerUtil::ChangeDirectoryPermission(destPath, S_IRUSR | S_IXUSR);
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
 
-       // appRoot/lib(rwx for app)
+       // appRoot/lib
        destPath = appRootPath + DIR_LIB;
-       InstallerUtil::ChangeDirectoryPermission(destPath, S_IRUSR | S_IXUSR);
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE);
 
-       // appRoot/icons(rx for app)
+       // appRoot/icons
        destPath = appRootPath + DIR_SHARED_RES;
        if (File::IsFileExist(destPath) == false)
        {
                String iconPath = appRootPath + DIR_ICONS;
                InstallerUtil::CreateSymlink(iconPath, destPath);
        }
-       InstallerUtil::ChangeDirectoryPermission(destPath, S_IRUSR | S_IXUSR);
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
 
-       // appRoot/contents(rx for app)
+       // appRoot/contents
        destPath = appRootPath + DIR_CONTENTS;
-       InstallerUtil::ChangeDirectoryPermission(destPath, S_IRUSR | S_IXUSR);
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
 
-       // appRoot/setting(rwx for app)
+       // appRoot/setting
        destPath = appRootPath + DIR_SETTING;
        r = File::GetAttributes(destPath, attribute);
        if (r == E_SUCCESS)
@@ -110,17 +110,17 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                InstallerUtil::Remove(settingXmlPath);
                InstallerUtil::CreateSymlink(srcPath, settingXmlPath);
 
-               InstallerUtil::ChangeDirectoryPermission(destPath, S_IRWXU);
+               InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_WRITE);
        }
 
-       // appRoot/data(rwx for app)
+       // appRoot/data
        destPath = appRootPath + DIR_DATA;
        if (File::IsFileExist(destPath) == false)
        {
                r = Directory::Create(destPath, false);
                TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Directory::Create() failed");
        }
-       InstallerUtil::ChangeDirectoryPermission(destPath, S_IRWXU);
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
 
        String appId = pContext->GetAppId();
        String apiVersion = pPackageInfoImpl->GetAppApiVersion();
index 4caa238..99ba375 100755 (executable)
@@ -273,12 +273,13 @@ InstallerUtil::ChangeOwner(const String& filePath)
 }
 
 bool
-InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode)
+InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode, bool isOwnerChanged)
 {
        result r = E_SUCCESS;
        bool res = false;
 
-       AppLogTag(OSP_INSTALLER, "+ ChangeDirectoryPermission(): path=[%ls], mode=[%04o]", filePath.GetPointer(), mode);
+       AppLogTag(OSP_INSTALLER, "+ ChangeDirectoryPermission(): path=[%ls], mode=[%04o], isOwnerChanged=[%s]",
+                       filePath.GetPointer(), mode, isOwnerChanged?"true":"false");
 
        res = File::IsFileExist(filePath);
        if (res == false)
@@ -307,8 +308,11 @@ InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode)
 
                if (entryName == L".")
                {
-                       InstallerUtil::ChangeOwner(entryDir);
-                       InstallerUtil::ChangeMode(entryDir, mode);
+                       if (isOwnerChanged == true)
+                       {
+                               InstallerUtil::ChangeOwner(entryDir);
+                       }
+                       InstallerUtil::ChangeMode(entryDir, mode | PERM_EXECUTE);
                        continue;
                }
                else if (entryName == L"..")
@@ -318,13 +322,16 @@ InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode)
 
                if (entry.IsDirectory() == false)
                {
-                       InstallerUtil::ChangeOwner(entryDir);
+                       if (isOwnerChanged == true)
+                       {
+                               InstallerUtil::ChangeOwner(entryDir);
+                       }
                        InstallerUtil::ChangeMode(entryDir, mode);
                }
                else
                {
                        ChangeDirectoryPermission(entryDir, mode);
-                       InstallerUtil::ChangeMode(entryDir, mode);
+                       InstallerUtil::ChangeMode(entryDir, mode | PERM_EXECUTE);
                }
        }
 
index f00523c..0ffd10a 100755 (executable)
@@ -51,7 +51,7 @@ public:
        static bool CreateSymlink(const Tizen::Base::String& oldPath, const Tizen::Base::String& newPath);
        static bool ChangeMode(const Tizen::Base::String& filePath, int mode);
        static bool     ChangeOwner(const Tizen::Base::String& filePath);
-       static bool     ChangeDirectoryPermission(const Tizen::Base::String& filePath, int mode);
+       static bool     ChangeDirectoryPermission(const Tizen::Base::String& filePath, int mode, bool isOwnerChanged=false);
 
        static bool IsDrmFile(const Tizen::Base::String& path);
        static bool DecryptPackage(const Tizen::Base::String& packagePath);
index 7c5c3e2..6b20a46 100755 (executable)
@@ -500,6 +500,18 @@ ManifestGenerator::WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl*
                        taskmanage = L"false";
                        nodisplay = L"true";
                }
+
+               if (FindCategory(index, "http://tizen.org/category/homescreen") == true)
+               {
+                       AppLogTag(OSP_INSTALLER, "Write(): [http://tizen.org/category/homescreen] is detected. taskmanage=false");
+                       taskmanage = L"false";
+               }
+
+               if (FindCategory(index, "http://tizen.org/category/lockscreen") == true)
+               {
+                       AppLogTag(OSP_INSTALLER, "Write(): [http://tizen.org/category/lockscreen] is detected. taskmanage=false");
+                       taskmanage = L"false";
+               }
        }
 
        ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList();