1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 19:06:53 +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,8 +517,12 @@ class PebbleIoThread extends GBDeviceIoThread {
case START: case START:
LOG.info("got GBDeviceEventAppManagement START event for uuid: " + appMgmt.uuid); LOG.info("got GBDeviceEventAppManagement START event for uuid: " + appMgmt.uuid);
if (prefs.getBoolean("pebble_enable_background_javascript", false)) { if (prefs.getBoolean("pebble_enable_background_javascript", false)) {
if (mPebbleProtocol.hasAppMessageHandler(appMgmt.uuid)) {
WebViewSingleton.disposeWebView();
} else {
WebViewSingleton.runJavascriptInterface(gbDevice, appMgmt.uuid); WebViewSingleton.runJavascriptInterface(gbDevice, appMgmt.uuid);
} }
}
break; break;
default: default:
break; break;

View File

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