diff --git a/app/src/main/java/io/github/muntashirakon/AppManager/fm/FmViewModel.java b/app/src/main/java/io/github/muntashirakon/AppManager/fm/FmViewModel.java index 92319bc8b2108ab8e87178fb3db6a9522c16eaf9..af513df703a899e88e6a3199172f7e3cc57153a7 100644 --- a/app/src/main/java/io/github/muntashirakon/AppManager/fm/FmViewModel.java +++ b/app/src/main/java/io/github/muntashirakon/AppManager/fm/FmViewModel.java @@ -8,7 +8,6 @@ import android.content.ContentResolver; import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; -import android.os.Process; import android.provider.DocumentsContract; import android.text.TextUtils; @@ -44,9 +43,7 @@ import io.github.muntashirakon.AppManager.misc.AdvancedSearchView; import io.github.muntashirakon.AppManager.misc.ListOptions; import io.github.muntashirakon.AppManager.self.filecache.FileCache; import io.github.muntashirakon.AppManager.self.imagecache.ImageLoader; -import io.github.muntashirakon.AppManager.settings.Ops; import io.github.muntashirakon.AppManager.settings.Prefs; -import io.github.muntashirakon.AppManager.users.Users; import io.github.muntashirakon.AppManager.utils.AlphanumComparator; import io.github.muntashirakon.AppManager.utils.ExUtils; import io.github.muntashirakon.AppManager.utils.FileUtils; @@ -306,11 +303,8 @@ public class FmViewModel extends AndroidViewModel implements ListOptions.ListOpt // Since we couldn't resolve the path, try currentPath instead } } - Path finalPath = currentPath; + Path path = currentPath; mFmFileLoaderResult = ThreadUtils.postOnBackgroundThread(() -> { - // Update paths - Path path = getFixedPath(finalPath); - mCurrentUri = path.getUri(); if (!path.isDirectory()) { IOException e; if (path.exists()) { @@ -585,28 +579,4 @@ public class FmViewModel extends AndroidViewModel implements ListOptions.ListOpt } return fs; } - - // This fix is temporary - private static final String STORAGE_EMULATED = "/storage/emulated/"; - - @NonNull - private static Path getFixedPath(@NonNull Path originalPath) { - int uid = Users.getSelfOrRemoteUid(); - if (uid != Process.myUid() && uid != Ops.SHELL_UID) { - // Need no fixing - return originalPath; - } - String filePath = originalPath.getFilePath(); - if (filePath == null || !filePath.startsWith(STORAGE_EMULATED) || filePath.length() == STORAGE_EMULATED.length()) { - // Need no fixing - return originalPath; - } - if (filePath.startsWith(STORAGE_EMULATED + '\u200B')) { - // Already fixed - return originalPath; - } - // Add ZWSP - String newFilePath = STORAGE_EMULATED + '\u200B' + filePath.substring(STORAGE_EMULATED.length()); - return Paths.get(newFilePath); - } }