seemoo-lab / AirGuard

Protect yourself from being tracked 🌍 by AirTags 🏷 and Find My accessories 📍
Apache License 2.0
1.96k stars 110 forks source link

v2.0 crashes on devices without network location provider #131

Closed dvalter closed 1 year ago

dvalter commented 1 year ago

Crashes on a phone with LineageOS 19 and no GApps installed with the following backtrace. 1.4 works as intended with the same config

06-30 20:19:27.720 13137 13137 E AndroidRuntime: java.lang.RuntimeException: Unable to resume activity {de.seemoo.at_tracking_detection/de.seemoo.at_tracking_detection.ui.MainActivity}: java.lang.IllegalArgumentException: provider "network" does not exist
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4770)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4803)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:179)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2303)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7884)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
06-30 20:19:27.720 13137 13137 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: provider "network" does not exist
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Parcel.createExceptionOrNull(Parcel.java:3015)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Parcel.createException(Parcel.java:2995)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:2978)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:2920)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.location.ILocationManager$Stub$Proxy.registerLocationListener(ILocationManager.java:1306)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.location.LocationManager.requestLocationUpdates(LocationManager.java:1564)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.location.LocationManager.requestLocationUpdates(LocationManager.java:1247)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.location.LocationManager.requestLocationUpdates(LocationManager.java:1212)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at de.seemoo.at_tracking_detection.detection.LocationProvider.requestLegacyLocationUpdatesFromAnyProvider(Unknown Source:71)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at de.seemoo.at_tracking_detection.detection.LocationProvider.lastKnownOrRequestLocationUpdates(Unknown Source:41)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at de.seemoo.at_tracking_detection.util.ble.BLEScanner.fetchCurrentLocation(Unknown Source:19)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at de.seemoo.at_tracking_detection.util.ble.BLEScanner.startBluetoothScan(Unknown Source:99)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at de.seemoo.at_tracking_detection.ui.MainActivity.onResume(Unknown Source:24)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1564)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.Activity.performResume(Activity.java:8473)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4760)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        ... 13 more
06-30 20:19:27.720 13137 13137 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace:
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at com.android.internal.util.Preconditions.checkArgument(Preconditions.java:59)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at com.android.server.location.LocationManagerService.registerLocationListener(LocationManagerService.java:727)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.location.ILocationManager$Stub.onTransact(ILocationManager.java:590)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Binder.execTransactInternal(Binder.java:1285)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:        at android.os.Binder.execTransact(Binder.java:1244)
06-30 20:19:27.720 13137 13137 E AndroidRuntime:
aeri commented 1 year ago

I have the same problem with Vanilla LineageOS 18.1 (Android 11), when the Bluetooth is deactivated the application starts correctly, but when it is activated and the application is switched back on, it crashes.

On some arbitrary occasion the application has managed to start with Bluetooth enabled.