diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/RebbleAppStoreActivity.kt b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/RebbleAppStoreActivity.kt index 43f6f4accd..c352ffc267 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/RebbleAppStoreActivity.kt +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/RebbleAppStoreActivity.kt @@ -27,7 +27,6 @@ import android.os.ParcelFileDescriptor import android.webkit.PermissionRequest import android.webkit.WebResourceRequest import android.webkit.WebView -import android.webkit.WebViewClient import android.widget.Toast import androidx.core.net.toUri import com.android.volley.Request @@ -119,6 +118,7 @@ class RebbleAppStoreActivity : AbstractGBActivity() { ), Toast.LENGTH_LONG, GB.ERROR ) + LOG.error("Received content-type $contentType but expected application/octet-stream or application/zip") return } val inputStream = ParcelFileDescriptor.AutoCloseInputStream(response.body) @@ -142,6 +142,7 @@ class RebbleAppStoreActivity : AbstractGBActivity() { Toast.LENGTH_LONG, GB.ERROR ) + LOG.error("Failed downloading file: $message") } }) } @@ -167,6 +168,7 @@ class RebbleAppStoreActivity : AbstractGBActivity() { error ), Toast.LENGTH_LONG, GB.ERROR ) + LOG.error("Failed fetching download file URL", error) } ) requestQueue.add(jsonObjectRequest) @@ -185,6 +187,7 @@ class RebbleAppStoreActivity : AbstractGBActivity() { ), Toast.LENGTH_LONG, GB.ERROR ) + LOG.error("Received content-type $contentType but expected application/json") return } val inputStream = ParcelFileDescriptor.AutoCloseInputStream(response.body) @@ -205,6 +208,7 @@ class RebbleAppStoreActivity : AbstractGBActivity() { message ), Toast.LENGTH_LONG, GB.ERROR ) + LOG.error("Error downloading file: $message") } }) } @@ -244,6 +248,7 @@ class RebbleAppStoreActivity : AbstractGBActivity() { val installHandler: InstallHandler? = mGBDevice?.deviceCoordinator?.findInstallHandler(file.toUri(), applicationContext) if (installHandler == null) { GB.toast(getString(R.string.fwinstaller_file_not_compatible_to_device), Toast.LENGTH_LONG, GB.ERROR) + LOG.error("Installable file not compatible with device") return } val startIntent = Intent(applicationContext, installHandler.getInstallActivity()) @@ -256,13 +261,12 @@ class RebbleAppStoreActivity : AbstractGBActivity() { @SuppressLint("SetJavaScriptEnabled") private fun initViews() { webView = findViewById(R.id.webview) - webView!!.webViewClient = WebViewClient() val settings = webView!!.settings settings.javaScriptEnabled = true settings.loadWithOverviewMode = true settings.useWideViewPort = true - webView!!.webViewClient = object : GBWebClient(GBWebClient.REQUEST_TYPE_PEBBLE_APP_STORE) { + webView!!.webViewClient = object : GBWebClient(REQUEST_TYPE_PEBBLE_APP_STORE) { override fun shouldOverrideUrlLoading( wv: WebView, request: WebResourceRequest @@ -293,11 +297,7 @@ class RebbleAppStoreActivity : AbstractGBActivity() { description: String?, failingUrl: String? ) { - GB.toast( - "Error: $description", - Toast.LENGTH_SHORT, - GB.ERROR - ) + LOG.error(description) view.loadUrl("about:blank") } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java index b3e29f0926..60b69435a7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java @@ -236,7 +236,6 @@ public class PebbleCoordinator extends AbstractBLClassicDeviceCoordinator { return PebbleSupport.class; } - @Override @StringRes public int getDeviceNameResource() { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/InternetHelperSingleton.kt b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/InternetHelperSingleton.kt index afb024e608..d18bdfca34 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/InternetHelperSingleton.kt +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/InternetHelperSingleton.kt @@ -96,6 +96,7 @@ object InternetHelperSingleton { val httpGetRequest = HttpGetRequest(webRequest.toString(), httpHeaders) val latch = CountDownLatch(1) val internetResponseCapsule = Capsule() + LOG.debug("Forwarding GET request to {} to internet helper app", webRequest) try { internetHelper?.get(httpGetRequest, object : IHttpCallback.Stub() { @Throws(RemoteException::class) @@ -137,16 +138,16 @@ object InternetHelperSingleton { @Throws(RemoteException::class) override fun onException(message: String?) { - throw RuntimeException(message) + LOG.error("Error during GET request: $message") } }) } catch (e: RemoteException) { - throw RuntimeException(e) + LOG.error("Error during GET request", e) } try { latch.await() } catch (e: InterruptedException) { - throw RuntimeException(e) + LOG.error("Error during GET request", e) } return internetResponseCapsule.get()