transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
652 stars 241 forks source link

Crash on OnePlus Android 13 when the airplane mode toggled on/off #1026

Closed habil-yaway closed 6 months ago

habil-yaway commented 1 year ago

It is very hard to reproduce it as we could only do it in OnePlus Android 13 and the problem is that when the app is put to background and airplane mode is toggled on/off the app crashes which is initiated by disappearance of the sticky notification.

The problem does not happen if the background location process has not started(lets say the user is in login screen and the location tracking is not started before login)

Your Environment

allprojects { repositories { google() mavenCentral()

    maven {
        // [required] flutter_background_geolocation
        url "${project(':flutter_background_geolocation').projectDir}/libs"
    }

    maven {
        // [required] background_fetch
        url "${project(':background_fetch').projectDir}/libs"
    }

    // force resolution of play services version for location related dependencies
    configurations.all {
        resolutionStrategy {
            force "com.google.android.gms:play-services-location:$playServicesLocationVersion"
        }
    }
}

}

rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') }

task clean(type: Delete) { delete rootProject.buildDir }

* app/build.gradle

def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }

def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException('Flutter SDK not found. Define location with flutter.sdk in the local.properties file.') }

def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }

def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' }

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

// flutter_background_geolocation (must be placed after the lines above) Project background_geolocation = project(':flutter_background_geolocation') apply from: "${background_geolocation.projectDir}/background_geolocation.gradle"

def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) }

android { compileSdkVersion rootProject.ext.compileSdkVersion

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId 'com.example.app'
    minSdkVersion 21
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
        storePassword keystoreProperties['storePassword']
    }
}

buildTypes {
    release {
        signingConfig signingConfigs.release
        minifyEnabled true
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', "${background_geolocation.projectDir}/proguard-rules.pro"
    }
}

}

flutter { source '../..' }

dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${rootProject.ext.kotlin_version}" implementation "androidx.appcompat:appcompat:${rootProject.ext.appCompatVersion}" }


## Expected Behavior
App will not crash when the airplane mode is toggled on/off in the background

## Actual Behavior
App crashes when the airplane mode is toggled on/off when the app is in the background (not terminated). The process start by the disappearance of the sticky notification.

## Steps to Reproduce
So far we can reproduce only in single device which is Oneplus LE2123 Android 13
1. Open the app and put it into background (make sure the location )
2. Turn on the airplane on and wait 2-3 seconds
3. Turn the airplane off and the app is crashed

## Context
We are trying to ensure that the plugin will not cause an app crash

## Debug logs
Note that, the reason why we highly suspect that it is plugin related is the TSLocationManagerActivity and TSLocationManager related logs around the time when the crash happens. Basically the surface view is destroyed and the main crash we think is related to the log below(please also see complete logs):

D/OplusScrollToTopManager(30206): java.lang.IllegalArgumentException: Receiver not registered: android.view.OplusScrollToTopManager$2@1901272 V/ZoomWindowDecorView(30206): removeZoomView D/VRITSLocationManagerActivity: setWindowStopped stopped:true D/OplusScrollToTopManager(30206): unregisterGuidePopupDismissReceiverInSystemUI D/OplusScrollToTopManager(30206): Receiver not registered: android.view.OplusScrollToTopManager$1@b2b7dca D/OplusScrollToTopManager(30206): unregisterSystemUIBroadcastReceiver D/OplusScrollToTopManager(30206): java.lang.IllegalArgumentException: Receiver not registered: android.view.OplusScrollToTopManager$2@6144b3b V/ZoomWindowDecorView(30206): removeZoomView D/BufferQueueProducer(30206): VRI[TSLocationManagerActivity]#11(BLAST Consumer)11 disconnect: api 1 D/BufferQueueConsumer(30206): VRI[TSLocationManagerActivity]#11(BLAST Consumer)11 disconnect


<details>
    <summary>Logs</summary>

``` <!-- syntax-highligting:  DO NOT REMOVE -->
Launching lib\main_production.dart on LE2123 in debug mode...
Running Gradle task 'assembleDebug'...
[flutter_background_geolocation] Purging debug resources in release build
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...
D/FlutterGeolocator(30206): Attaching Geolocator to activity
D/FlutterGeolocator(30206): Creating service.
D/FlutterGeolocator(30206): Binding to location service.
D/FlutterGeolocator(30206): Geolocator foreground service connected
D/FlutterGeolocator(30206): Initializing Geolocator services
D/FlutterGeolocator(30206): Flutter engine connected. Connected engine count 1
D/VRI[MainActivity](30206):  debugCancelDraw some OnPreDrawListener onPreDraw return false,cancelDraw=true,count=50,android.view.ViewRootImpl@4d46d1c
I/ity.towtruckapp(30206): Compiler allocated 4937KB to compile void android.view.ViewRootImpl.performTraversals()
Debug service listening on ws://127.0.0.1:53786/WRDgBzMVxUs=/ws
Syncing files to device LE2123...
I/amplify:flutter:auth_cognito(30206): Added Auth plugin
I/flutter (30206): Successfully configured Amplify 🎉
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
I/Quality (30206): Skipped: false 1 cost 15.311493 refreshRate 8282228 bit true processName com.example.app
I/Quality (30206): Skipped: false 6 cost 50.683422 refreshRate 8282228 bit true processName com.example.app
D/MapsInitializer(30206): preferredRenderer: LATEST
D/zzcb    (30206): preferredRenderer: LATEST
I/zzcb    (30206): Making Creator dynamically
I/DynamiteModule(30206): Considering local module com.google.android.gms.maps_core_dynamite:0 and remote module com.google.android.gms.maps_core_dynamite:224910104
I/DynamiteModule(30206): Selected remote version of com.google.android.gms.maps_core_dynamite, version >= 224910104
V/DynamiteModule(30206): Dynamite loader version >= 2, using loadModule2NoCrashUtils
D/TrafficStats(30206): tagSocket(157) with statsTag=0xffffffff, statsUid=-1
I/Google Android Maps SDK(30206): Google Play services client version: 12451000
I/Google Android Maps SDK(30206): Google Play services package version: 231312045
I/Google Android Maps SDK(30206): Google Play services maps renderer version(maps_core): 224910104
I/SnapshotHandler(30206): Unable to retrieve flag snapshot for com.google.android.gms.maps#com.example.app, using defaults.
D/MapsInitializer(30206): loadedRenderer: LATEST
I/Quality (30206): Skipped: false 12 cost 105.189415 refreshRate 8282228 bit true processName com.example.app
D/TrafficStats(30206): tagSocket(157) with statsTag=0xffffffff, statsUid=-1
E/SurfaceSyncer(30206): Failed to find sync for id=0
D/VRI[MainActivity](30206): registerCallbacksForSync syncBuffer=false
D/VRI[MainActivity](30206): Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true syncBuffer=false
W/Parcel  (30206): Expecting binder but got null!
D/VRI[MainActivity](30206):  debugCancelDraw  cancelDraw=false,count = 347,android.view.ViewRootImpl@4d46d1c
D/VRI[MainActivity](30206): draw finished.
D/VRI[MainActivity](30206): onFocusEvent true
D/TrafficStats(30206): tagSocket(170) with statsTag=0xffffffff, statsUid=-1
W/DynamiteModule(30206): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule(30206): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:7
I/DynamiteModule(30206): Selected remote version of com.google.android.gms.googlecertificates, version >= 7
W/ity.towtruckapp(30206): ClassLoaderContext classpath size mismatch. expected=10, found=7 (DLC[];PCL[base.apk*3449653179:base.apk!classes2.dex*3712336556:base.apk!classes3.dex*2314478658:base.apk!classes4.dex*2690931038:base.apk!classes5.dex*2356057358:base.apk!classes6.dex*1708332346:base.apk!classes7.dex*2637839945:base.apk!classes8.dex*4153853923:base.apk!classes9.dex*3836430427:base.apk!classes10.dex*2914006935]{PCL[/system/framework/org.apache.http.legacy.jar*233752416]#PCL[/system/framework/com.android.media.remotedisplay.jar*3743104115]#PCL[/system/framework/com.android.location.provider.jar*3175360615]#PCL[/system_ext/framework/androidx.window.extensions.jar*3792471835]#PCL[/system_ext/framework/androidx.window.sidecar.jar*3473293303]} | DLC[];PCL[/data/app/~~6oNIEBUhPAcVMYbaENh_7A==/com.example.app-jPXq6l86qvq0rgD5y-Ee-A==/base.apk*3022573022:/data/app/~~6oNIEBUhPAcVMYbaENh_7A==/com.example.app-jPXq6l86qvq0rgD5y-Ee-A==/base.apk!classes2.dex*3322593742:/data/app/~~6oNIEBUhPAcVMYbaENh_7A==/com.example.app-jPXq6l86qvq0rgD5y-Ee-A==/base.apk!classes3.dex*3873493147:/data/app/~~6oNIEBUhPAcVMYbaENh_7A==/com.example.app-jPXq6l86qvq0rgD5y-Ee-A==/base.apk!classes4.dex*1086286015:/data/app/~~6oNIEBUhPAcVMYbaENh_7A==/com.example.app-jPXq6l86qvq0rgD5y-Ee-A==/base.apk!classes5.dex*2094808409:/data/app/~~6oNIEBUhPAcVMYbaENh_7A==/com.example.app-jPXq6l86qvq0rgD5y-Ee-A==/base.apk!classes6.dex*2195580901:/data/app/~~6oNIEBUhPAcVMYbaENh_7A==/com.example.app-jPXq6l86qvq0rgD5y-Ee-A==/base.apk!classes7.dex*2789666087]{PCL[/system_ext/framework/androidx.window.extensions.jar*3792471835]#PCL[/system_ext/framework/androidx.window.sidecar.jar*3473293303]#PCL[/system/framework/org.apache.http.legacy.jar*233752416]})
I/SnapshotHandler(30206): Unable to retrieve flag snapshot for com.google.android.libraries.consentverifier#com.example.app, using defaults.
W/MobStoreFlagStore(30206): Unable to update local snapshot for com.google.android.libraries.consentverifier#com.example.app, may result in stale flags.
W/MobStoreFlagStore(30206): java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.example.app, sha256=[81234be414f50164ddefc6046a7aa5fb05102420be7fc6937457a4207849cbf3], atk=false, ver=231312045.true (go/gsrlt)
W/MobStoreFlagStore(30206):     at gjd.s(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:3)
W/MobStoreFlagStore(30206):     at gjd.get(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:2)
W/MobStoreFlagStore(30206):     at gly.a(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:1)
W/MobStoreFlagStore(30206):     at gku.g(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:0)
W/MobStoreFlagStore(30206):     at ewy.d(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:1)
W/MobStoreFlagStore(30206):     at exa.run(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:0)
W/MobStoreFlagStore(30206):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
W/MobStoreFlagStore(30206):     at java.util.concurrent.FutureTask.run(FutureTask.java:264)
W/MobStoreFlagStore(30206):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
W/MobStoreFlagStore(30206):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/MobStoreFlagStore(30206):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/MobStoreFlagStore(30206):     at java.lang.Thread.run(Thread.java:1012)
W/MobStoreFlagStore(30206): Caused by: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.example.app, sha256=[81234be414f50164ddefc6046a7aa5fb05102420be7fc6937457a4207849cbf3], atk=false, ver=231312045.true (go/gsrlt)
W/MobStoreFlagStore(30206):     at android.os.Parcel.createExceptionOrNull(Parcel.java:3040)
W/MobStoreFlagStore(30206):     at android.os.Parcel.createException(Parcel.java:3024)
W/MobStoreFlagStore(30206):     at android.os.Parcel.readException(Parcel.java:3007)
W/MobStoreFlagStore(30206):     at android.os.Parcel.readException(Parcel.java:2949)
W/MobStoreFlagStore(30206):     at azy.c(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:2)
W/MobStoreFlagStore(30206):     at crm.a(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:4)
W/MobStoreFlagStore(30206):     at cix.e(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:2)
W/MobStoreFlagStore(30206):     at cjx.t(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:2)
W/MobStoreFlagStore(30206):     at cjx.u(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:3)
W/MobStoreFlagStore(30206):     at cjx.e(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:2)
W/MobStoreFlagStore(30206):     at ckb.handleMessage(:com.google.android.gms.policy_maps_core_dynamite@224910104@224910104067.517481668.517481668:69)
W/MobStoreFlagStore(30206):     at android.os.Handler.dispatchMessage(Handler.java:102)
W/MobStoreFlagStore(30206):     at android.os.Looper.loopOnce(Looper.java:240)
W/MobStoreFlagStore(30206):     at android.os.Looper.loop(Looper.java:351)
W/MobStoreFlagStore(30206):     at android.os.HandlerThread.run(HandlerThread.java:67)
V/AutofillManager(30206): requestHideFillUi(null): anchor = null
D/OplusInputMethodManagerInternal(30206): get inputMethodManager extension: com.android.internal.view.IInputMethodManager$Stub$Proxy@3bea07f
D/VRI[MainActivity](30206): onFocusEvent false
D/VRI[MainActivity](30206): dispatchAppVisibility visible:false
I/SurfaceView(30206): 194058790 surfaceDestroyed
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#1(BLAST Consumer)1](id:75fe00000001,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#1(BLAST Consumer)1](id:75fe00000001,api:0,p:-1,c:30206) disconnect: api -1
D/BufferQueueConsumer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#1(BLAST Consumer)1](id:75fe00000001,api:0,p:-1,c:30206) disconnect
D/SurfaceView(30206): 247116406positionLost mSurfaceControl is null return;
D/BufferQueueProducer(30206): [VRI[MainActivity]#0(BLAST Consumer)0](id:75fe00000000,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueConsumer(30206): [VRI[MainActivity]#0(BLAST Consumer)0](id:75fe00000000,api:0,p:-1,c:30206) disconnect
D/VRI[MainActivity](30206): setWindowStopped stopped:true
D/ActivityThread(30206): do gfx trim 40 success
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/VRI[MainActivity](30206): dispatchAppVisibility visible:true
D/ColorModeChangeItem(30206): preExecute mColorMode=0,token=android.os.BinderProxy@884ba6f
D/VRI[MainActivity](30206): setWindowStopped stopped:false
D/BufferQueueConsumer(30206): [](id:75fe00000002,api:0,p:-1,c:30206) connect: controlledByApp=false
E/IPCThreadState(30206): attemptIncStrongHandle(68): Not supported
D/BufferQueueProducer(30206): [VRI[MainActivity]#2(BLAST Consumer)2](id:75fe00000002,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
D/BufferQueueConsumer(30206): [](id:75fe00000003,api:0,p:-1,c:30206) connect: controlledByApp=false
I/SurfaceView(30206): 194058790 visibleChanged -- surfaceCreated 
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#3(BLAST Consumer)3](id:75fe00000003,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
I/SurfaceView(30206): 194058790 surfaceChanged -- format=4 w=1080 h=2412
E/SurfaceSyncer(30206): Failed to find sync for id=0
E/SurfaceSyncer(30206): Failed to find sync for id=1
D/VRI[MainActivity](30206): registerCallbacksForSync syncBuffer=false
D/VRI[MainActivity](30206): Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true syncBuffer=false
D/VRI[MainActivity](30206): draw finished.
D/VRI[MainActivity](30206): onFocusEvent true
D/VRI[MainActivity](30206): onFocusEvent false
D/VRI[MainActivity](30206): dispatchAppVisibility visible:false
I/SurfaceView(30206): 194058790 surfaceDestroyed
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#3(BLAST Consumer)3](id:75fe00000003,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#3(BLAST Consumer)3](id:75fe00000003,api:0,p:-1,c:30206) disconnect: api -1
D/SurfaceView(30206): 210391879positionLost mSurfaceControl is null return;
D/BufferQueueProducer(30206): [VRI[MainActivity]#2(BLAST Consumer)2](id:75fe00000002,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueConsumer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#3(BLAST Consumer)3](id:75fe00000003,api:0,p:-1,c:30206) disconnect
D/BufferQueueConsumer(30206): [VRI[MainActivity]#2(BLAST Consumer)2](id:75fe00000002,api:0,p:-1,c:30206) disconnect
D/VRI[MainActivity](30206): setWindowStopped stopped:true
D/ActivityThread(30206): do gfx trim 40 success
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/VRI[MainActivity](30206): dispatchAppVisibility visible:true
D/ColorModeChangeItem(30206): preExecute mColorMode=0,token=android.os.BinderProxy@884ba6f
D/VRI[MainActivity](30206): setWindowStopped stopped:false
D/BufferQueueConsumer(30206): [](id:75fe00000004,api:0,p:-1,c:30206) connect: controlledByApp=false
E/IPCThreadState(30206): attemptIncStrongHandle(76): Not supported
E/IPCThreadState(30206): attemptIncStrongHandle(49): Not supported
D/BufferQueueProducer(30206): [VRI[MainActivity]#4(BLAST Consumer)4](id:75fe00000004,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
D/BufferQueueConsumer(30206): [](id:75fe00000005,api:0,p:-1,c:30206) connect: controlledByApp=false
I/SurfaceView(30206): 194058790 visibleChanged -- surfaceCreated 
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#5(BLAST Consumer)5](id:75fe00000005,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
I/SurfaceView(30206): 194058790 surfaceChanged -- format=4 w=1080 h=2412
E/SurfaceSyncer(30206): Failed to find sync for id=0
E/SurfaceSyncer(30206): Failed to find sync for id=1
E/SurfaceSyncer(30206): Failed to find sync for id=2
D/VRI[MainActivity](30206): registerCallbacksForSync syncBuffer=false
D/VRI[MainActivity](30206): Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true syncBuffer=false
D/VRI[MainActivity](30206): draw finished.
D/VRI[MainActivity](30206): onFocusEvent true
D/VRI[MainActivity](30206): onFocusEvent false
D/VRI[MainActivity](30206): dispatchAppVisibility visible:false
I/SurfaceView(30206): 194058790 surfaceDestroyed
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#5(BLAST Consumer)5](id:75fe00000005,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#5(BLAST Consumer)5](id:75fe00000005,api:0,p:-1,c:30206) disconnect: api -1
D/SurfaceView(30206): 208375764positionLost mSurfaceControl is null return;
D/BufferQueueProducer(30206): [VRI[MainActivity]#4(BLAST Consumer)4](id:75fe00000004,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueConsumer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#5(BLAST Consumer)5](id:75fe00000005,api:0,p:-1,c:30206) disconnect
D/BufferQueueConsumer(30206): [VRI[MainActivity]#4(BLAST Consumer)4](id:75fe00000004,api:0,p:-1,c:30206) disconnect
D/VRI[MainActivity](30206): setWindowStopped stopped:true
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/ActivityThread(30206): do gfx trim 40 success
D/VRI[MainActivity](30206): dispatchAppVisibility visible:true
D/ColorModeChangeItem(30206): preExecute mColorMode=0,token=android.os.BinderProxy@884ba6f
D/VRI[MainActivity](30206): setWindowStopped stopped:false
D/BufferQueueConsumer(30206): [](id:75fe00000006,api:0,p:-1,c:30206) connect: controlledByApp=false
E/IPCThreadState(30206): attemptIncStrongHandle(43): Not supported
E/IPCThreadState(30206): attemptIncStrongHandle(71): Not supported
D/BufferQueueProducer(30206): [VRI[MainActivity]#6(BLAST Consumer)6](id:75fe00000006,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
D/BufferQueueConsumer(30206): [](id:75fe00000007,api:0,p:-1,c:30206) connect: controlledByApp=false
I/SurfaceView(30206): 194058790 visibleChanged -- surfaceCreated 
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#7(BLAST Consumer)7](id:75fe00000007,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
I/SurfaceView(30206): 194058790 surfaceChanged -- format=4 w=1080 h=2412
E/SurfaceSyncer(30206): Failed to find sync for id=0
E/SurfaceSyncer(30206): Failed to find sync for id=1
E/SurfaceSyncer(30206): Failed to find sync for id=2
E/SurfaceSyncer(30206): Failed to find sync for id=3
D/VRI[MainActivity](30206): registerCallbacksForSync syncBuffer=false
D/VRI[MainActivity](30206): Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true syncBuffer=false
D/VRI[MainActivity](30206): draw finished.
D/VRI[MainActivity](30206): onFocusEvent true
D/VRI[MainActivity](30206): onFocusEvent false
D/VRI[MainActivity](30206): dispatchAppVisibility visible:false
I/SurfaceView(30206): 194058790 surfaceDestroyed
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#7(BLAST Consumer)7](id:75fe00000007,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#7(BLAST Consumer)7](id:75fe00000007,api:0,p:-1,c:30206) disconnect: api -1
D/BufferQueueConsumer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#7(BLAST Consumer)7](id:75fe00000007,api:0,p:-1,c:30206) disconnect
D/SurfaceView(30206): 141863769positionLost mSurfaceControl is null return;
D/BufferQueueProducer(30206): [VRI[MainActivity]#6(BLAST Consumer)6](id:75fe00000006,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueConsumer(30206): [VRI[MainActivity]#6(BLAST Consumer)6](id:75fe00000006,api:0,p:-1,c:30206) disconnect
D/VRI[MainActivity](30206): setWindowStopped stopped:true
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/ActivityThread(30206): do gfx trim 40 success
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
W/ity.towtruckapp(30206): Suspending all threads took: 7.174ms
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/VRI[MainActivity](30206): dispatchAppVisibility visible:true
D/ColorModeChangeItem(30206): preExecute mColorMode=0,token=android.os.BinderProxy@884ba6f
D/VRI[MainActivity](30206): setWindowStopped stopped:false
D/BufferQueueConsumer(30206): [](id:75fe00000008,api:0,p:-1,c:30206) connect: controlledByApp=false
E/IPCThreadState(30206): attemptIncStrongHandle(48): Not supported
E/IPCThreadState(30206): attemptIncStrongHandle(59): Not supported
D/BufferQueueProducer(30206): [VRI[MainActivity]#8(BLAST Consumer)8](id:75fe00000008,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
D/BufferQueueConsumer(30206): [](id:75fe00000009,api:0,p:-1,c:30206) connect: controlledByApp=false
I/SurfaceView(30206): 194058790 visibleChanged -- surfaceCreated 
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#9(BLAST Consumer)9](id:75fe00000009,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
I/SurfaceView(30206): 194058790 surfaceChanged -- format=4 w=1080 h=2412
E/SurfaceSyncer(30206): Failed to find sync for id=0
E/SurfaceSyncer(30206): Failed to find sync for id=1
E/SurfaceSyncer(30206): Failed to find sync for id=2
E/SurfaceSyncer(30206): Failed to find sync for id=3
E/SurfaceSyncer(30206): Failed to find sync for id=4
D/VRI[MainActivity](30206): registerCallbacksForSync syncBuffer=false
D/VRI[MainActivity](30206): Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true syncBuffer=false
D/VRI[MainActivity](30206): draw finished.
D/VRI[MainActivity](30206): onFocusEvent true
V/AutofillManager(30206): requestHideFillUi(null): anchor = null
D/InputMethodManager(30206): showSoftInput() view=io.flutter.embedding.android.FlutterView{911ce8a VFE...... .F....ID 0,0-1080,2412 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
W/OnBackInvokedCallback(30206): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback(30206): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/InsetsController(30206): show(ime(), fromIme=true)
D/OplusWindowManager(30206): get WMS extension: android.os.BinderProxy@daa8771
V/AutofillManager(30206): requestHideFillUi(null): anchor = null
D/InputMethodManager(30206): showSoftInput() view=io.flutter.embedding.android.FlutterView{911ce8a VFE...... .F...... 0,0-1080,2412 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
W/OnBackInvokedCallback(30206): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback(30206): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/InsetsController(30206): show(ime(), fromIme=true)
V/AutofillManager(30206): requestHideFillUi(null): anchor = null
W/CognitoUserSession(30206): CognitoUserSession is not valid because idToken is null.
D/IdentityManager(30206): Signing out...
I/TSLocationManager(30206): - Enable: false → true, trackingMode: 1
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/ColorModeChangeItem(30206): preExecute mColorMode=0,token=android.os.BinderProxy@d0779c2
W/ity.towtruckapp(30206): Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
W/ity.towtruckapp(30206): Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
D/WindowManager(30206): Add to mViews: DecorView@2a346f7[TSLocationManagerActivity],pkg= com.example.app
D/InputEventReceiver(30206): Input log is disabled
D/VRI[MainActivity](30206): onFocusEvent false
I/Quality (30206): Skipped: false 2 cost 47.229095 refreshRate 16591467 bit true processName com.example.app
D/BufferQueueConsumer(30206): [](id:75fe0000000a,api:0,p:-1,c:30206) connect: controlledByApp=false
E/IPCThreadState(30206): attemptIncStrongHandle(74): Not supported
V/ZoomWindowDecorView(30206): setLastReportedMergedConfiguration mZoomDisplayHeight: 2412 getDecorView.44254967
D/BufferQueueProducer(30206): [VRI[TSLocationManagerActivity]#10(BLAST Consumer)10](id:75fe0000000a,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
D/VRI[TSLocationManagerActivity](30206): registerCallbacksForSync syncBuffer=false
D/VRI[TSLocationManagerActivity](30206): draw finished.
D/VRI[TSLocationManagerActivity](30206): onFocusEvent true
I/Quality (30206): Skipped: false 2 cost 38.465168 refreshRate 16591739 bit true processName com.example.app
D/ColorModeChangeItem(30206): preExecute mColorMode=0,token=android.os.BinderProxy@884ba6f
D/VRI[TSLocationManagerActivity](30206): onFocusEvent false
D/VRI[MainActivity](30206): onFocusEvent true
D/VRI[TSLocationManagerActivity](30206): setWindowStopped stopped:true
D/OplusScrollToTopManager(30206): unregisterGuidePopupDismissReceiverInSystemUI
D/OplusScrollToTopManager(30206): Receiver not registered: android.view.OplusScrollToTopManager$1@4b02aa9
D/OplusScrollToTopManager(30206): unregisterSystemUIBroadcastReceiver 
D/OplusScrollToTopManager(30206): java.lang.IllegalArgumentException: Receiver not registered: android.view.OplusScrollToTopManager$2@3b7d82e
V/ZoomWindowDecorView(30206): removeZoomView
D/BufferQueueProducer(30206): [VRI[TSLocationManagerActivity]#10(BLAST Consumer)10](id:75fe0000000a,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueConsumer(30206): [VRI[TSLocationManagerActivity]#10(BLAST Consumer)10](id:75fe0000000a,api:0,p:-1,c:30206) disconnect
D/VRI[TSLocationManagerActivity](30206): dispatchAppVisibility visible:false
I/Amplify Flutter(30206): Added Core plugin
D/DeviceInfoPlugin(30206): Use TaskQueues.
D/FlutterGeolocator(30206): Geolocator foreground service connected
D/FlutterGeolocator(30206): Initializing Geolocator services
D/FlutterGeolocator(30206): Flutter engine connected. Connected engine count 2
D/VRI[MainActivity](30206): onFocusEvent false
D/VRI[MainActivity](30206): dispatchAppVisibility visible:false
D/VRI[MainActivity](30206): setWindowStopped stopped:true
I/SurfaceView(30206): 194058790 surfaceDestroyed
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#9(BLAST Consumer)9](id:75fe00000009,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueProducer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#9(BLAST Consumer)9](id:75fe00000009,api:0,p:-1,c:30206) disconnect: api -1
D/BufferQueueConsumer(30206): [SurfaceView[com.example.app/com.example.app.MainActivity]#9(BLAST Consumer)9](id:75fe00000009,api:0,p:-1,c:30206) disconnect
D/BufferQueueProducer(30206): [VRI[MainActivity]#8(BLAST Consumer)8](id:75fe00000008,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueConsumer(30206): [VRI[MainActivity]#8(BLAST Consumer)8](id:75fe00000008,api:0,p:-1,c:30206) disconnect
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/ColorModeChangeItem(30206): preExecute mColorMode=0,token=android.os.BinderProxy@92b0f49
D/WindowManager(30206): Add to mViews: DecorView@8eb3161[TSLocationManagerActivity],pkg= com.example.app
D/InputEventReceiver(30206): Input log is disabled
D/BufferQueueConsumer(30206): [](id:75fe0000000b,api:0,p:-1,c:30206) connect: controlledByApp=false
E/IPCThreadState(30206): attemptIncStrongHandle(84): Not supported
E/IPCThreadState(30206): attemptIncStrongHandle(43): Not supported
V/ZoomWindowDecorView(30206): setLastReportedMergedConfiguration mZoomDisplayHeight: 2412 getDecorView.149631329
D/BufferQueueProducer(30206): [VRI[TSLocationManagerActivity]#11(BLAST Consumer)11](id:75fe0000000b,api:1,p:30206,c:30206) connect: api=1 producerControlledByApp=true
D/VRI[TSLocationManagerActivity](30206): registerCallbacksForSync syncBuffer=false
D/VRI[TSLocationManagerActivity](30206): draw finished.
W/Settings(30206): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/VRI[TSLocationManagerActivity](30206): dispatchAppVisibility visible:false
D/FlutterGeolocator(30206): Detaching Geolocator from activity
D/FlutterGeolocator(30206): Flutter engine disconnected. Connected engine count 1
D/FlutterGeolocator(30206): Disposing Geolocator services
E/FlutterGeolocator(30206): Geolocator position updates stopped
E/FlutterGeolocator(30206): There is still another flutter engine connected, not stopping location service
D/OplusScrollToTopManager(30206): unregisterGuidePopupDismissReceiverInSystemUI
D/OplusScrollToTopManager(30206): Receiver not registered: android.view.OplusScrollToTopManager$1@b9f937d
D/OplusScrollToTopManager(30206): unregisterSystemUIBroadcastReceiver 
D/OplusScrollToTopManager(30206): java.lang.IllegalArgumentException: Receiver not registered: android.view.OplusScrollToTopManager$2@1901272
V/ZoomWindowDecorView(30206): removeZoomView
D/VRI[TSLocationManagerActivity](30206): setWindowStopped stopped:true
D/OplusScrollToTopManager(30206): unregisterGuidePopupDismissReceiverInSystemUI
D/OplusScrollToTopManager(30206): Receiver not registered: android.view.OplusScrollToTopManager$1@b2b7dca
D/OplusScrollToTopManager(30206): unregisterSystemUIBroadcastReceiver 
D/OplusScrollToTopManager(30206): java.lang.IllegalArgumentException: Receiver not registered: android.view.OplusScrollToTopManager$2@6144b3b
V/ZoomWindowDecorView(30206): removeZoomView
D/BufferQueueProducer(30206): [VRI[TSLocationManagerActivity]#11(BLAST Consumer)11](id:75fe0000000b,api:1,p:30206,c:30206) disconnect: api 1
D/BufferQueueConsumer(30206): [VRI[TSLocationManagerActivity]#11(BLAST Consumer)11](id:75fe0000000b,api:0,p:-1,c:30206) disconnect

christocracy commented 1 year ago

I do not have a OnePlus device running Android 13 (OnePlus A5010 @ 9.0.0).

My only Android 13 devices are

I cannot reproduce any problem on these devices using your reproduction steps.

Also, the stacktrace does not reference anything from the plugin (com.transistorsoft)

I notice you are also using the geolocator plugin: ("Geolocator foreground service connected").

habil-yaway commented 1 year ago

Yes, that is the problem also we are experiencing. Basically, we can only reproduce it only on the single device.

There are references to TSLocationmanager just before crash. Moreover, even we removed geolocator from our app just to make sure if there is some conflict between plugins, it crashed again.

However, when we do not start the flutter_background_geolocation plugin in the app. Everything works fine.

christocracy commented 1 year ago

Have you searched your error?

java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.example.app

habil-yaway commented 1 year ago

Have you searched your error?

java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.example.app

Yes, it is not related to the crash. In addition to that we have reproduced it in the example app in play store. The app crashes in background on airplane mode toggle. Please see the attached video.

https://github.com/transistorsoft/flutter_background_geolocation/assets/118435688/b2120352-958f-410a-b0db-c780db6cf3b1

christocracy commented 1 year ago

You can disable TSLocationManagerActivuty with Config.disableLocationAuthorizationAlert

habil-yaway commented 1 year ago

You can disable TSLocationManagerActivuty with Config.disableLocationAuthorizationAlert

Thanks for the quick reply @christocracy . Could you please elaborate on the config's relevance to the issue. Do you mean that this can prevent crash, as it will not register listeners for the provider?

christocracy commented 1 year ago

Read the api docs. Try it and see.

comancheo commented 1 year ago

Hello @christocracy, I must say, I had the same issue, which was fixed by disabling this config (setting to true). Wouldn't be helpful to fix or mention this issue in docs? I mean, this must be problem all around newer Androids.

Plugin version: 4.13.3 (happened in 4.10.1 also) Platform: Android OS version: Android 13 Device manufacturer / model: Samsung SM M135F

[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.22621.2506], locale cs-CZ)
    • Flutter version 3.13.9 on channel stable at C:\Users\coman\fvm\versions\3.13.9
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (8 days ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\coman\AppData\Local\Android\sdk
    • Platform android-TiramisuPrivacySandbox, build-tools 33.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop Windows apps (Visual Studio Build Tools 2017 15.9.33)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
    • Visual Studio Build Tools 2017 version 15.9.28307.1401
    • Windows 10 SDK version 10.0.17763.0
    X Visual Studio 2019 or later is required.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2022.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = C:\Program Files\Android\Android Studio
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[√] VS Code (version 1.83.1)
    • VS Code at C:\Users\coman\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.74.0

[√] Connected device (4 available)
    • SM M135F (mobile) • RF8T807H77A • android-arm    • Android 13 (API 33)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.22621.2506]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 118.0.5993.90
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 118.0.2088.76

[√] Network resources
    • All expected network resources are available.

Config

     locationTimeout: 10,
      httpTimeout: 10000,
      desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
      disableElasticity: false,
      heartbeatInterval: 60,
      logLevel: bg.Config.LOG_LEVEL_DEBUG,
      stopOnTerminate: false,
      startOnBoot: true,
      debug: false, //means sound off
      reset: true,
      locationAuthorizationRequest: 'Always',
      persistMode: bg.Config.PERSIST_MODE_LOCATION,
      notification: bg.Notification(
        smallIcon: 'drawable/notification_icon',
        largeIcon: 'drawable/notification_icon',
        title: 'geolocation_service_notification_title'.tr,
        text: 'geolocation_service_notification_text'.tr,
        sticky: true,
      ),
      httpRootProperty: ".",
      locationsOrderDirection: 'DESC',
      // maxRecordsToPersist: 1000,
      autoSync: false,
      batchSync: true,
      maxBatchSize: 10,
      stopTimeout: 0,
      stopOnStationary: false,
      maxDaysToPersist: 2,
      logMaxDays: 2,
      backgroundPermissionRationale: bg.PermissionRationale(
        title: 'geolocation_service_permission_title'.tr,
        message: 'geolocation_service_permission_body'.tr, //"This app collects location data to enable reporting of your location to your employer. This data is transmitted to your employer's servers and is not shared with any third parties."
        positiveAction: 'geolocation_service_permission_positive_action'.tr, 
        negativeAction: 'geolocation_service_permission_negative_action'.tr, 

Behavior:

  1. start plugin + toggleEnabled
  2. Put app to background
  3. Switch off Wifi or GPS or put to AIRPLANE 4.A. If GPS is off, the dialog window is opened after dismiss app is killed 4.B. If it is just Wifi app is just killed

    Possible fix

    disableLocationAuthorizationAlert: true

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 6 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.