diff options
author | Arne Schwabe <arne@rfc2549.org> | 2014-11-19 00:21:18 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2014-11-19 00:21:18 +0100 |
commit | ea90e689585a364efa191f183c740d048e0a2018 (patch) | |
tree | 1d5dd23c28f8906a7370dc7f3419d197cad46f7f /main/src | |
parent | 973be51139b6725c1a5b68d1a0ea8d062747c415 (diff) |
Only list apps with INTERNET permission in app list.
--HG--
extra : rebase_source : 016a9c0cf440b66ccbd311dca4e3dc937ed40730
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java index ed6e9c7c..bfba0ed6 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java @@ -5,6 +5,7 @@ package de.blinkt.openvpn.fragments; +import android.Manifest; import android.app.Fragment; import android.content.Context; import android.content.pm.ApplicationInfo; @@ -24,7 +25,9 @@ import android.widget.Switch; import android.widget.TextView; import java.util.Collections; +import java.util.LinkedList; import java.util.List; +import java.util.Vector; import de.blinkt.openvpn.R; import de.blinkt.openvpn.VpnProfile; @@ -81,10 +84,20 @@ public class Settings_Allowed_Apps extends Fragment { PackageAdapter(Context c, VpnProfile vp) { mPm = c.getPackageManager(); mProfile = vp; - mPackages = mPm.getInstalledApplications(PackageManager.GET_META_DATA); + List<ApplicationInfo> installedPackages = mPm.getInstalledApplications(PackageManager.GET_META_DATA); mInflater = LayoutInflater.from(c); - Collections.sort(mPackages, new ApplicationInfo.DisplayNameComparator(mPm)); + // Remove apps not using Internet + + Vector<ApplicationInfo> apps= new Vector<ApplicationInfo>(); + for (ApplicationInfo app:installedPackages) { + if (mPm.checkPermission(Manifest.permission.INTERNET, app.packageName) == PackageManager.PERMISSION_GRANTED) + apps.add(app); + } + + + Collections.sort(apps, new ApplicationInfo.DisplayNameComparator(mPm)); + mPackages=apps; } @Override |