mirror of https://github.com/M66B/NetGuard.git
Show number of domains for IP address
This commit is contained in:
parent
74793484b4
commit
90875c5805
|
@ -53,6 +53,7 @@ public class AdapterAccess extends CursorAdapter {
|
||||||
private int colTime;
|
private int colTime;
|
||||||
private int colAllowed;
|
private int colAllowed;
|
||||||
private int colBlock;
|
private int colBlock;
|
||||||
|
private int colCount;
|
||||||
private int colSent;
|
private int colSent;
|
||||||
private int colReceived;
|
private int colReceived;
|
||||||
private int colConnections;
|
private int colConnections;
|
||||||
|
@ -71,6 +72,7 @@ public class AdapterAccess extends CursorAdapter {
|
||||||
colTime = cursor.getColumnIndex("time");
|
colTime = cursor.getColumnIndex("time");
|
||||||
colAllowed = cursor.getColumnIndex("allowed");
|
colAllowed = cursor.getColumnIndex("allowed");
|
||||||
colBlock = cursor.getColumnIndex("block");
|
colBlock = cursor.getColumnIndex("block");
|
||||||
|
colCount = cursor.getColumnIndex("count");
|
||||||
colSent = cursor.getColumnIndex("sent");
|
colSent = cursor.getColumnIndex("sent");
|
||||||
colReceived = cursor.getColumnIndex("received");
|
colReceived = cursor.getColumnIndex("received");
|
||||||
colConnections = cursor.getColumnIndex("connections");
|
colConnections = cursor.getColumnIndex("connections");
|
||||||
|
@ -105,6 +107,7 @@ public class AdapterAccess extends CursorAdapter {
|
||||||
long time = cursor.getLong(colTime);
|
long time = cursor.getLong(colTime);
|
||||||
int allowed = cursor.getInt(colAllowed);
|
int allowed = cursor.getInt(colAllowed);
|
||||||
int block = cursor.getInt(colBlock);
|
int block = cursor.getInt(colBlock);
|
||||||
|
int count = cursor.getInt(colCount);
|
||||||
long sent = cursor.isNull(colSent) ? -1 : cursor.getLong(colSent);
|
long sent = cursor.isNull(colSent) ? -1 : cursor.getLong(colSent);
|
||||||
long received = cursor.isNull(colReceived) ? -1 : cursor.getLong(colReceived);
|
long received = cursor.isNull(colReceived) ? -1 : cursor.getLong(colReceived);
|
||||||
int connections = cursor.isNull(colConnections) ? -1 : cursor.getInt(colConnections);
|
int connections = cursor.isNull(colConnections) ? -1 : cursor.getInt(colConnections);
|
||||||
|
@ -130,7 +133,7 @@ public class AdapterAccess extends CursorAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
String dest = Util.getProtocolName(protocol, version, true) +
|
String dest = Util.getProtocolName(protocol, version, true) +
|
||||||
" " + daddr + (dport > 0 ? "/" + dport : "");
|
" " + daddr + (dport > 0 ? "/" + dport : "") + (count > 1 ? " ?" + count : "");
|
||||||
SpannableString span = new SpannableString(dest);
|
SpannableString span = new SpannableString(dest);
|
||||||
span.setSpan(new UnderlineSpan(), 0, dest.length(), 0);
|
span.setSpan(new UnderlineSpan(), 0, dest.length(), 0);
|
||||||
tvDest.setText(span);
|
tvDest.setText(span);
|
||||||
|
|
|
@ -679,10 +679,11 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||||
SQLiteDatabase db = this.getReadableDatabase();
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
// There is a segmented index on uid
|
// There is a segmented index on uid
|
||||||
// There is no index on time for write performance
|
// There is no index on time for write performance
|
||||||
String query = "SELECT ID AS _id, *";
|
String query = "SELECT a.ID AS _id, a.*";
|
||||||
query += " FROM access";
|
query += ", (SELECT COUNT(*) FROM dns d WHERE d.resource = (SELECT d1.resource FROM dns d1 WHERE d1.qname = a.daddr)) count";
|
||||||
query += " WHERE uid = ?";
|
query += " FROM access a";
|
||||||
query += " ORDER BY time DESC";
|
query += " WHERE a.uid = ?";
|
||||||
|
query += " ORDER BY a.time DESC";
|
||||||
query += " LIMIT 50";
|
query += " LIMIT 50";
|
||||||
return db.rawQuery(query, new String[]{Integer.toString(uid)});
|
return db.rawQuery(query, new String[]{Integer.toString(uid)});
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue