Temporarily grant legacy storage to certain apps.

We've gone to great lengths to return "_data" columns that can be
successfully opened from managed code, which is thankfully how most
apps are working with media.

However, a small handful of apps appear to be passing these "_data"
paths down into native code, where we can't hook the open() syscall.

The only workaround we have is to grant these apps the "legacy"
storage view (meaning they can see the entire storage device), until
those developers can update their apps.

Bug: 124818022, 123996076, 124767356, 124531483
Test: manual
Change-Id: I995520e7c0071075dcae9daa8f311f17a187ae1b
(cherry picked from commit 0ebbd460f40ad260c420ab152354cfdc66b67237)
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 5da281a..cd9d84c 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -3688,7 +3688,16 @@
             } else if (mPmInternal.isInstantApp(packageName, UserHandle.getUserId(uid))) {
                 return Zygote.MOUNT_EXTERNAL_NONE;
             } else {
-                return Zygote.MOUNT_EXTERNAL_WRITE;
+                // STOPSHIP: remove this temporary workaround once developers
+                // fix bugs where they're opening _data paths in native code
+                switch (packageName) {
+                    case "com.facebook.katana": // b/123996076
+                    case "jp.naver.line.android": // b/124767356
+                    case "com.mxtech.videoplayer.ad": // b/124531483
+                        return Zygote.MOUNT_EXTERNAL_LEGACY;
+                    default:
+                        return Zygote.MOUNT_EXTERNAL_WRITE;
+                }
             }
         } catch (RemoteException e) {
             // Should not happen