Our app is getting a SecurityEception on a Huawei device (Huawei P30 Pro, Android 10). We have no idea what might be causing this, and Googling for it gave no results. The complete stacktrace:
java.lang.SecurityException:
at android.os.Parcel.createException (Parcel.java:2071)
at android.os.Parcel.readException (Parcel.java:2039)
at android.os.Parcel.readException (Parcel.java:1987)
at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo (IConnectivityManager.java:2153)
at android.net.ConnectivityManager.getActiveNetworkInfo (ConnectivityManager.java:1006)
at com.huawei.android.totemweather.common.NetUtil.isNetworkAvaialble (NetUtil.java:107)
at com.huawei.android.totemweather.widget.controller.AutoRefreshManager.sendRefresh (AutoRefreshManager.java:78)
at com.huawei.android.totemweather.widget.controller.WidgetWeatherServiceAgent$WeatherDataObserver$WeatherReceiver.lambda$onReceive$0$WidgetWeatherServiceAgent$WeatherDataObserver$WeatherReceiver (WidgetWeatherServiceAgent.java:509)
at com.huawei.android.totemweather.widget.controller.WidgetWeatherServiceAgent$WeatherDataObserver$WeatherReceiver$$Lambda$0.run (WidgetWeatherServiceAgent.java:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
at java.lang.Thread.run (Thread.java:929)
Caused by: android.os.RemoteException:
at android.app.ContextImpl.enforce (ContextImpl.java:2001)
at android.app.ContextImpl.enforceCallingOrSelfPermission (ContextImpl.java:2029)
at com.android.server.ConnectivityService.enforceAccessPermission (ConnectivityService.java:2195)
at com.android.server.ConnectivityService.getActiveNetworkInfo (ConnectivityService.java:1507)
at com.android.server.HwConnectivityService.getActiveNetworkInfo (HwConnectivityService.java:2559)
Does anyone have an idea of what might be causing this? It seems it might have to do with an exception being raised when the network is accessed from the Huawei Weather widget.
Edit: we create a custom launcher.
So I searched up what remoteException meant and it seems to happen when the remote object is no longer available, typically meaning it crashed. Given it's a widget they are trying to access information on, the widget or the app might be crashing as it is trying to access information that is not available. The SeurityException that is being reported can be caused by missing permissions. So there may be missing permissions that is preventing the information of the widget/app from being properly accessed and therefore crashing and not working as expected. Please check your manifest for missing permissions, especially ones to connectivity/internet access.