我们的应用在华为设备(华为 P30 Pro、Android 10)上获得了 SecurityEception。我们不知道是什么原因造成的,谷歌搜索也没有结果。完整的堆栈跟踪:
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)
有谁知道可能导致这种情况的原因?似乎这可能与从华为天气小部件访问网络时引发的异常有关。
编辑:我们创建一个自定义启动器。