Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Fixed displaying applications with the same name once in select to al…
Browse files Browse the repository at this point in the history
…low list

Fixes #2013
  • Loading branch information
M66B committed Oct 2, 2014
1 parent 4965a11 commit 7040658
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<a name="FAQ75"></a>
**(75) Will XPrivacy work with ART?**
Expand Down
33 changes: 22 additions & 11 deletions src/biz/bokhorst/xprivacy/ActivityApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,21 @@ private class ApplicationsTask extends AsyncTask<Object, Object, Object> {
@Override
protected Object doInBackground(Object... params) {
// Get applications
Map<String, String> mapApp = new HashMap<String, String>();
int count = 0;
Map<String, List<String>> mapApp = new HashMap<String, List<String>>();
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<String> listPkg;
if (mapApp.containsKey(appName))
listPkg = mapApp.get(appName);
else {
listPkg = new ArrayList<String>();
mapApp.put(appName, listPkg);
}
listPkg.add(appInfo.getPackageName().get(p));
count++;
}

// Sort applications
List<String> listApp = new ArrayList<String>(mapApp.keySet());
Expand All @@ -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<String> 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;
}
Expand Down

0 comments on commit 7040658

Please sign in to comment.