0
0
mirror of https://github.com/schwabe/ics-openvpn.git synced 2024-09-20 20:03:13 +02:00

Fine tune for next release, remove debug message, ignore apps with system id

--HG--
extra : rebase_source : b9f8135b8b98cb501f7ad548e22ae40b931b8de9
This commit is contained in:
Arne Schwabe 2014-12-01 00:51:09 +01:00
parent c1059af0bc
commit 3a6855aff9
3 changed files with 26 additions and 10 deletions

View File

@ -267,8 +267,8 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
registerReceiver(mDeviceStateReceiver, filter);
VpnStatus.addByteCountListener(mDeviceStateReceiver);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
addLollipopCMListener();
/*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
addLollipopCMListener(); */
}
synchronized void unregisterDeviceStateReceiver() {
@ -284,8 +284,8 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
}
mDeviceStateReceiver = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
removeLollipopCMListener();
/*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
removeLollipopCMListener();*/
}

View File

@ -80,11 +80,10 @@ public class Settings_Allowed_Apps extends Fragment implements AdapterView.OnIte
}
static class PackageAdapter extends BaseAdapter {
class PackageAdapter extends BaseAdapter {
private final List<ApplicationInfo> mPackages;
private final LayoutInflater mInflater;
private final PackageManager mPm;
private final VpnProfile mProfile;
PackageAdapter(Context c, VpnProfile vp) {
mPm = c.getPackageManager();
@ -94,13 +93,30 @@ public class Settings_Allowed_Apps extends Fragment implements AdapterView.OnIte
// Remove apps not using Internet
int androidSystemUid=0;
ApplicationInfo system = null;
Vector<ApplicationInfo> apps= new Vector<ApplicationInfo>();
for (ApplicationInfo app:installedPackages) {
if (mPm.checkPermission(Manifest.permission.INTERNET, app.packageName) == PackageManager.PERMISSION_GRANTED)
apps.add(app);
try {
system = mPm.getApplicationInfo("android", PackageManager.GET_META_DATA);
androidSystemUid = system.uid;
apps.add(system);
} catch (PackageManager.NameNotFoundException e) {
}
for (ApplicationInfo app:installedPackages) {
if (mPm.checkPermission(Manifest.permission.INTERNET, app.packageName) == PackageManager.PERMISSION_GRANTED &&
app.uid != androidSystemUid) {
apps.add(app);
}
}
Collections.sort(apps, new ApplicationInfo.DisplayNameComparator(mPm));
mPackages=apps;

View File

@ -74,6 +74,6 @@
</LinearLayout>
<include layout="@layout/profile_list_fabs" />
<!-- <include layout="@layout/profile_list_fabs" /> -->
</FrameLayout>