diff --git a/CHANGELOG.md b/CHANGELOG.md index bf05654af..607c887d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Changelog * Added account type parameter for *Srv_getAccounts* and *Srv_getAccountsAsUser* * Check external storage directory for *open* restriction ([issue](/../../issues/1757)) * Added restriction *getInstalledProvidersForProfile* ([issue](/../../issues/1757)) +* Allow white listing / show parameter of *getExternalStorageState* ([issue](/../../issues/1757)) [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/src/biz/bokhorst/xprivacy/Meta.java b/src/biz/bokhorst/xprivacy/Meta.java index a915965c5..9f1ce845d 100644 --- a/src/biz/bokhorst/xprivacy/Meta.java +++ b/src/biz/bokhorst/xprivacy/Meta.java @@ -394,7 +394,7 @@ public static List get() { mListHook.add(new Hook("storage", "media", "WRITE_MEDIA_STORAGE", 10, null, null).dangerous().restart().noUsageData()); mListHook.add(new Hook("storage", "sdcard", "READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE,ACCESS_ALL_EXTERNAL_STORAGE", 10, null, null).dangerous().restart().noUsageData()); mListHook.add(new Hook("storage", "mtp", "ACCESS_MTP", 10, "2.1.1", null).dangerous().restart().noUsageData()); - mListHook.add(new Hook("storage", "getExternalStorageState", null, 10, null, null).unsafe()); + mListHook.add(new Hook("storage", "getExternalStorageState", null, 10, null, null).unsafe().whitelist(cTypeFilename)); mListHook.add(new Hook("storage", "open", null, 1, "1.99.46", null).unsafe().dangerous().whitelist(cTypeFilename)); mListHook.add(new Hook("storage", "openAssetFileDescriptor", null, 3, "2.1.17", null).unsafe().dangerous().whitelist(cTypeFilename)); diff --git a/src/biz/bokhorst/xprivacy/XEnvironment.java b/src/biz/bokhorst/xprivacy/XEnvironment.java index 5dc2189b6..f742cdd44 100644 --- a/src/biz/bokhorst/xprivacy/XEnvironment.java +++ b/src/biz/bokhorst/xprivacy/XEnvironment.java @@ -1,8 +1,10 @@ package biz.bokhorst.xprivacy; +import java.io.File; import java.util.ArrayList; import java.util.List; +import android.os.Build; import android.os.Environment; import android.util.Log; @@ -42,8 +44,15 @@ protected void before(XParam param) throws Throwable { @Override protected void after(XParam param) throws Throwable { if (mMethod == Methods.getExternalStorageState) { - if (param.getResult() != null && isRestricted(param)) - param.setResult(Environment.MEDIA_UNMOUNTED); + if (param.getResult() != null) { + String extra = null; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) + if (param.args.length > 0 && param.args[0] instanceof File) + extra = ((File) param.args[0]).getAbsolutePath(); + + if (isRestrictedExtra(param, extra)) + param.setResult(Environment.MEDIA_UNMOUNTED); + } } else Util.log(this, Log.WARN, "Unknown method=" + param.method.getName());