microg / microg/UnifiedNlp

[MM] Permission Denial requires android.permission.ACCESS_COARSE_LOCATION

Open
#68 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
221
PR merge metrics
No merged PRs in 30d

Description

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
##

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at org.microg.nlp.ui.AbstractBackendPreference.enableBackend, identified at AbstractBackendPreference.java:208, and trace the permission flow when a location backend is selected. Compare UnifiedNlp and the backend apps with the reported Android 6.0 runtime-permission behavior. Done means selecting a backend no longer produces the reported SecurityException when ACCESS_COARSE_LOCATION is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.