expo-task-manager 58.0.12 → 58.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/AndroidManifest.xml +2 -0
  4. package/android/src/main/java/expo/modules/taskmanager/TaskManagerUtils.java +14 -10
  5. package/android/src/main/java/expo/modules/taskmanager/TaskService.java +14 -1
  6. package/build/TaskManager.js +6 -4
  7. package/build/TaskManager.js.map +1 -1
  8. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/{58.0.12/expo.modules.taskmanager-58.0.12-sources.jar → 58.0.14/expo.modules.taskmanager-58.0.14-sources.jar} +0 -0
  9. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14-sources.jar.md5 +1 -0
  10. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14-sources.jar.sha1 +1 -0
  11. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14-sources.jar.sha256 +1 -0
  12. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14-sources.jar.sha512 +1 -0
  13. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.aar +0 -0
  14. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.aar.md5 +1 -0
  15. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.aar.sha1 +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.aar.sha256 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.aar.sha512 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/{58.0.12/expo.modules.taskmanager-58.0.12.module → 58.0.14/expo.modules.taskmanager-58.0.14.module} +22 -22
  19. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.module.md5 +1 -0
  20. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.module.sha1 +1 -0
  21. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.module.sha256 +1 -0
  22. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.module.sha512 +1 -0
  23. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/{58.0.12/expo.modules.taskmanager-58.0.12.pom → 58.0.14/expo.modules.taskmanager-58.0.14.pom} +1 -1
  24. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.pom.md5 +1 -0
  25. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.pom.sha1 +1 -0
  26. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.pom.sha256 +1 -0
  27. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.14/expo.modules.taskmanager-58.0.14.pom.sha512 +1 -0
  28. package/package.json +3 -3
  29. package/src/TaskManager.ts +6 -4
  30. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12-sources.jar.md5 +0 -1
  31. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12-sources.jar.sha1 +0 -1
  32. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12-sources.jar.sha256 +0 -1
  33. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12-sources.jar.sha512 +0 -1
  34. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.aar +0 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.aar.md5 +0 -1
  36. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.aar.sha1 +0 -1
  37. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.aar.sha256 +0 -1
  38. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.aar.sha512 +0 -1
  39. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.module.md5 +0 -1
  40. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.module.sha1 +0 -1
  41. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.module.sha256 +0 -1
  42. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.module.sha512 +0 -1
  43. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.pom.md5 +0 -1
  44. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.pom.sha1 +0 -1
  45. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.pom.sha256 +0 -1
  46. package/local-maven-repo/host/exp/exponent/expo.modules.taskmanager/58.0.12/expo.modules.taskmanager-58.0.12.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 58.0.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [Android] Fix JS timers, and anything built on them such as `fetch()`, hanging in background tasks on React Native 0.86 and later. The headless task that keeps timers alive no longer finishes as soon as it starts. ([#53102](https://github.com/expo/expo/pull/53102) by [@chrfalch](https://github.com/chrfalch))
8
+
9
+ ## 58.0.13
10
+
11
+ ### Patch Changes
12
+
13
+ - [Android] Fix an issue where scheduling a job would fail when `RECEIVE_BOOT_COMPLETED` is not in the app manifest, which led to crashes in the background. Add `RECEIVE_BOOT_COMPLETED` permission to the manifest, set job persistence based on whether this permission is in the manifest. ([#51701](https://github.com/expo/expo/pull/51701) by [@HubertBer](https://github.com/HubertBer))
14
+
3
15
  ## 58.0.12
4
16
 
5
17
  ### Patch Changes
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '58.0.12'
7
+ version = '58.0.14'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.taskmanager"
11
11
  defaultConfig {
12
12
  versionCode 23
13
- versionName "58.0.12"
13
+ versionName "58.0.14"
14
14
  consumerProguardFiles 'proguard-rules.pro'
15
15
  }
16
16
  }
@@ -1,4 +1,6 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
3
+
2
4
  <application>
3
5
  <receiver
4
6
  android:name="expo.modules.taskmanager.TaskBroadcastReceiver"
@@ -1,5 +1,6 @@
1
1
  package expo.modules.taskmanager;
2
2
 
3
+ import android.Manifest;
3
4
  import android.app.PendingIntent;
4
5
  import android.app.job.JobInfo;
5
6
  import android.app.job.JobParameters;
@@ -7,6 +8,7 @@ import android.app.job.JobScheduler;
7
8
  import android.content.ComponentName;
8
9
  import android.content.Context;
9
10
  import android.content.Intent;
11
+ import android.content.pm.PackageManager;
10
12
  import android.net.Uri;
11
13
  import android.os.Build;
12
14
  import android.os.Bundle;
@@ -20,6 +22,7 @@ import java.util.Map;
20
22
 
21
23
  import androidx.annotation.NonNull;
22
24
  import androidx.annotation.Nullable;
25
+ import androidx.core.content.ContextCompat;
23
26
 
24
27
  import expo.modules.interfaces.taskManager.TaskExecutionCallback;
25
28
  import expo.modules.interfaces.taskManager.TaskInterface;
@@ -107,6 +110,7 @@ public class TaskManagerUtils implements TaskManagerUtilsInterface {
107
110
 
108
111
  private void updateOrScheduleJob(Context context, TaskInterface task, List<PersistableBundle> data) {
109
112
  JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
113
+ boolean canPersistJobs = ContextCompat.checkSelfPermission(context, Manifest.permission.RECEIVE_BOOT_COMPLETED) == PackageManager.PERMISSION_GRANTED;
110
114
 
111
115
  if (jobScheduler == null) {
112
116
  Log.e(this.getClass().getName(), "Job scheduler not found!");
@@ -140,10 +144,10 @@ public class TaskManagerUtils implements TaskManagerUtilsInterface {
140
144
  if (pendingJobs.size() >= getJobLimit() - JOB_LIMIT_BUFFER && newestJob != null) {
141
145
  Log.i(TAG, "Approaching job limit (" + pendingJobs.size() + "). Merging data for task '" + task.getName() + "'.");
142
146
  try {
143
- JobInfo mergedJobInfo = createJobInfoByAddingData(newestJob, data);
147
+ JobInfo mergedJobInfo = createJobInfoByAddingData(newestJob, data, canPersistJobs);
144
148
  jobScheduler.cancel(newestJob.getId());
145
149
  jobScheduler.schedule(mergedJobInfo);
146
- } catch (IllegalStateException e) {
150
+ } catch (IllegalArgumentException | IllegalStateException e) {
147
151
  Log.e(this.getClass().getName(), "Unable to merge job: " + e.getMessage());
148
152
  }
149
153
  return;
@@ -151,14 +155,14 @@ public class TaskManagerUtils implements TaskManagerUtilsInterface {
151
155
 
152
156
  // Under limit: schedule as new job. Don't touch existing jobs.
153
157
  try {
154
- JobInfo jobInfo = createJobInfo(context, task, newJobId, data);
158
+ JobInfo jobInfo = createJobInfo(context, task, newJobId, data, canPersistJobs);
155
159
  jobScheduler.schedule(jobInfo);
156
- } catch (IllegalStateException e) {
160
+ } catch (IllegalArgumentException | IllegalStateException e) {
157
161
  Log.e(this.getClass().getName(), "Unable to schedule job: " + e.getMessage());
158
162
  }
159
163
  }
160
164
 
161
- private JobInfo createJobInfoByAddingData(JobInfo jobInfo, List<PersistableBundle> data) {
165
+ private JobInfo createJobInfoByAddingData(JobInfo jobInfo, List<PersistableBundle> data, boolean persisted) {
162
166
  PersistableBundle mergedExtras = jobInfo.getExtras();
163
167
  int dataSize = mergedExtras.getInt("dataSize", 0);
164
168
 
@@ -169,7 +173,7 @@ public class TaskManagerUtils implements TaskManagerUtilsInterface {
169
173
  mergedExtras.putPersistableBundle(String.valueOf(dataSize + i), data.get(i));
170
174
  }
171
175
  }
172
- return createJobInfo(jobInfo.getId(), jobInfo.getService(), mergedExtras);
176
+ return createJobInfo(jobInfo.getId(), jobInfo.getService(), mergedExtras, persisted);
173
177
  }
174
178
 
175
179
  private PendingIntent createTaskIntent(Context context, String appScopeKey, String taskName, int flags) {
@@ -199,10 +203,10 @@ public class TaskManagerUtils implements TaskManagerUtilsInterface {
199
203
  return createTaskIntent(context, appScopeKey, taskName, flags);
200
204
  }
201
205
 
202
- private JobInfo createJobInfo(int jobId, ComponentName jobService, PersistableBundle extras) {
206
+ private JobInfo createJobInfo(int jobId, ComponentName jobService, PersistableBundle extras, boolean persisted) {
203
207
  JobInfo.Builder jobBuilder = new JobInfo.Builder(jobId, jobService)
204
208
  .setExtras(extras)
205
- .setPersisted(true)
209
+ .setPersisted(persisted)
206
210
  .setRequiresDeviceIdle(false);
207
211
 
208
212
  if (Build.VERSION.SDK_INT < 28) {
@@ -221,8 +225,8 @@ public class TaskManagerUtils implements TaskManagerUtilsInterface {
221
225
  return jobBuilder.build();
222
226
  }
223
227
 
224
- private JobInfo createJobInfo(Context context, TaskInterface task, int jobId, List<PersistableBundle> data) {
225
- return createJobInfo(jobId, new ComponentName(context, TaskJobService.class), createExtrasForTask(task, data));
228
+ private JobInfo createJobInfo(Context context, TaskInterface task, int jobId, List<PersistableBundle> data, boolean persisted) {
229
+ return createJobInfo(jobId, new ComponentName(context, TaskJobService.class), createExtrasForTask(task, data), persisted);
226
230
  }
227
231
 
228
232
  private PersistableBundle createExtrasForTask(TaskInterface task, List<PersistableBundle> data) {
@@ -58,6 +58,9 @@ public class TaskService implements SingletonModule, TaskServiceInterface {
58
58
  private static final String TAG = "TaskService";
59
59
  private static final String SHARED_PREFERENCES_NAME = "TaskManagerModule";
60
60
  private static final int MAX_TASK_EXECUTION_TIME_MS = 15000; // 15 seconds
61
+ // Upper bound for the headless task that keeps JS timers alive, in case no finish path runs.
62
+ // Matches the 10 minutes JobScheduler gives a job.
63
+ private static final long HEADLESS_TASK_TIMEOUT_MS = 10 * 60 * 1000;
61
64
 
62
65
  private WeakReference<Context> mContextRef;
63
66
  private TaskManagerUtilsInterface mTaskManagerUtils;
@@ -431,6 +434,7 @@ public class TaskService implements SingletonModule, TaskServiceInterface {
431
434
  success -> {
432
435
  if (!success) {
433
436
  sEvents.remove(appScopeKey);
437
+ maybeFinishHeadlessTask(appScopeKey);
434
438
  mTasksAndEventsRepository.removeEvents(appScopeKey);
435
439
 
436
440
  // Host unreachable? Unregister all tasks for that app.
@@ -651,11 +655,20 @@ public class TaskService implements SingletonModule, TaskServiceInterface {
651
655
  HeadlessJsTaskConfig taskConfig = new HeadlessJsTaskConfig(
652
656
  "expo-task-manager",
653
657
  new WritableNativeMap(),
654
- 0, // no timeout, managed by the task consumer
658
+ HEADLESS_TASK_TIMEOUT_MS, // finished by maybeFinishHeadlessTask, the timeout is a safety net
655
659
  true // allow in foreground to avoid exceptions if app returns
656
660
  );
657
661
 
658
662
  UiThreadUtil.runOnUiThread(() -> {
663
+ // The events may be done already, e.g. when the cold-start listener fires late.
664
+ if (!sEvents.containsKey(appScopeKey)) {
665
+ return;
666
+ }
667
+ // Don't replace a keepalive that is still running, its ID would never be finished.
668
+ Integer runningTaskId = sHeadlessTaskIds.get(appScopeKey);
669
+ if (runningTaskId != null && headlessContext.isTaskRunning(runningTaskId)) {
670
+ return;
671
+ }
659
672
  try {
660
673
  int taskId = headlessContext.startTask(taskConfig);
661
674
  sHeadlessTaskIds.put(appScopeKey, taskId);
@@ -2,11 +2,13 @@ import { Platform, UnavailabilityError } from 'expo';
2
2
  import { LegacyEventEmitter } from 'expo-modules-core';
3
3
  import { AppRegistry } from 'react-native';
4
4
  import ExpoTaskManager from './ExpoTaskManager';
5
- // Register a no-op headless task so that HeadlessJsTaskContext.startTask()
6
- // doesn't log a warning. On Android, TaskService registers a headless task
7
- // in native code to keep JS timers alive during background task execution.
5
+ // On Android, TaskService starts this headless task in native code to keep JS timers
6
+ // alive during background task execution, and finishes it natively once the task is done
7
+ // (or after a timeout).
8
+ // The JS side must never settle: a resolved promise makes AppRegistry call
9
+ // notifyTaskFinished, which ends the task right away and pauses timers again.
8
10
  if (Platform.OS === 'android') {
9
- AppRegistry.registerHeadlessTask('expo-task-manager', ()=>async ()=>{});
11
+ AppRegistry.registerHeadlessTask('expo-task-manager', ()=>()=>new Promise(()=>{}));
10
12
  }
11
13
  const tasks = new Map();
12
14
  function _validate(taskName) {
@@ -1 +1 @@
1
- {"version":3,"sources":["TaskManager.ts"],"sourcesContent":[null],"names":["Platform","UnavailabilityError","LegacyEventEmitter","AppRegistry","ExpoTaskManager","OS","registerHeadlessTask","tasks","Map","_validate","taskName","TypeError","hasFinishedInitPhase","Promise","resolve","then","defineTask","taskExecutor","console","warn","has","set","isTaskDefined","isTaskRegisteredAsync","getTaskOptionsAsync","getRegisteredTasksAsync","unregisterTaskAsync","unregisterAllTasksAsync","eventEmitter","addListener","EVENT_NAME","data","error","executionInfo","eventId","get","result","notifyTaskFinishedAsync","keys","join","isAvailableAsync"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,mBAAmB,QAAQ,OAAO;AACrD,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAOC,qBAAqB,oBAAoB;AAEhD,2EAA2E;A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SAAS,CAAC,EAAEsB;YAC3D,SAAU;gBACR,uCAAuC;gBACvC,MAAM5B,gBAAgBiC,uBAAuB,CAAC3B,UAAU;oBAAEwB;oBAASE;gBAAO;YAC5E;QACF,OAAO;YACLlB,QAAQC,IAAI,CACV,CAAC,2BAA2B,EAAET,SAAS,oEAAoE,EAAE;mBAAIH,MAAM+B,IAAI;aAAG,CAACC,IAAI,CAAC,MAAM,iFAAiF,CAAC;YAE9N,6DAA6D;YAC7D,MAAMnC,gBAAgBiC,uBAAuB,CAAC3B,UAAU;gBAAEwB;gBAASE;YAAO;YAC1E,yFAAyF;YACzF,mGAAmG;YACnG,MAAMhC,gBAAgBsB,mBAAmB,CAAChB;QAC5C;IACF;AAEJ;AAEA,cAAc;AACd;;;;;;CAMC,GACD,OAAO,eAAe8B;IACpB,OAAOpC,gBAAgBoC,gBAAgB;AACzC"}
1
+ {"version":3,"sources":["TaskManager.ts"],"sourcesContent":[null],"names":["Platform","UnavailabilityError","LegacyEventEmitter","AppRegistry","ExpoTaskManager","OS","registerHeadlessTask","Promise","tasks","Map","_validate","taskName","TypeError","hasFinishedInitPhase","resolve","then","defineTask","taskExecutor","console","warn","has","set","isTaskDefined","isTaskRegisteredAsync","getTaskOptionsAsync","getRegisteredTasksAsync","unregisterTaskAsync","unregisterAllTasksAsync","eventEmitter","addListener","EVENT_NAME","data","error","executionInfo","eventId","get","result","notifyTaskFinishedAsync","keys","join","isAvailableAsync"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,mBAAmB,QAAQ,OAAO;AACrD,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAOC,qBAAqB,oBAAoB;AAEhD,qFAAqF;AACrF,yFAAyF;AACzF,wBAAwB;AACxB,2EAA2E;AAC3E,8EAA8E;AAC9E,IAAIJ,SAASK,EAAE,KAAK,WAAW;IAC7BF,YAAYG,oBAAoB,CAAC,qBAAqB,IAAM,IAAM,IAAIC,QAAQ,KAA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C5E;QACF,OAAO;YACLlB,QAAQC,IAAI,CACV,CAAC,2BAA2B,EAAER,SAAS,oEAAoE,EAAE;mBAAIH,MAAM8B,IAAI;aAAG,CAACC,IAAI,CAAC,MAAM,iFAAiF,CAAC;YAE9N,6DAA6D;YAC7D,MAAMnC,gBAAgBiC,uBAAuB,CAAC1B,UAAU;gBAAEuB;gBAASE;YAAO;YAC1E,yFAAyF;YACzF,mGAAmG;YACnG,MAAMhC,gBAAgBsB,mBAAmB,CAACf;QAC5C;IACF;AAEJ;AAEA,cAAc;AACd;;;;;;CAMC,GACD,OAAO,eAAe6B;IACpB,OAAOpC,gBAAgBoC,gBAAgB;AACzC"}
@@ -0,0 +1 @@
1
+ 89270a10768d67b1ae98de65d07374f8b8ce6c3e224d2e584dad89b64e9a6a74
@@ -0,0 +1 @@
1
+ 04f0ba5ab232bca8d88cfab4312d0c316efba9374836637554f4bd6829007fffff8efe3da59996de38fa035944d9a02ef61e01abc14a0d78df850bc2cf153ac0
@@ -0,0 +1 @@
1
+ 266ab08471f1245941d00530dd7bc6597976baca4de25d682eba28513c1b06e2
@@ -0,0 +1 @@
1
+ aebe1f06117965d9785c36fbdd871c99147472bee032cfcb15840dae53d1e84bff5e8ccba7979df006a5581889e9456e6aecec4da5bf2b12e41d5fda3440c245
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.taskmanager",
6
- "version": "58.0.12",
6
+ "version": "58.0.14",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -33,13 +33,13 @@
33
33
  ],
34
34
  "files": [
35
35
  {
36
- "name": "expo.modules.taskmanager-58.0.12.aar",
37
- "url": "expo.modules.taskmanager-58.0.12.aar",
38
- "size": 68575,
39
- "sha512": "b5ca93c2ef190470e7e1e088b24445fa0c3baa6ebd1f581c3b6720c8f39bb43596044d7aa86901955a7459c587d732f314a697c777ca8e9dbf7ed50aa0e8147b",
40
- "sha256": "21fa0133cb6d7973f336853cc70089c9b8852b50c904d53899ee4dea983cfd0a",
41
- "sha1": "2ff2c545ed319f48df1428f9b826932fa95a2ce0",
42
- "md5": "06f0963ae33af2d8938d94758e46114d"
36
+ "name": "expo.modules.taskmanager-58.0.14.aar",
37
+ "url": "expo.modules.taskmanager-58.0.14.aar",
38
+ "size": 69001,
39
+ "sha512": "aebe1f06117965d9785c36fbdd871c99147472bee032cfcb15840dae53d1e84bff5e8ccba7979df006a5581889e9456e6aecec4da5bf2b12e41d5fda3440c245",
40
+ "sha256": "266ab08471f1245941d00530dd7bc6597976baca4de25d682eba28513c1b06e2",
41
+ "sha1": "54af50071c389423d1bea5949119e95853509b25",
42
+ "md5": "06c5f48ad9f3928991828a5ec3060259"
43
43
  }
44
44
  ]
45
45
  },
@@ -90,13 +90,13 @@
90
90
  ],
91
91
  "files": [
92
92
  {
93
- "name": "expo.modules.taskmanager-58.0.12.aar",
94
- "url": "expo.modules.taskmanager-58.0.12.aar",
95
- "size": 68575,
96
- "sha512": "b5ca93c2ef190470e7e1e088b24445fa0c3baa6ebd1f581c3b6720c8f39bb43596044d7aa86901955a7459c587d732f314a697c777ca8e9dbf7ed50aa0e8147b",
97
- "sha256": "21fa0133cb6d7973f336853cc70089c9b8852b50c904d53899ee4dea983cfd0a",
98
- "sha1": "2ff2c545ed319f48df1428f9b826932fa95a2ce0",
99
- "md5": "06f0963ae33af2d8938d94758e46114d"
93
+ "name": "expo.modules.taskmanager-58.0.14.aar",
94
+ "url": "expo.modules.taskmanager-58.0.14.aar",
95
+ "size": 69001,
96
+ "sha512": "aebe1f06117965d9785c36fbdd871c99147472bee032cfcb15840dae53d1e84bff5e8ccba7979df006a5581889e9456e6aecec4da5bf2b12e41d5fda3440c245",
97
+ "sha256": "266ab08471f1245941d00530dd7bc6597976baca4de25d682eba28513c1b06e2",
98
+ "sha1": "54af50071c389423d1bea5949119e95853509b25",
99
+ "md5": "06c5f48ad9f3928991828a5ec3060259"
100
100
  }
101
101
  ]
102
102
  },
@@ -110,13 +110,13 @@
110
110
  },
111
111
  "files": [
112
112
  {
113
- "name": "expo.modules.taskmanager-58.0.12-sources.jar",
114
- "url": "expo.modules.taskmanager-58.0.12-sources.jar",
115
- "size": 23663,
116
- "sha512": "d46fff9238afcda44671454a128c5c4b5ca0b88f64ce7cc413ef45a8d5bc7c416af71620c131efe48683f8d30a240a70c3883ea4a4987b0b7316252138c425c3",
117
- "sha256": "13fb158324d29533525ec15220aff3cef1507dcd3e8612a1b08c2433375dfd58",
118
- "sha1": "98bf36f1b6d6e528ddaf63bb13a4dd276c9de928",
119
- "md5": "c3bb843c0fefe2f478faf6b615e8900c"
113
+ "name": "expo.modules.taskmanager-58.0.14-sources.jar",
114
+ "url": "expo.modules.taskmanager-58.0.14-sources.jar",
115
+ "size": 24038,
116
+ "sha512": "04f0ba5ab232bca8d88cfab4312d0c316efba9374836637554f4bd6829007fffff8efe3da59996de38fa035944d9a02ef61e01abc14a0d78df850bc2cf153ac0",
117
+ "sha256": "89270a10768d67b1ae98de65d07374f8b8ce6c3e224d2e584dad89b64e9a6a74",
118
+ "sha1": "a1184ddb854585c9a6536bf0a92413e5e4aca7b8",
119
+ "md5": "b327838a497f99a4e82dae175a08c87c"
120
120
  }
121
121
  ]
122
122
  }
@@ -0,0 +1 @@
1
+ 141825699e6615c542a768401c14a81eda6aa4feecb5f127d7b3e1e069795699
@@ -0,0 +1 @@
1
+ 9a4b8017aa057133b3f3067a12a62d66d7d9c630a1234de059b5259e1119dd33c48f54f907572295a7c84062885420d35c0a4f989aa6a93f8ec91f2e2a9e0c90
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.taskmanager</artifactId>
12
- <version>58.0.12</version>
12
+ <version>58.0.14</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.taskmanager</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 6aaccdcf6392b5214bddb7d15e91af504000564a56ff47f9b203715152fe589e
@@ -0,0 +1 @@
1
+ a9effbe96f166c1fb4daa922e34f73edb410668bb4640b7123b59db244f95aeb37aa4ccbe2557cc032db81713424e1ea122b817da7e73038313360da2afc53b3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-task-manager",
3
- "version": "58.0.12",
3
+ "version": "58.0.14",
4
4
  "description": "Expo module that provides support for tasks that can run in the background.",
5
5
  "keywords": [
6
6
  "background",
@@ -27,10 +27,10 @@
27
27
  "unimodules-app-loader": "~58.0.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@expo/internal-scripts": "58.0.3",
30
+ "@expo/internal-scripts": "58.0.6",
31
31
  "@types/jest": "^30.0.0",
32
32
  "@types/node": "^22.14.0",
33
- "expo": "58.0.11"
33
+ "expo": "58.0.24"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "expo": "*",
@@ -4,11 +4,13 @@ import { AppRegistry } from 'react-native';
4
4
 
5
5
  import ExpoTaskManager from './ExpoTaskManager';
6
6
 
7
- // Register a no-op headless task so that HeadlessJsTaskContext.startTask()
8
- // doesn't log a warning. On Android, TaskService registers a headless task
9
- // in native code to keep JS timers alive during background task execution.
7
+ // On Android, TaskService starts this headless task in native code to keep JS timers
8
+ // alive during background task execution, and finishes it natively once the task is done
9
+ // (or after a timeout).
10
+ // The JS side must never settle: a resolved promise makes AppRegistry call
11
+ // notifyTaskFinished, which ends the task right away and pauses timers again.
10
12
  if (Platform.OS === 'android') {
11
- AppRegistry.registerHeadlessTask('expo-task-manager', () => async () => {});
13
+ AppRegistry.registerHeadlessTask('expo-task-manager', () => () => new Promise(() => {}));
12
14
  }
13
15
 
14
16
  // @needsAudit @docsMissing
@@ -1 +0,0 @@
1
- 13fb158324d29533525ec15220aff3cef1507dcd3e8612a1b08c2433375dfd58
@@ -1 +0,0 @@
1
- d46fff9238afcda44671454a128c5c4b5ca0b88f64ce7cc413ef45a8d5bc7c416af71620c131efe48683f8d30a240a70c3883ea4a4987b0b7316252138c425c3
@@ -1 +0,0 @@
1
- 21fa0133cb6d7973f336853cc70089c9b8852b50c904d53899ee4dea983cfd0a
@@ -1 +0,0 @@
1
- b5ca93c2ef190470e7e1e088b24445fa0c3baa6ebd1f581c3b6720c8f39bb43596044d7aa86901955a7459c587d732f314a697c777ca8e9dbf7ed50aa0e8147b
@@ -1 +0,0 @@
1
- 89c397cf7b8728ae4e6668973f4385f5b9e802fef1c4ec9e25c7bfa1581e24cb
@@ -1 +0,0 @@
1
- 3ca194e9f21b77395f38ee7dad4454f5bbbd9ee42e3e64a90cdb1af1e4b84626dd4daf6583196625c052594d71e3829828aa09511c11b13db609cb412c2ea74e
@@ -1 +0,0 @@
1
- 8f2facd243c4200df94a882a64af070c67a2934755667a51165993dbf804435d
@@ -1 +0,0 @@
1
- c96f87220c189b80cc300007a639152367fe075bdab52539ad7c5b0e16b361bdd47a6643e3d42e62833d1f15d529cdfcade096caa94cd45b5f298a73ccde74d6