'Enqueued unique work with different input data with APPTND_OR_REPLACE but in worker resulted in same as what passed the first request

Component used:androidx.work/WorkManager
(androidx.work:work-runtime)
Version used:2.7.1
Devices/Android versions reproduced on: Android 10

I have enqueued many OneTimeUniqueWorkRequest with different InputData, with ExistingWorkPolicy.APPEND_OR_REPLACE.
But when every work run, in doWork(), I got similiar inputdata, which is from the first work request i enqueued.

But if I change ExistingWorkPolicy.APPEND_OR_REPLACE to ExistingWorkPolicy.REPLACE, it works well.
However I need ExistingWorkPolicy.APPEND_OR_REPLACE to make it a linear workrequest queue.

Should this be happend? How can I avoid this?

Edited:

For my poor english, here I provide a example to clearifier the question.

  1. I enqueued request 1 with a unique work name with input data A
  2. Request 1 finished successfully as expected
  3. I enqueued request 2 with same unique work name with input data B
  4. Request 2 started successfully but got input data A but not B.

Both of these work request are enqueued with code like following code:

OneTimeWorkRequest work = new OneTimeWorkRequest.Builder(SendingWorker.class)
       .setInputData(genSendingInputData("A"))
       .setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST)
       .build();
WorkManager.getInstance(mContext).enqueueUniqueWork("SEND", ExistingWorkPolicy.APPEND_OR_REPLACE, work);```


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source