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

Pebble: fix webview crash (on android 14)

Older android version also possibly impacted
This commit is contained in:
Daniele Gobbetti 2024-06-13 16:26:39 +02:00
parent 12b3ff34e2
commit 74fbadf553

View File

@ -124,6 +124,9 @@ public class WebViewSingleton {
//Internet helper inbound (responses) handler
private class IncomingHandler extends Handler {
public IncomingHandler(Looper looper) {
super(looper);
}
private String getCharsetFromHeaders(String contentType) {
if (contentType != null && contentType.toLowerCase().trim().contains("charset=")) {
@ -199,7 +202,15 @@ public class WebViewSingleton {
Intent intent = new Intent();
intent.setComponent(new ComponentName(internetHelperPkg, internetHelperCls));
contextWrapper.getApplicationContext().bindService(intent, internetHelperConnection, Context.BIND_AUTO_CREATE);
internetHelperListener = new Messenger(new IncomingHandler());
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Looper.prepare();
internetHelperListener = new Messenger(new IncomingHandler(Looper.myLooper()));
Looper.loop();
}
});
thread.start();
internetHelperInstalled = true;
}
catch (PackageManager.NameNotFoundException e) {