@Test public void testOnConstraintMet_controllerInvoked() { mWorkConstraintsTracker.onConstraintMet(TEST_WORKSPEC_IDS); for (String id : TEST_WORKSPEC_IDS) { verify(mMockController).isWorkSpecConstrained(id); } }
@Override public void onConstraintMet(@NonNull List<String> workSpecIds) { List<String> unconstrainedWorkSpecIds = new ArrayList<>(); for (String workSpecId : workSpecIds) { if (areAllConstraintsMet(workSpecId)) { Log.d(TAG, String.format("Constraints met for %s", workSpecId)); unconstrainedWorkSpecIds.add(workSpecId); } } if (mCallback != null) { mCallback.onAllConstraintsMet(unconstrainedWorkSpecIds); } }
WorkConstraintsTracker implements ConstraintController.OnConstraintUpdatedCallback { @Override public void onConstraintMet(@NonNull List<String> workSpecIds) { List<String> unconstrainedWorkSpecIds = new ArrayList<>(); for (String workSpecId : workSpecIds) { if (areAllConstraintsMet(workSpecId)) { Log.d(TAG, String.format("Constraints met for %s", workSpecId)); unconstrainedWorkSpecIds.add(workSpecId); } } if (mCallback != null) { mCallback.onAllConstraintsMet(unconstrainedWorkSpecIds); } } }
WorkConstraintsTracker implements ConstraintController.OnConstraintUpdatedCallback { @Override public void onConstraintMet(@NonNull List<String> workSpecIds) { List<String> unconstrainedWorkSpecIds = new ArrayList<>(); for (String workSpecId : workSpecIds) { if (areAllConstraintsMet(workSpecId)) { Log.d(TAG, String.format("Constraints met for %s", workSpecId)); unconstrainedWorkSpecIds.add(workSpecId); } } if (mCallback != null) { mCallback.onAllConstraintsMet(unconstrainedWorkSpecIds); } } WorkConstraintsTracker(Context context, @Nullable WorkConstraintsCallback callback); @VisibleForTesting  WorkConstraintsTracker(
            @Nullable WorkConstraintsCallback callback,
            ConstraintController[] controllers); }
WorkConstraintsTracker implements ConstraintController.OnConstraintUpdatedCallback { @Override public void onConstraintMet(@NonNull List<String> workSpecIds) { List<String> unconstrainedWorkSpecIds = new ArrayList<>(); for (String workSpecId : workSpecIds) { if (areAllConstraintsMet(workSpecId)) { Log.d(TAG, String.format("Constraints met for %s", workSpecId)); unconstrainedWorkSpecIds.add(workSpecId); } } if (mCallback != null) { mCallback.onAllConstraintsMet(unconstrainedWorkSpecIds); } } WorkConstraintsTracker(Context context, @Nullable WorkConstraintsCallback callback); @VisibleForTesting  WorkConstraintsTracker(
            @Nullable WorkConstraintsCallback callback,
            ConstraintController[] controllers); void replace(@NonNull List<WorkSpec> workSpecs); void reset(); boolean areAllConstraintsMet(@NonNull String workSpecId); @Override void onConstraintMet(@NonNull List<String> workSpecIds); @Override void onConstraintNotMet(@NonNull List<String> workSpecIds); }
WorkConstraintsTracker implements ConstraintController.OnConstraintUpdatedCallback { @Override public void onConstraintMet(@NonNull List<String> workSpecIds) { List<String> unconstrainedWorkSpecIds = new ArrayList<>(); for (String workSpecId : workSpecIds) { if (areAllConstraintsMet(workSpecId)) { Log.d(TAG, String.format("Constraints met for %s", workSpecId)); unconstrainedWorkSpecIds.add(workSpecId); } } if (mCallback != null) { mCallback.onAllConstraintsMet(unconstrainedWorkSpecIds); } } WorkConstraintsTracker(Context context, @Nullable WorkConstraintsCallback callback); @VisibleForTesting  WorkConstraintsTracker(
            @Nullable WorkConstraintsCallback callback,
            ConstraintController[] controllers); void replace(@NonNull List<WorkSpec> workSpecs); void reset(); boolean areAllConstraintsMet(@NonNull String workSpecId); @Override void onConstraintMet(@NonNull List<String> workSpecIds); @Override void onConstraintNotMet(@NonNull List<String> workSpecIds);  }