Switch to new project ID constants.

Use new constants, instead of reusing previous sdcardfs values.

Bug: 146419093
Test: lsattr -pR
Change-Id: I7409d86cac5360e125e843cc79f3c5f41d74dd1e
diff --git a/Utils.cpp b/Utils.cpp
index 9f9b357..0974a0b 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -29,6 +29,7 @@
 #include <cutils/fs.h>
 #include <logwrap/logwrap.h>
 #include <private/android_filesystem_config.h>
+#include <private/android_projectid_config.h>
 
 #include <dirent.h>
 #include <fcntl.h>
@@ -318,7 +319,13 @@
     }
     std::string pathToCreate = root + appDir;
     int depth = 0;
-    bool withinCache = false;
+    // Derive initial project ID
+    if (appDir == kAppDataDir || appDir == kAppMediaDir) {
+        projectId = uid - AID_APP_START + PROJECT_ID_EXT_DATA_START;
+    } else if (appDir == kAppObbDir) {
+        projectId = uid - AID_APP_START + PROJECT_ID_EXT_OBB_START;
+    }
+
     while ((pos = leftToCreate.find('/')) != std::string::npos) {
         std::string component = leftToCreate.substr(0, pos + 1);
         leftToCreate = leftToCreate.erase(0, pos + 1);
@@ -329,12 +336,7 @@
             // Android/data, eg Android/data/com.foo/cache
             // Note that this "sticks" - eg subdirs of this dir need the same
             // project ID.
-            withinCache = true;
-        }
-        if (withinCache) {
-            projectId = uid - AID_APP_START + AID_CACHE_GID_START;
-        } else {
-            projectId = uid - AID_APP_START + AID_EXT_GID_START;
+            projectId = uid - AID_APP_START + PROJECT_ID_EXT_CACHE_START;
         }
 
         if (fixupExisting && access(pathToCreate.c_str(), F_OK) == 0) {