Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MM] Permission Denial requires android.permission.ACCESS_COARSE_LOCATION #68

Open
xuefer opened this issue Mar 4, 2016 · 8 comments
Open

Comments

@xuefer
Copy link

xuefer commented Mar 4, 2016

android 6.0.1, UnifiedNlp.apk (1.6.1)

after installing UnifiedNlp, Location perimssion default to "off"
selecting any location backend raise the following exception in log

03-04 23:14:50.335  9088 10256 W ActivityManager: Permission Denial: Accessing service ComponentInfo{org.microg.nlp.backend.ichnaea/org.microg.nlp.backend.ichnaea.BackendService} from pid=12474, uid=10080 requires2 android.permission.ACCESS_COARSE_LOCATION
03-04 23:14:50.336 12474 12474 D AndroidRuntime: Shutting down VM
03-04 23:14:50.338 12474 12474 E AndroidRuntime: FATAL EXCEPTION: main
03-04 23:14:50.338 12474 12474 E AndroidRuntime: Process: org.microg.nlp, PID: 12474
03-04 23:14:50.338 12474 12474 E AndroidRuntime: Theme: themes:{}
03-04 23:14:50.338 12474 12474 E AndroidRuntime: java.lang.SecurityException: Not allowed to bind to service Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.microg.nlp.backend.ichnaea cmp=org.microg.nlp.backend.ichnaea/.BackendService }
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1334)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.app.ContextImpl.bindService(ContextImpl.java:1298)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.content.ContextWrapper.bindService(ContextWrapper.java:610)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at org.microg.nlp.ui.AbstractBackendPreference.enableBackend(AbstractBackendPreference.java:208)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at org.microg.nlp.ui.AbstractBackendPreference$Adapter$1.onClick(AbstractBackendPreference.java:175)03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.view.View.performClick(View.java:5204)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.widget.CompoundButton.performClick(CompoundButton.java:122)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.view.View$PerformClick.run(View.java:21156)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:739)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5466)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
03-04 23:14:50.338 12474 12474 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-04 23:14:50.339  9088 10145 W ActivityManager:   Force finishing activity org.microg.nlp/.ui.SettingsActivity

UnifiedNlp is not requesting permission automatically like it should. same applies to the backend apps made by you, like IchnaeaNlpBackend which crash after selected this backend and pressing "ok"

i suppose it's called runtime permissions under 6.0
apps like org.fitchfamily.android.wifi_backend, however can request for permission at runtime

yes we can grant permission manually in app permission setting dialog
but chance are only after first installation but before it is used by system (hack or custom framework-res.apk/config.xml + reboot), i can grant permission in UnifiedNlp app permission setting page to avoid this issue

after reboot, since UnifiedNlp is used as system NLP, I can no longer grant permission because it looks like permission is already granted while it's not. (seems like 6.0 bug). can't even toggle it off

@mar-v-in
Copy link
Member

mar-v-in commented Mar 4, 2016

With 859fbd4 you should be able to grant the permission in self-check. Self-check is considered an intermediate fix until we have a nice setup wizard.
The problem with runtime permissions is that they require a UI to ask for permission. This is why the UnifiedNlp API was updated recently with the possibility to open a UI on activation.

@xuefer
Copy link
Author

xuefer commented Mar 5, 2016

regarding to "setup wizard" please also consider the permission in backends
and prefer to make it "just works" after installation. let's think about the scene: after i bundle UnifiedNlp and backends in my custom rom, i don't want to every user going through setup wizard wondering what is network location provider and consequence of the choices they're making. 1st thing come to my mind would be to default selected some or all backends
for those default to not selected, pop a notification like "xposed installer" do

@mar-v-in
Copy link
Member

mar-v-in commented Mar 5, 2016

Please try again with 1.6.2 (first open Self-Check to verify that everything is fine).

@xuefer
Copy link
Author

xuefer commented Mar 5, 2016

thanks for packing 1.6.2. no more crashing, and permission almost works

pm revoke org.microg.nlp android.permission.ACCESS_COARSE_LOCATION

(learn for your old post)

after this, open self-check, the checkbox is not checked. click on the checkbox it won't change in visually. i had to reopen self-check to see it's granted already. it's not asking me for permission, maybe because i already granted or it's being used as system nlp? maybe we can ask for permission when unified nlp is used by system, and/or when UI is opened

@xuefer
Copy link
Author

xuefer commented Mar 5, 2016

upgraded AppleWifiNlpBackend has better permissin handling. as soon as i enable and press ok, it ask for location permission

but mozilla ichnaea backend on the other hand is old and crash with same steps. so you might want to update MLP like you did on AppleWifiNlpBackend

03-06 01:43:41.612 22078 22078 E AndroidRuntime: FATAL EXCEPTION: main
03-06 01:43:41.612 22078 22078 E AndroidRuntime: Process: org.microg.nlp.backend.ichnaea, PID: 22078
03-06 01:43:41.612 22078 22078 E AndroidRuntime: Theme: themes:{}
03-06 01:43:41.612 22078 22078 E AndroidRuntime: java.lang.SecurityException: Neither user 10147 nor current process has android.permission.ACCESS_COARSE_LOCATION.
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:1620)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:1573)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy.listenForSubscriber(ITelephonyRegistry.java:553)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at android.telephony.TelephonyManager.listen(TelephonyManager.java:2748)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at org.microg.nlp.api.CellBackendHelper.registerPhoneStateListener(CellBackendHelper.java:310)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at org.microg.nlp.api.CellBackendHelper.access$400(CellBackendHelper.java:53)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at org.microg.nlp.api.CellBackendHelper$1.run(CellBackendHelper.java:101)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:739)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5466)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-06 01:43:41.612 22078 22078 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)

@mar-v-in
Copy link
Member

mar-v-in commented Mar 5, 2016

What version of Ichnaea backend are you using?

@xuefer
Copy link
Author

xuefer commented Mar 5, 2016

oops, F-Droid didn't says no update today i thought 12 days was long ago. updated to v1.3.0 and fixed. now no backend left to worry about permissions. except UnifiedNlp

@rerbin
Copy link

rerbin commented Mar 9, 2016

UnifiedNlp 1.6.2 with IchnaeaNlpBackend 1.3 works well。Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@mar-v-in @xuefer @rerbin and others