installd: Add support for migrating legacy obb data.

Data needs to be copied over from /data/media/obb to its
new location under /data/media/0/Android/obb.

This is currently implemented as a single "cp -r" between
the two paths. The cp is executed by a forked shell script
that runs in its own domain.

Test: Manua
Bug: 129167772

Change-Id: I8a0667f33f7fcee5c9e0dba7b00a963797b0dc34
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 1384285..caac2e8 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -2816,5 +2816,16 @@
     return ok();
 }
 
+binder::Status InstalldNativeService::migrateLegacyObbData() {
+    ENFORCE_UID(AID_SYSTEM);
+    // NOTE: The lint warning doesn't apply to the use of system(3) with
+    // absolute parse and no command line arguments.
+    if (system("/system/bin/migrate_legacy_obb_data.sh") != 0) { // NOLINT(cert-env33-c)
+        LOG(ERROR) << "Unable to migrate legacy obb data";
+    }
+
+    return ok();
+}
+
 }  // namespace installd
 }  // namespace android