Merge "Protect against multiple starts of device index job" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-05-14 18:31:42 +00:00
committed by Android (Google) Code Review

View File

@@ -53,10 +53,12 @@ public class DeviceIndexUpdateJobService extends JobService {
@Override @Override
public boolean onStartJob(JobParameters params) { public boolean onStartJob(JobParameters params) {
if (DEBUG) Log.d(TAG, "onStartJob"); if (DEBUG) Log.d(TAG, "onStartJob");
mRunningJob = true; if (!mRunningJob) {
Thread thread = new Thread(() -> updateIndex(params)); mRunningJob = true;
thread.setPriority(Thread.MIN_PRIORITY); Thread thread = new Thread(() -> updateIndex(params));
thread.start(); thread.setPriority(Thread.MIN_PRIORITY);
thread.start();
}
return true; return true;
} }