diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/scoped/FolderProvider.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/scoped/FolderProvider.java index 47a9737b01..b3379bce98 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/scoped/FolderProvider.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/scoped/FolderProvider.java @@ -44,6 +44,7 @@ * - ... */ public class FolderProvider extends DocumentsProvider { + private static final List BLOCKED_PACKAGES = List.of("com.dnamobile.modlymodmanager"); private static final String ALL_MIME_TYPES = "*/*"; @@ -101,6 +102,8 @@ public Cursor queryRoots(String[] projection) { @Override public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException { + if(BLOCKED_PACKAGES.contains(getCallingPackage())) + throw new RuntimeException("Unsupported package caller!"); final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_DOCUMENT_PROJECTION); // Future-proofing in case if we implement realtime file watching result.setNotificationUri(mContentResolver, createUriForDocId(documentId)); @@ -110,6 +113,8 @@ public Cursor queryDocument(String documentId, String[] projection) throws FileN @Override public Cursor queryChildDocuments(String parentDocumentId, String[] projection, String sortOrder) throws FileNotFoundException { + if(BLOCKED_PACKAGES.contains(getCallingPackage())) + throw new RuntimeException("Unsupported package caller!"); final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_DOCUMENT_PROJECTION); final File parent = getFileForDocId(parentDocumentId); final File[] children = parent.listFiles(); @@ -138,9 +143,9 @@ public AssetFileDescriptor openDocumentThumbnail(String documentId, Point sizeHi @Override public boolean onCreate() { - if(Tools.checkStorageRoot(getContext())) { + if (Tools.checkStorageRoot(getContext())) { Tools.initStorageConstants(getContext()); - }else { + } else { return false; } BASE_DIR = new File(Tools.DIR_GAME_HOME); @@ -151,6 +156,8 @@ public boolean onCreate() { @Override public String createDocument(String parentDocumentId, String mimeType, String displayName) throws FileNotFoundException { + if(BLOCKED_PACKAGES.contains(getCallingPackage())) + throw new RuntimeException("Unsupported package caller!"); File newFile = new File(parentDocumentId, displayName); int noConflictId = 2; while (newFile.exists()) {