Commit Graph

291 Commits

Author SHA1 Message Date
emanuele-f
987839858d Fix crash on stop with no dump after 672e810 2022-01-29 11:55:21 +01:00
emanuele-f
9052bd8f5f Return the PCAPdroid version in get_status 2022-01-28 18:29:37 +01:00
emanuele-f
672e810bec Improve capture performance with PCAP dump
PCAP dump is now performed into a separate thread. This greatly reduces
the chance for packet loss in root mode as well as preventing latency
spikes in VPN mode.
2022-01-28 18:08:37 +01:00
emanuele-f
e00870b23e New dump parameters for the Intent-based API
- snaplen: limit the size of a every packet
- max_pkts_per_flow
- max_dump_size: stop the capture when the size limit is reached
2022-01-25 15:57:38 +01:00
emanuele-f
41f76486b4 Add requirePreference 2022-01-21 11:36:50 +01:00
emanuele-f
3364a4946e Fix SecurityException with PCAP file dump on Android TV
When no file manager was available, takePersistableUriPermission
was called without an Intent (and the corresponding
FLAG_GRANT_PERSISTABLE_URI_PERMISSION flag), causing a
SecurityException.

Fixes #176
2022-01-21 00:17:14 +01:00
emanuele-f
e76499d02a Add proper support for always-on VPN
The VPN can now be started by the system when the always-on VPN is
enabled. In this case, the stop button is hidden and the previous
configuration is used.

Closes #165

Null intents (e.g. due to START_STICKY) are now handled, which prevents
ForegroundServiceStartNotAllowedException in Android 12.

Fixes #175
2022-01-20 23:12:00 +01:00
emanuele-f
fcd5f34355 Improve app strings
- Remove ending periods and exclamation marks (Material guidelines)
- Improve some apps strings (credits: @comradekingu)
- Improve labels of external projects

Closes #174
2022-01-14 19:52:10 +01:00
emanuele-f
cebeb37a38 Fix CaptureCtrl crash on Android 11/12
The CaptureCtrl is only started when the PCAPdroid control API is
invoked. The crash occurred because getInsetsController was called
before setContentView.

Fixes #179
2022-01-14 12:51:19 +01:00
emanuele-f
e7bc6ba8d1 Fix tests execution 2022-01-11 00:27:00 +01:00
emanuele-f
bd2f85f876 Detect build type to customize error reporting
The error reporting dialog now shows the build type. The dialog is now
shown only on unsupported builds.

Closes #177
2022-01-10 23:23:47 +01:00
emanuele-f
9dc0e1ec83 Add redeem string 2022-01-05 17:01:38 +01:00
emanuele-f
6952e05618 Changes for the billing activity 2022-01-04 01:19:06 +01:00
emanuele-f
d35364dc69 Remove unnecessary app icon drawables copies
This reduces the memory usage when the app is in foreground
2022-01-03 00:32:54 +01:00
emanuele-f
12e4975e66 Workaround for crash in RecyclerView dispatchLayout
In some rare cases the RecyclerView dispatchLayout crashes with an IndexOutOfBoundsException. This seems a bug in the androidx library. The provided workaround should fix it.
2022-01-02 22:26:06 +01:00
emanuele-f
52af258a02 Fix bad ordering of pending updates
Swapping two pending updates with new connections could cause a crash
due to non incremental connection IDs. Also fix crash in case of full
queue.
2022-01-02 22:25:34 +01:00
emanuele-f
b08da2686f Improve connections rollover notice layout 2022-01-02 12:08:47 +01:00
emanuele-f
1ba0d8008f Improve fragments consistency while swiping
While swiping in the viewpager, the fragments onResume may haven't been
called yet. This commit initializes the status fragment before onResume and
also fixes the "No Connections" shown just briefly after the connections
fragment is shown
2022-01-02 11:36:34 +01:00
emanuele-f
ca25ca97fb Add missing synchronization in some methods 2021-12-25 12:44:17 +01:00
emanuele-f
148bfbf617 Add tests for the ConnectionsAdapter 2021-12-25 11:26:37 +01:00
emanuele-f
0c016e30e4 Improve Connections bound checks 2021-12-21 10:43:34 +01:00
emanuele-f
b8276e5233 Fix long click on chatty connections
The RecyclerView animator cancels the touch events whenever a view is
updated, which is a problem when trying to long click an active
connection to show its contextual menu.
2021-12-20 18:38:51 +01:00
emanuele-f
3fc333647b Fix whitelisted connections being blocked
The whitelist logic is now moved to the native side
2021-12-20 17:14:32 +01:00
emanuele-f
49361d05a2 Rework blocklist loading
The new ListDescriptor class now encapsulates the lists
2021-12-20 12:37:32 +01:00
emanuele-f
6846630406 Use memory-wise Android collections
These collections perform generally worse than the Java counterparts but
occupy less memory. The extra computational overhead is mainly visible
for large collections.

- SparseArray/SparseIntArray replaces HashMap
- ArraySet replaces HashSet
2021-12-15 12:26:27 +01:00
emanuele-f
43d9279467 Improve seen interfaces logic 2021-12-14 22:40:23 +01:00
emanuele-f
9140e0b236 Add ability to filter by interface in root mode
When the capture interface is set to "All Interfaces", it is now
possible to filter connections by interface. The interface is also shown
into the connection details.

Closes #163
2021-12-14 22:33:24 +01:00
emanuele-f
63a5826e80 Improve navigation on Android TV 2021-12-14 16:36:51 +01:00
emanuele-f
ef53b36f7a Make wifi hardware not mandatory
Fixes #152
2021-12-14 15:30:50 +01:00
emanuele-f
a9b90d5ff2 Fix deprecation/warning messages
Closes #151
2021-12-14 15:13:16 +01:00
emanuele-f
0d377f757e Remove the DNS server from the Stats if private
If the private DNS is used, remove the it from the Stats activity to
avoid reporting wrong information.

Closes #160
2021-12-14 12:26:57 +01:00
emanuele-f
a924ee5073 Remove symlinks and update dbip to 2021_12 2021-12-14 11:42:55 +01:00
emanuele-f
e270ee8670 Use memory-mapped file for geolocation lookups
This saves ~14 MB of RAM usage due to the loading of mmdb files
2021-12-13 19:41:17 +01:00
emanuele-f
29612b389c Small memory usage improvements
For the foreground, the Loader for the target apps dialog doesn't load
the bitmaps anymore and is destroyed once finished. Bitmaps take lots of
memory, so they should only be loaded when necessary.

For the backgroud, the AppsResolver now loads the virtual/unknown app
icons only if necessary, saving ~0.5 MB when the app is in background.
2021-12-13 18:57:03 +01:00
emanuele-f
e3ecd253ea Fix crash after 28ff23e 2021-12-08 18:33:17 +01:00
emanuele-f
41460fe9cf Add checks in startActivity/ActivityResultLauncher
This prevents crashes when no activity is found to handle the specified
Intent
2021-12-08 11:07:30 +01:00
emanuele-f
c079474917 Rename vpnproxy to pcapdroid 2021-12-06 16:29:37 +01:00
emanuele-f
f78cec5c9f Fix blocking by host not working 2021-12-03 11:58:57 +01:00
emanuele-f
62bb11b251 Improve ID comments 2021-12-02 23:20:13 +01:00
emanuele-f
cc11790f0e Implement features unlock via unlock code 2021-12-02 23:07:53 +01:00
emanuele-f
62c84f9663 Initial firewall implementation (no-root mode)
- Block connections by IP, domain or app
- Add filter to show blocked connections
- Migrate IP matching to ndpi_ptree_t API
- IPv6 addresses now supported in blacklists
- Duplicate IP address rules now only counted once
2021-11-29 22:40:35 +01:00
emanuele-f
8cf67378f5 Fix crash in Android 7
The getParameterCount is only available since API level 26. Using a
patched MaxMind-DB-Reader-java to avoid crashing.

https://developer.android.com/reference/java/lang/reflect/Method#getParameterCount()

java.lang.NoSuchMethodError: No virtual method getParameterCount()I in class Ljava/lang/reflect/Constructor; or its super classes (declaration of 'java.lang.reflect.Constructor' appears in /system/framework/core-oj.jar)
 at com.maxmind.db.Decoder.decodeMapIntoObject(Decoder.java:397)
 at com.maxmind.db.Decoder.decodeMap(Decoder.java:342)
 at com.maxmind.db.Decoder.decodeByType(Decoder.java:162)
 at com.maxmind.db.Decoder.decode(Decoder.java:151)
 at com.maxmind.db.Decoder.decode(Decoder.java:76)
 at com.maxmind.db.Reader.<init>(Reader.java:133)
 at com.maxmind.db.Reader.<init>(Reader.java:90)
 at com.emanuelef.remote_capture.Geolocation.openDb(Geolocation.java:67)
2021-11-23 22:42:08 +01:00
emanuele-f
fafd42f07f Fix bad debug version hyperlink 2021-11-23 11:20:53 +01:00
emanuele-f
2c86fc312d Restart catpure on consecutive start requests
This prevents crashes
2021-11-23 10:22:15 +01:00
emanuele-f
51474d8e12 Sort control permissions by package name
Control permissions is now only shown in the settings if any permission
is set
2021-11-22 19:56:57 +01:00
emanuele-f
b1cd5c77ae Change action name 2021-11-22 19:28:38 +01:00
emanuele-f
6c084e6d81 Add ability to receive Intent on capture stopped 2021-11-22 19:04:07 +01:00
emanuele-f
67c3c7bb99 Add CaptureCtrl status request 2021-11-22 18:19:16 +01:00
emanuele-f
00bfb81dbf Add warning in SOCKS5 mode with no app filter
Closes #143
2021-11-22 16:47:05 +01:00
emanuele-f
a61d8af4c1 Add malware detection warning with private DNS on 2021-11-22 16:15:23 +01:00