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
This commit is contained in:
@@ -105,7 +105,7 @@ final class RootScanner {
|
||||
public void run() {
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
|
||||
int pollingCount = 0;
|
||||
while (!Thread.interrupted()) {
|
||||
while (true) {
|
||||
boolean changed = false;
|
||||
|
||||
// Update devices.
|
||||
@@ -147,8 +147,7 @@ final class RootScanner {
|
||||
Thread.sleep(pollingCount > SHORT_POLLING_TIMES ?
|
||||
LONG_POLLING_INTERVAL : SHORT_POLLING_INTERVAL);
|
||||
} catch (InterruptedException exp) {
|
||||
// The while condition handles the interrupted flag.
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user