@Test @SmallTest public void testStartWork_doesNotStartWorkTwice() { OneTimeWorkRequest work = new OneTimeWorkRequest.Builder(InfiniteTestWorker.class).build(); String id = work.getStringId(); insertWork(work); assertThat(mProcessor.startWork(id), is(true)); assertThat(mProcessor.startWork(id), is(false)); }
public synchronized boolean startWork(String id) { return startWork(id, null); }
Processor implements ExecutionListener { public synchronized boolean startWork(String id) { return startWork(id, null); } }
Processor implements ExecutionListener { public synchronized boolean startWork(String id) { return startWork(id, null); } Processor(
            Context appContext,
            Configuration configuration,
            WorkDatabase workDatabase,
            List<Scheduler> schedulers,
            Executor executor); }
Processor implements ExecutionListener { public synchronized boolean startWork(String id) { return startWork(id, null); } Processor(
            Context appContext,
            Configuration configuration,
            WorkDatabase workDatabase,
            List<Scheduler> schedulers,
            Executor executor); synchronized boolean startWork(String id); synchronized boolean startWork(String id, Extras.RuntimeExtras runtimeExtras); synchronized boolean stopWork(String id); synchronized boolean stopAndCancelWork(String id); synchronized boolean isCancelled(String id); synchronized boolean hasWork(); synchronized boolean isEnqueued(@NonNull String workSpecId); synchronized void addExecutionListener(ExecutionListener executionListener); synchronized void removeExecutionListener(ExecutionListener executionListener); @Override synchronized void onExecuted(
            @NonNull String workSpecId,
            boolean isSuccessful,
            boolean needsReschedule); }
Processor implements ExecutionListener { public synchronized boolean startWork(String id) { return startWork(id, null); } Processor(
            Context appContext,
            Configuration configuration,
            WorkDatabase workDatabase,
            List<Scheduler> schedulers,
            Executor executor); synchronized boolean startWork(String id); synchronized boolean startWork(String id, Extras.RuntimeExtras runtimeExtras); synchronized boolean stopWork(String id); synchronized boolean stopAndCancelWork(String id); synchronized boolean isCancelled(String id); synchronized boolean hasWork(); synchronized boolean isEnqueued(@NonNull String workSpecId); synchronized void addExecutionListener(ExecutionListener executionListener); synchronized void removeExecutionListener(ExecutionListener executionListener); @Override synchronized void onExecuted(
            @NonNull String workSpecId,
            boolean isSuccessful,
            boolean needsReschedule);  }