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

Commit 53a00167 authored by Ethan Lee's avatar Ethan Lee Committed by Android (Google) Code Review
Browse files

Merge "Don't throw exception on empty line in CPUs file." into udc-qpr-dev

parents aff08d10 fe20e634
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -593,9 +593,12 @@ public final class CpuInfoReader {
            List<String> lines = Files.readAllLines(file.toPath());
            IntArray cpuCores = new IntArray(0);
            for (int i = 0; i < lines.size(); i++) {
                String line = lines.get(i);
                String[] pairs = line.contains(",") ? line.trim().split(",")
                        : line.trim().split(" ");
                String line = lines.get(i).trim();
                if (line.isEmpty()) {
                    continue;
                }
                String[] pairs = line.contains(",") ? line.split(",")
                        : line.split(" ");
                for (int j = 0; j < pairs.length; j++) {
                    String[] minMaxPairs = pairs[j].split("-");
                    if (minMaxPairs.length >= 2) {
@@ -615,6 +618,9 @@ public final class CpuInfoReader {
                }
            }
            return cpuCores;
        } catch (NumberFormatException e) {
            Slogf.e(TAG, e, "Failed to read CPU cores from %s due to incorrect file format",
                    file.getAbsolutePath());
        } catch (Exception e) {
            Slogf.e(TAG, e, "Failed to read CPU cores from %s", file.getAbsolutePath());
        }
+1 −0
Original line number Diff line number Diff line
+1 −0
Original line number Diff line number Diff line
0
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
1230000
+1 −0
Original line number Diff line number Diff line
2500000
Loading