This is an automated email from the ASF dual-hosted git repository.
normanbreau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new f927014 fix(android): Avoid Crash Report:
ConcurrentModificationException (#1073)
f927014 is described below
commit f927014d065ac63225a67054da85cfebfe808d71
Author: Guillem Perez <[email protected]>
AuthorDate: Sun Mar 28 14:49:39 2021 +0200
fix(android): Avoid Crash Report: ConcurrentModificationException (#1073)
Authored-by: lempere <[email protected]>
---
framework/src/org/apache/cordova/PluginManager.java | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/framework/src/org/apache/cordova/PluginManager.java
b/framework/src/org/apache/cordova/PluginManager.java
index f7a2e41..21aec73 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -30,6 +30,7 @@ import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.os.Debug;
+import android.os.Build;
/**
* PluginManager is exposed to JavaScript in the Cordova WebView.
@@ -331,11 +332,19 @@ public class PluginManager {
public Object postMessage(String id, Object data) {
LOG.d(TAG, "postMessage: " + id);
synchronized (this.pluginMap) {
- for (CordovaPlugin plugin : this.pluginMap.values()) {
- if (plugin != null) {
- Object obj = plugin.onMessage(id, data);
- if (obj != null) {
- return obj;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ this.pluginMap.forEach((s, plugin) -> {
+ if (plugin != null) {
+ plugin.onMessage(id, data);
+ }
+ });
+ } else {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ Object obj = plugin.onMessage(id, data);
+ if (obj != null) {
+ return obj;
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]