Remove code_cache info from parent's inode when code_cache is removed

Symptom:
After FOTA, shared_prefs directory of app is cleared.

Root cause:
PackageManager clears code_cache directory of all apps during first
boot after FOTA.
PackageManager saves inode number of code_cache directory to xattr of
app data directory in advance and accesses to code_cache directory by
saved inode number because app data stored in CE directory are encrypted
during boot for FBE.

However before FOTA, code_cache directory was deleted and shared_prefs
directory which has the same inode number as deleted code_cache
directory was created.
As a result PackageManager clears shared_prefs directory which has
inode number of code_cache directory.

Solution:
Remove inode number from xattr of app data directory when clear app
data.

Bug: 67140392
Change-Id: Ic7a6268a417aa41e2712499f397e6ec217b7cb3e
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 60c89a9..bac83a4 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -519,6 +519,9 @@
         if (access(path.c_str(), F_OK) == 0) {
             if (delete_dir_contents(path) != 0) {
                 res = error("Failed to delete contents of " + path);
+            } else if ((flags & (FLAG_CLEAR_CACHE_ONLY | FLAG_CLEAR_CODE_CACHE_ONLY)) == 0) {
+                remove_path_xattr(path, kXattrInodeCache);
+                remove_path_xattr(path, kXattrInodeCodeCache);
             }
         }
     }