mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-02 06:45:02 +08:00
fix notification task timeout crashing
Reviewed By: hedgerwang Differential Revision: D4088570 fbshipit-source-id: e2a217564d9325815e396daafbef2b7f06e84b33
This commit is contained in:
committed by
Facebook Github Bot
parent
285786ad30
commit
3580de541d
@@ -9,6 +9,7 @@
|
||||
|
||||
package com.facebook.react.modules.core;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
@@ -37,6 +38,13 @@ public class HeadlessJsTaskSupportModule extends ReactContextBaseJavaModule {
|
||||
public void notifyTaskFinished(int taskId) {
|
||||
HeadlessJsTaskContext headlessJsTaskContext =
|
||||
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
|
||||
headlessJsTaskContext.finishTask(taskId);
|
||||
if (headlessJsTaskContext.isTaskRunning(taskId)) {
|
||||
headlessJsTaskContext.finishTask(taskId);
|
||||
} else {
|
||||
FLog.w(
|
||||
HeadlessJsTaskSupportModule.class,
|
||||
"Tried to finish non-active task with id %d. Did it time out?",
|
||||
taskId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user