installd: Check for support before migrating obb

This prevents migrating the obb folder if the device's kernel does not
support the new location.

Test: Run script on kernel with support for the unshared_obb option, and
      without, i.e. P kernel and Q kernel
Bug: 136199978

Change-Id: I3ff3e7653d9c9c6cdda4d17bafc853b5602597cf
(cherry picked from commit 8b6bff42b8cf7f8596278f3b34652deb3c7cdde2)
diff --git a/cmds/installd/ b/cmds/installd/
index 4f8a1ec..ef9be5c 100644
--- a/cmds/installd/
+++ b/cmds/installd/
@@ -20,6 +20,14 @@
   exit 0
+rm -rf /data/media/0/Android/obb/test_probe
+touch /sdcard/Android/obb/test_probe
+if ! test -f /data/media/0/Android/obb/test_probe ; then
+  log -p i -t migrate_legacy_obb_data "No support for 'unshared_obb'. Not migrating"
+  rm -rf /data/media/0/Android/obb/test_probe
+  exit 0
 log -p i -t migrate_legacy_obb_data "Migrating legacy obb data."
 rm -rf /data/media/0/Android/obb
 cp -F -p -R -P -d /data/media/obb /data/media/0/Android