1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-01-01 12:54:07 +00:00

Revert "Remove open file percentage"

This reverts commit 2181221a79.
This commit is contained in:
M66B 2016-02-11 10:13:10 +01:00
parent 24892ed67d
commit 9f07fdb39a
2 changed files with 29 additions and 0 deletions

View file

@ -637,6 +637,25 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
if (filter && loglevel <= Log.WARN) {
int[] count = jni_get_session_count();
remoteViews.setTextViewText(R.id.tvSessions, count[0] + "/" + count[1] + "/" + count[2]);
File proc = new File("/proc/sys/fs/file-nr");
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(proc));
String line = br.readLine();
String[] filenr = line.split("\\s+");
if (filenr.length == 3) {
int perc = Integer.parseInt(filenr[0]) * 100 / Integer.parseInt(filenr[2]);
remoteViews.setTextViewText(R.id.tvFiles, perc + "%");
}
} catch (Throwable ignored) {
} finally {
if (br != null)
try {
br.close();
} catch (IOException ignored) {
}
}
}
// Show notification

View file

@ -68,6 +68,16 @@
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
android:textSize="10sp" />
<TextView
android:id="@+id/tvFiles"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
android:textSize="10sp" />
<ImageView
android:id="@+id/ivTraffic"
android:layout_width="match_parent"