mirror of https://github.com/M66B/NetGuard.git
Fixes
This commit is contained in:
parent
943a463782
commit
f746b2214f
|
@ -186,7 +186,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
dh = new DatabaseHelper(this);
|
||||
adapter = new RuleAdapter(dh, this);
|
||||
rvApplication.setAdapter(adapter);
|
||||
dh.addAccessChangedListener(accessChangedListener);
|
||||
|
||||
// Swipe to refresh
|
||||
TypedValue tv = new TypedValue();
|
||||
|
@ -296,6 +295,18 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
updateApplicationList(intent.getStringExtra(EXTRA_SEARCH));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
dh.addAccessChangedListener(accessChangedListener);
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
dh.removeAccessChangedListener(accessChangedListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.i(TAG, "Destroy");
|
||||
|
@ -307,7 +318,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
|
||||
running = false;
|
||||
|
||||
dh.removeAccessChangedListener(accessChangedListener);
|
||||
dh.close();
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this);
|
||||
|
|
|
@ -125,6 +125,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
db.execSQL("CREATE INDEX idx_log_uid ON log(uid)");
|
||||
}
|
||||
|
||||
// TODO add version, protocol
|
||||
private void createTableAccess(SQLiteDatabase db) {
|
||||
Log.i(TAG, "Creating access table");
|
||||
db.execSQL("CREATE TABLE access (" +
|
||||
|
|
|
@ -185,8 +185,13 @@ public class LogAdapter extends CursorAdapter {
|
|||
|
||||
tvFlags.setText(flags);
|
||||
|
||||
tvSPort.setText(sport < 0 ? "" : getKnownPort(sport));
|
||||
tvDPort.setText(dport < 0 ? "" : getKnownPort(dport));
|
||||
if (protocol == 6 || protocol == 17) {
|
||||
tvSPort.setText(sport < 0 ? "" : getKnownPort(sport));
|
||||
tvDPort.setText(dport < 0 ? "" : getKnownPort(dport));
|
||||
} else {
|
||||
tvSPort.setText(sport < 0 ? "" : Integer.toString(sport));
|
||||
tvDPort.setText(dport < 0 ? "" : Integer.toString(dport));
|
||||
}
|
||||
|
||||
// Application icon
|
||||
ApplicationInfo info = null;
|
||||
|
|
|
@ -1360,7 +1360,7 @@ void handle_ip(const struct arguments *args, const uint8_t *pkt, const size_t le
|
|||
|
||||
// http://lwn.net/Articles/443051/
|
||||
sport = ntohs(icmp->icmp_id);
|
||||
dport = 0;
|
||||
dport = ntohs(icmp->icmp_id);
|
||||
|
||||
} else if (protocol == IPPROTO_UDP) {
|
||||
struct udphdr *udp = (struct udphdr *) payload;
|
||||
|
|
Loading…
Reference in New Issue