Merge "Delete the checkin directory with the wrong context" am: 2c48d37a29 am: 821e6c7db4 am: ea28c7cdce am: 8081f39fce am: 00f1824b7a

Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1866819

Change-Id: I89d197e67eeba6ec86d0926416d36b7af4a059e8
diff --git a/vold_prepare_subdirs.cpp b/vold_prepare_subdirs.cpp
index 862191c..0d58e4d 100644
--- a/vold_prepare_subdirs.cpp
+++ b/vold_prepare_subdirs.cpp
@@ -215,7 +215,15 @@
             // the user id to set the correct selinux mls_level.
             if (!prepare_dir_for_user(sehandle, 0770, AID_SYSTEM, AID_CACHE,
                                       misc_ce_path + "/checkin", user_id)) {
-                return false;
+                // TODO(b/203742483) the checkin directory was created with the wrong permission &
+                // context. Delete the directory to get these devices out of the bad state. Revert
+                // the change once the droidfood population is on newer build.
+                LOG(INFO) << "Failed to prepare the checkin directory, deleting for recreation";
+                android::vold::DeleteDirContentsAndDir(misc_ce_path + "/checkin");
+                if (!prepare_dir_for_user(sehandle, 0770, AID_SYSTEM, AID_CACHE,
+                                          misc_ce_path + "/checkin", user_id)) {
+                    return false;
+                }
             }
 
             auto system_ce_path = android::vold::BuildDataSystemCePath(user_id);