From e745ae94bca2e0d970e4ca9125537189b17b4bb0 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 10 Jan 2016 14:26:37 +0100 Subject: [PATCH] Nobody --- .../java/eu/faircode/netguard/LogAdapter.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/LogAdapter.java b/app/src/main/java/eu/faircode/netguard/LogAdapter.java index a798c0db..b7c212ba 100644 --- a/app/src/main/java/eu/faircode/netguard/LogAdapter.java +++ b/app/src/main/java/eu/faircode/netguard/LogAdapter.java @@ -54,7 +54,7 @@ public class LogAdapter extends CursorAdapter { int protocol = (cursor.isNull(colProtocol) ? -1 : cursor.getInt(colProtocol)); int port = (cursor.isNull(colPort) ? -1 : cursor.getInt(colPort)); String flags = cursor.getString(colFlags); - final int uid = (cursor.isNull(colUid) ? -1 : cursor.getInt(colUid)); + int uid = (cursor.isNull(colUid) ? -1 : cursor.getInt(colUid)); int connection = (cursor.isNull(colConnection) ? -1 : cursor.getInt(colConnection)); int interactive = (cursor.isNull(colInteractive) ? -1 : cursor.getInt(colInteractive)); @@ -114,10 +114,19 @@ public class LogAdapter extends CursorAdapter { Picasso.with(context).load(uri).into(ivIcon); } - tvUid.setText(uid < 0 ? "" : uid == 0 ? "root" : Integer.toString(uid % 100000)); + // https://android.googlesource.com/platform/system/core/+/master/include/private/android_filesystem_config.h + uid = uid % 100000; // strip off user ID + if (uid == -1) + tvUid.setText(""); + else if (uid == 0) + tvUid.setText("root"); + else if (uid == 9999) + tvUid.setText("-"); // nobody + else + tvUid.setText(Integer.toString(uid)); // tvProtocol.setText("99"); - // tvPort.setText("65535"); + // tvPort.setText("88888"); // tvFlags.setText("+APFR"); // tvUid.setText("18888");