1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 01:09:47 +01:00

Pebble: dispose webview when app with app handler has been started (misfit, morpheuz)

This commit is contained in:
Andreas Shimokawa 2017-10-23 09:23:28 +02:00
parent 086974be8c
commit ea06df4d0c
2 changed files with 9 additions and 1 deletions

View File

@ -517,7 +517,11 @@ class PebbleIoThread extends GBDeviceIoThread {
case START:
LOG.info("got GBDeviceEventAppManagement START event for uuid: " + appMgmt.uuid);
if (prefs.getBoolean("pebble_enable_background_javascript", false)) {
WebViewSingleton.runJavascriptInterface(gbDevice, appMgmt.uuid);
if (mPebbleProtocol.hasAppMessageHandler(appMgmt.uuid)) {
WebViewSingleton.disposeWebView();
} else {
WebViewSingleton.runJavascriptInterface(gbDevice, appMgmt.uuid);
}
}
break;
default:

View File

@ -2710,6 +2710,10 @@ public class PebbleProtocol extends GBDeviceProtocol {
mEnablePebbleKit = enablePebbleKit;
}
boolean hasAppMessageHandler(UUID uuid) {
return mAppMessageHandlers.containsKey(uuid);
}
private String getFixedString(ByteBuffer buf, int length) {
byte[] tmp = new byte[length];
buf.get(tmp, 0, length);