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

Commit 2bdb388d authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Break while loop when the thread interuppted.

Previously the while loop condition refers to Thread.interrupted()
wrongly. The Thread.interrupted() flag is cleared when the
InterupptedException is thrown.

BUG=26297698

Change-Id: I113d5c88389d54a4a6e29af2cf9515b1693b59dc
parent 9dcbdcd5
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -105,7 +105,7 @@ final class RootScanner {
        public void run() {
        public void run() {
            Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
            Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
            int pollingCount = 0;
            int pollingCount = 0;
            while (!Thread.interrupted()) {
            while (true) {
                boolean changed = false;
                boolean changed = false;


                // Update devices.
                // Update devices.
@@ -147,8 +147,7 @@ final class RootScanner {
                    Thread.sleep(pollingCount > SHORT_POLLING_TIMES ?
                    Thread.sleep(pollingCount > SHORT_POLLING_TIMES ?
                        LONG_POLLING_INTERVAL : SHORT_POLLING_INTERVAL);
                        LONG_POLLING_INTERVAL : SHORT_POLLING_INTERVAL);
                } catch (InterruptedException exp) {
                } catch (InterruptedException exp) {
                    // The while condition handles the interrupted flag.
                    break;
                    continue;
                }
                }
            }
            }
        }
        }