@capgo/capacitor-updater 7.50.1 → 7.50.2
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.
|
@@ -1493,19 +1493,30 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1493
1493
|
public void onPageLoaded(final android.webkit.WebView view) {
|
|
1494
1494
|
CapacitorUpdaterPlugin.this.evaluateWebViewStatsReporterScript(view, script);
|
|
1495
1495
|
}
|
|
1496
|
-
|
|
1497
|
-
@Override
|
|
1498
|
-
public boolean onRenderProcessGone(final android.webkit.WebView view, final RenderProcessGoneDetail detail) {
|
|
1499
|
-
final Map<String, String> metadata = CapacitorUpdaterPlugin.this.buildWebViewRenderProcessGoneMetadata(detail);
|
|
1500
|
-
CapacitorUpdaterPlugin.this.persistPendingWebViewRenderProcessGone(metadata);
|
|
1501
|
-
return false;
|
|
1502
|
-
}
|
|
1503
1496
|
};
|
|
1504
1497
|
|
|
1505
1498
|
this.bridge.addWebViewListener(this.webViewStatsListener);
|
|
1499
|
+
// Keep RenderProcessGoneDetail off the Plugin class method table and off this
|
|
1500
|
+
// listener so Android < 8 (API 26) does not crash during plugin reflection.
|
|
1501
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
1502
|
+
this.installWebViewRenderProcessGoneReporter();
|
|
1503
|
+
}
|
|
1506
1504
|
this.evaluateWebViewStatsReporterScript(webView, script);
|
|
1507
1505
|
}
|
|
1508
1506
|
|
|
1507
|
+
private void installWebViewRenderProcessGoneReporter() {
|
|
1508
|
+
this.bridge.addWebViewListener(
|
|
1509
|
+
new WebViewListener() {
|
|
1510
|
+
@Override
|
|
1511
|
+
public boolean onRenderProcessGone(final android.webkit.WebView view, final RenderProcessGoneDetail detail) {
|
|
1512
|
+
final Map<String, String> metadata = CapacitorUpdaterPlugin.this.buildWebViewRenderProcessGoneMetadata(detail);
|
|
1513
|
+
CapacitorUpdaterPlugin.this.persistPendingWebViewRenderProcessGone(metadata);
|
|
1514
|
+
return false;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
);
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1509
1520
|
private void installDocumentStartWebViewStatsReporter(final android.webkit.WebView webView, final String script) {
|
|
1510
1521
|
try {
|
|
1511
1522
|
final Class<?> webViewFeature = Class.forName("androidx.webkit.WebViewFeature");
|
|
@@ -1545,16 +1556,17 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1545
1556
|
});
|
|
1546
1557
|
}
|
|
1547
1558
|
|
|
1548
|
-
private Map<String, String> buildWebViewRenderProcessGoneMetadata(final
|
|
1559
|
+
private Map<String, String> buildWebViewRenderProcessGoneMetadata(final Object detailObj) {
|
|
1549
1560
|
final Map<String, String> metadata = new HashMap<>();
|
|
1550
1561
|
metadata.put("error_type", "render_process_gone");
|
|
1551
1562
|
metadata.put("source", "android_on_render_process_gone");
|
|
1552
1563
|
metadata.put("timestamp", Long.toString(System.currentTimeMillis()));
|
|
1553
|
-
|
|
1564
|
+
// Parameter typed as Object so Android < 8 ART does not resolve
|
|
1565
|
+
// RenderProcessGoneDetail while reflecting CapacitorUpdaterPlugin methods.
|
|
1566
|
+
if (detailObj != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
1567
|
+
final RenderProcessGoneDetail detail = (RenderProcessGoneDetail) detailObj;
|
|
1554
1568
|
metadata.put("did_crash", Boolean.toString(detail.didCrash()));
|
|
1555
|
-
|
|
1556
|
-
metadata.put("renderer_priority_at_exit", Integer.toString(detail.rendererPriorityAtExit()));
|
|
1557
|
-
}
|
|
1569
|
+
metadata.put("renderer_priority_at_exit", Integer.toString(detail.rendererPriorityAtExit()));
|
|
1558
1570
|
}
|
|
1559
1571
|
return metadata;
|
|
1560
1572
|
}
|