diff --git a/CHANGELOG.md b/CHANGELOG.md index 73a009180..5daaef6c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ Changelog **Next release** +* Added option to specify file name to import/export intent ([issue](/../../issues/1784)) + [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) **Version 2.1.20 BETA** diff --git a/src/biz/bokhorst/xprivacy/ActivityShare.java b/src/biz/bokhorst/xprivacy/ActivityShare.java index 93167fce6..ff37070eb 100644 --- a/src/biz/bokhorst/xprivacy/ActivityShare.java +++ b/src/biz/bokhorst/xprivacy/ActivityShare.java @@ -108,6 +108,7 @@ public class ActivityShare extends ActivityBase { public static final String cRestriction = "Restriction"; public static final String cInteractive = "Interactive"; public static final String cChoice = "Choice"; + public static final String cFileName = "FileName"; public static final String HTTP_BASE_URL = "http://crowd.xprivacy.eu/"; public static final String HTTPS_BASE_URL = "https://crowd.xprivacy.eu/"; @@ -152,6 +153,7 @@ protected void onCreate(Bundle savedInstanceState) { final int[] uids = (extras != null && extras.containsKey(cUidList) ? extras.getIntArray(cUidList) : new int[0]); final String restrictionName = (extras != null ? extras.getString(cRestriction) : null); int choice = (extras != null && extras.containsKey(cChoice) ? extras.getInt(cChoice) : -1); + mFileName = (extras != null && extras.containsKey(cFileName) ? extras.getString(cFileName) : null); // License check if (action.equals(ACTION_IMPORT) || action.equals(ACTION_EXPORT) @@ -257,18 +259,19 @@ protected void onCreate(Bundle savedInstanceState) { boolean hasIntent = Util.isIntentAvailable(ActivityShare.this, file); // Get file name - if (action.equals(ACTION_EXPORT)) { - String packageName = null; - if (uids.length == 1) - try { - ApplicationInfoEx appInfo = new ApplicationInfoEx(this, uids[0]); - packageName = appInfo.getPackageName().get(0); - } catch (Throwable ex) { - Util.bug(null, ex); - } - mFileName = getFileName(this, hasIntent, packageName); - } else - mFileName = (hasIntent ? null : getFileName(this, false, null)); + if (mFileName == null) + if (action.equals(ACTION_EXPORT)) { + String packageName = null; + if (uids.length == 1) + try { + ApplicationInfoEx appInfo = new ApplicationInfoEx(this, uids[0]); + packageName = appInfo.getPackageName().get(0); + } catch (Throwable ex) { + Util.bug(null, ex); + } + mFileName = getFileName(this, hasIntent, packageName); + } else + mFileName = (hasIntent ? null : getFileName(this, false, null)); if (mFileName == null) fileChooser();