n76 / DejaVu

Yet another network location backend for the UnifiedNLP/microG project
GNU General Public License v3.0
100 stars 18 forks source link

[SOLVED] Freeze on Android 6.0.1 #2

Closed breversa closed 6 years ago

breversa commented 6 years ago

Hi !

When I install Déjà Vu Location Service 1.0.2 from F-Droid on my LG G4/H815 running LineageOS 13/Android 6.0.1, my phone freezes as soon as I activate the backend in MicroG UnifiedNlp settings. After about two minutes, the phone will reboot and freeze again as soon as it has finished booting. Same if I reboot it beforehand.

I need to reboot to recovery (e.g. with adb reboot recovery) and delete /data/app/org.fitchfamily.android.dejavu for my phone to stop freezing.

n76 commented 6 years ago

Freeze meaning only the UI unresponsive or meaning totally dead? When that condition existed was it possible to connect with ADB and get a logcat? On reboot after deleting the app was there anything in dmsg or elsewhere that can give a clue to what was happening?

Without more information, and being unable to duplicate, it will be difficult to determine the cause.

breversa commented 6 years ago

I'm running more tests right now : only the UI is frozen.

I can adb shell logcat just fine. Anything in particular I should be looking for ?

breversa commented 6 years ago

Found something ! Just before the phone reboots, the logcat spits out this :

12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper: java.lang.NullPointerException: Attempt to invoke interface method 'android.os.Messenger android.net.wifi.IWifiManager.getWifiServiceMessenger()' on a null object reference
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at android.os.Parcel.readException(Parcel.java:1626)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at android.os.Parcel.readException(Parcel.java:1573)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at org.microg.nlp.api.LocationBackend$Stub$Proxy.update(LocationBackend.java:158)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at org.microg.nlp.location.BackendHelper.update(BackendHelper.java:71)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at org.microg.nlp.location.BackendHelper.onServiceConnected(BackendHelper.java:135)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1224)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1241)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at android.os.Handler.handleCallback(Handler.java:739)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at android.os.Handler.dispatchMessage(Handler.java:95)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at android.os.Looper.loop(Looper.java:148)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at android.app.ActivityThread.main(ActivityThread.java:5461)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at java.lang.reflect.Method.invoke(Native Method)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-18 18:14:30.418 30129 30129 W NlpLocBackendHelper:   at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
12-18 18:14:30.418 30129 30129 D NlpLocBackendHelper: Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.dejavu cmp=org.fitchfamily.android.dejavu/.BackendService }
12-18 18:14:30.419 31405 31660 D DejaVu Backend: onClose()
12-18 18:14:30.419 30191 30191 D AndroidRuntime: Shutting down VM
12-18 18:14:30.419 30191 30191 E AndroidRuntime: Error reporting crash
12-18 18:14:30.419 30191 30191 E AndroidRuntime: android.os.DeadObjectException
12-18 18:14:30.419 30191 30191 E AndroidRuntime:        at android.os.BinderProxy.transactNative(Native Method)
12-18 18:14:30.419 30191 30191 E AndroidRuntime:        at android.os.BinderProxy.transact(Binder.java:503)
12-18 18:14:30.419 30191 30191 E AndroidRuntime:        at android.app.ActivityManagerProxy.getConfiguration(ActivityManagerNative.java:3969)
12-18 18:14:30.419 30191 30191 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:88)
12-18 18:14:30.419 30191 30191 E AndroidRuntime:        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
12-18 18:14:30.419 30191 30191 E AndroidRuntime:        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
12-18 18:14:30.419 30191 30191 I Process : Sending signal. PID: 30191 SIG: 9
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper: java.lang.IllegalArgumentException: Receiver not registered: org.fitchfamily.android.dejavu.BackendService$1@3712dac
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at android.os.Parcel.readException(Parcel.java:1624)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at android.os.Parcel.readException(Parcel.java:1573)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at org.microg.nlp.api.LocationBackend$Stub$Proxy.close(LocationBackend.java:179)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at org.microg.nlp.location.BackendHelper.close(BackendHelper.java:119)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at org.microg.nlp.AbstractBackendHelper.unbind(AbstractBackendHelper.java:66)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at org.microg.nlp.location.BackendHelper.update(BackendHelper.java:78)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at org.microg.nlp.location.BackendHelper.onServiceConnected(BackendHelper.java:135)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1224)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1241)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at android.os.Handler.handleCallback(Handler.java:739)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at android.os.Handler.dispatchMessage(Handler.java:95)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at android.os.Looper.loop(Looper.java:148)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at android.app.ActivityThread.main(ActivityThread.java:5461)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at java.lang.reflect.Method.invoke(Native Method)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-18 18:14:30.423 30129 30129 W NlpLocBackendHelper:   at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
breversa commented 6 years ago

Also, this :

12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper: java.lang.SecurityException: getAllCellInfo: Neither user 10139 nor current process has android.permission.ACCESS_COARSE_LOCATION.
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at android.os.Parcel.readException(Parcel.java:1620)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at android.os.Parcel.readException(Parcel.java:1573)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at org.microg.nlp.api.LocationBackend$Stub$Proxy.update(LocationBackend.java:158)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at org.microg.nlp.location.BackendHelper.update(BackendHelper.java:71)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at org.microg.nlp.location.BackendFuser.update(BackendFuser.java:83)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at org.microg.nlp.location.ThreadHelper.run(ThreadHelper.java:73)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:278)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:270)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
12-18 18:17:52.822  3252  5580 W NlpLocBackendHelper:   at java.lang.Thread.run(Thread.java:818)
12-18 18:17:52.823  3252  5580 D NlpLocBackendHelper: Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.microg.nlp.backend.ichnaea cmp=org.microg.nlp.backend.ichnaea/.BackendService }
12-18 18:17:52.829  3252  3264 V NlpLocationProvider: onSetRequest: ProviderRequest[ON interval=+24h0m0s0ms] by WorkSource{1000 android}
12-18 18:17:52.829  3252  3264 V NlpLocationProvider: using autoUpdate=true autoTime=86400000

and

12-18 18:20:03.754  6694  6694 W PackageManager: Not granting permission android.permission.ACCESS_COARSE_LOCATION to package org.fitchfamily.android.dejavu because it was previously installed without
12-18 18:20:03.754  6694  6694 W PackageManager: Not granting permission android.permission.ACCESS_FINE_LOCATION to package org.fitchfamily.android.dejavu because it was previously installed without

I guess the UI gets caught in something when trying to display LineageOS' Privacy Guard or Android window requesting access to my location.

n76 commented 6 years ago

Looks like when the backend was selected in the microG settings it was not given the permissions it asked for.

I think you are in a "catch-22" situation here as you will need the UI to grant permissions but the UI is not available to you. I think you can get out of this by:

  1. Uninstalling the back end via ADB
  2. Rebooting
  3. Selecting some other backend in microG (just to insure its settings are cleared up)
  4. Reinstall the Déjá Vu back end being sure to grant permissions when you select it in microG.

I thought I'd properly coded the back end to fail in a soft way when it was not granted permissions but it seems not from your logcat snippets. I'll investigate further.

n76 commented 6 years ago

In addition to request to permission on initial setup, added checks that permissions were actually granted in various places to avoid crashing microG.

breversa commented 6 years ago

Thank you for your reply. I'll wait for a newer release to pop up on F-Droid and give it another try. I'm pretty satisfied with the behaviour on Android 7 devices. :-)

BTW, I understand that Déjà Vu allows to "remember" where I've been, but I also use your other LocalGSMBackend for coarse location where I haven't been (yet), by downloading the cells database in advance. Do both backends risk conflicting with each other or not ?

n76 commented 6 years ago

There is no conflict using multiple backends: It appears that UnifiedNlp/microG uses the location that reports the best accuracy.

breversa commented 6 years ago

That's what I thought. Thank you for your confirmation.

breversa commented 6 years ago

@n76 : I followed your previous instructions, with Déjà Vu 1.0.4 (latest version available on F-Droid as of today), with LineageOS Privacy Guard NOT enabled for that app, to no avail… :-(

My guess is that Déjà Vu locks because of that :

12-18 18:20:03.754  6694  6694 W PackageManager: Not granting permission android.permission.ACCESS_COARSE_LOCATION to package org.fitchfamily.android.dejavu because it was previously installed without
12-18 18:20:03.754  6694  6694 W PackageManager: Not granting permission android.permission.ACCESS_FINE_LOCATION to package org.fitchfamily.android.dejavu because it was previously installed without

Since permissions were previously refused (How ? When ? No idea…), they seem not to be asked again. Is there any way to make Android forget about that ?

EDIT : I had a quick look at your code (https://github.com/n76/DejaVu/commit/30c480e32de695c39742cb264d8cc071316e112e), and read that the permissions handling is done by MicroG/UnifiedNlp. FWIW, I'm using 1.6.8

ale5000-git commented 6 years ago

@breversa: Try to disable the backend and press OK, then re-enable the backend and press OK. It should re-ask for permissions.

breversa commented 6 years ago

I just did it, but sadly it doesn't change a thing. Also, I haven't met that issue with devices running Android 7.0.1 (Samsung Galaxy S4 and Tab 3 ; LG G4).

ale5000-git commented 6 years ago

@breversa: Have you tried to re-install it directly from the apk here (without uninstalling it)?

breversa commented 6 years ago

Same, no luck. :-(

I also tried the following, with the same result :

breversa commented 6 years ago

SOLVED ! :-D

This seems to be a LineageOS 13 issue : I had Settings/Privacy/Data protection turned on by default, and it prompts another location permission window, usually after Android's.

And sometimes, for some reason, that LineageOS permission window might get stuck under another UI element, while blocking all screen interaction until it's been answered ("catch-22", for english speakers, like @n76 said). From what I understand, this issue has been solved in LineageOS 14.

I solved the issue by doing the following :