From 0ebbd460f40ad260c420ab152354cfdc66b67237 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 19 Feb 2019 23:45:57 -0700 Subject: [PATCH] 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 --- .../com/android/server/StorageManagerService.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index 5da281a5ebc3c..cd9d84cca2502 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -3688,7 +3688,16 @@ class StorageManagerService extends IStorageManager.Stub } 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