Adjust the validation code for secondary dex paths

Do not validate the package path when reconciling secondary dex files. If
the file does not exist we cannot resolve the system sym links (e.g.
/data/user/0 -> /data/data) and the validation will fail leaving oat files
behind.

(cherry picked from commit 9cd45602a89b2af5d4b8086cbb806b64ff6b78a4)

Bug: 64460009
Test: adb shell cmd package reconcile-secondary-dex-files
com.google.android.googlequicksearchbox (after removing some files)
      adb shell cmd package compile -m speed --secondary-dex
com.google.android.googlequicksearchbox
      adb shell /data/nativetest64/installd_utils_test/installd_utils_test

Merged-In: I9734ad18a579d44088180326661d8cf8288e90be
Change-Id: I9734ad18a579d44088180326661d8cf8288e90be
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 6159207..6f7ab6b 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -1805,8 +1805,14 @@
     }
 
     const char* volume_uuid_cstr = volume_uuid == nullptr ? nullptr : volume_uuid->c_str();
+
+    // Note that we cannot validate the package path here because the file might not exist
+    // and we cannot call realpath to resolve system symlinks. Since /data/user/0 symlinks to
+    // /data/data/ a lot of validations will fail if we attempt to check the package path.
+    // It is still ok to be more relaxed because any file removal is done after forking and
+    // dropping capabilities.
     if (!validate_secondary_dex_path(pkgname.c_str(), dex_path.c_str(), volume_uuid_cstr,
-            uid, storage_flag)) {
+            uid, storage_flag, /*validate_package_path*/ false)) {
         LOG(ERROR) << "Could not validate secondary dex path " << dex_path;
         return false;
     }