diff --git a/CHANGELOG.md b/CHANGELOG.md index 015f26b15..ede8e8be0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ See for more information about XPrivacy 3 [this FAQ](https://github.com/M66B/XPr **Next release** +* Fixed displaying applications with the same name once in select to allow list ([issue](/../../issues/2013)) + [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) **Version 3.3.2 BETA** diff --git a/README.md b/README.md index ad53c8d3e..742a1d4bc 100644 --- a/README.md +++ b/README.md @@ -1229,7 +1229,6 @@ By default system applications and applications without permissions for the sele Some applications (components) share data, which mean they share the same uid. These applications are shown once only in XPrivacy (this cannot be changed). An example is Dolphin browser and its plugins/addons. -Another example is GoLauncherEx and its language packs. **(75) Will XPrivacy work with ART?** diff --git a/src/biz/bokhorst/xprivacy/ActivityApp.java b/src/biz/bokhorst/xprivacy/ActivityApp.java index d047947f6..8a93fd3f0 100644 --- a/src/biz/bokhorst/xprivacy/ActivityApp.java +++ b/src/biz/bokhorst/xprivacy/ActivityApp.java @@ -828,10 +828,21 @@ private class ApplicationsTask extends AsyncTask { @Override protected Object doInBackground(Object... params) { // Get applications - Map mapApp = new HashMap(); + int count = 0; + Map> mapApp = new HashMap>(); for (ApplicationInfoEx appInfo : ApplicationInfoEx.getXApplicationList(ActivityApp.this, null)) - for (int p = 0; p < appInfo.getPackageName().size(); p++) - mapApp.put(appInfo.getApplicationName().get(p), appInfo.getPackageName().get(p)); + for (int p = 0; p < appInfo.getPackageName().size(); p++) { + String appName = appInfo.getApplicationName().get(p); + List listPkg; + if (mapApp.containsKey(appName)) + listPkg = mapApp.get(appName); + else { + listPkg = new ArrayList(); + mapApp.put(appName, listPkg); + } + listPkg.add(appInfo.getPackageName().get(p)); + count++; + } // Sort applications List listApp = new ArrayList(mapApp.keySet()); @@ -840,20 +851,20 @@ protected Object doInBackground(Object... params) { // Build selection arrays int i = 0; - mApp = new CharSequence[mapApp.size()]; - mPackage = new String[mapApp.size()]; - mSelection = new boolean[mapApp.size()]; - for (String appName : listApp) - try { - String pkgName = mapApp.get(appName); + mApp = new CharSequence[count]; + mPackage = new String[count]; + mSelection = new boolean[count]; + for (String appName : listApp) { + List listPkg = mapApp.get(appName); + Collections.sort(listPkg, collator); + for (String pkgName : listPkg) { mApp[i] = (pkgName.equals(appName) ? appName : String.format("%s (%s)", appName, pkgName)); mPackage[i] = pkgName; mSelection[i] = PrivacyManager.getSettingBool(-mAppInfo.getUid(), Meta.cTypeApplication, pkgName, false); i++; - } catch (Throwable ex) { - Util.bug(null, ex); } + } return null; }