Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf7a07d0 authored by Misha Wagner's avatar Misha Wagner
Browse files

Reduce amount of logging on failed proc file reading

We expect some proc file reading to fail when processes or threads
finish execution while we traverse their proc files. We should not
pollute logs when this traversal fails.

Test: Inspected `adb logcat`
Change-Id: Id811a1e6b5084a8a3a903a892a99e317d1e3ac7f
parent c6c85691
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ public class KernelCpuThreadReader {
                }
            }
        } catch (IOException e) {
            Slog.w(TAG, "Failed to iterate over thread paths", e);
            // Expected when a process finishes
            return null;
        }

+5 −1
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import java.io.IOException;
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PROTECTED)
public final class ProcStatsUtil {

    private static final boolean DEBUG = false;

    private static final String TAG = "ProcStatsUtil";

    /**
@@ -141,7 +143,9 @@ public final class ProcStatsUtil {
            }
            return byteStream.toString();
        } catch (IOException e) {
            Slog.w(TAG, "Failed to open proc file", e);
            if (DEBUG) {
                Slog.d(TAG, "Failed to open proc file", e);
            }
            return null;
        } finally {
            StrictMode.setThreadPolicy(savedPolicy);