mirror of https://github.com/M66B/NetGuard.git
Change from cache to data dir for PCAP files
This commit is contained in:
parent
58d49780e6
commit
059a6ab7d3
|
@ -363,7 +363,7 @@ public class ActivityLog extends AppCompatActivity implements SharedPreferences.
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
// https://gist.github.com/granoeste/5574148
|
||||
File pcap_file = new File(getCacheDir(), "netguard.pcap");
|
||||
File pcap_file = new File(getDir("data", MODE_PRIVATE), "netguard.pcap");
|
||||
|
||||
boolean export = (getPackageManager().resolveActivity(getIntentPCAPDocument(), 0) != null);
|
||||
|
||||
|
@ -386,7 +386,7 @@ public class ActivityLog extends AppCompatActivity implements SharedPreferences.
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final File pcap_file = new File(getCacheDir(), "netguard.pcap");
|
||||
final File pcap_file = new File(getDir("data", MODE_PRIVATE), "netguard.pcap");
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
|
@ -563,7 +563,7 @@ public class ActivityLog extends AppCompatActivity implements SharedPreferences.
|
|||
Log.i(TAG, "Export PCAP URI=" + target);
|
||||
out = getContentResolver().openOutputStream(target);
|
||||
|
||||
File pcap = new File(getCacheDir(), "netguard.pcap");
|
||||
File pcap = new File(getDir("data", MODE_PRIVATE), "netguard.pcap");
|
||||
in = new FileInputStream(pcap);
|
||||
|
||||
int len;
|
||||
|
|
|
@ -718,7 +718,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
|||
|
||||
ServiceSinkhole.setPcap(false, this);
|
||||
|
||||
File pcap_file = new File(getCacheDir(), "netguard.pcap");
|
||||
File pcap_file = new File(getDir("data", MODE_PRIVATE), "netguard.pcap");
|
||||
if (pcap_file.exists() && !pcap_file.delete())
|
||||
Log.w(TAG, "Delete PCAP failed");
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
private native void jni_done();
|
||||
|
||||
public static void setPcap(boolean enabled, Context context) {
|
||||
File pcap = (enabled ? new File(context.getCacheDir(), "netguard.pcap") : null);
|
||||
File pcap = (enabled ? new File(context.getDir("data", MODE_PRIVATE), "netguard.pcap") : null);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String r = prefs.getString("pcap_record_size", null);
|
||||
if (TextUtils.isEmpty(r))
|
||||
|
|
Loading…
Reference in New Issue