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

RequestStoragePermissionActivity infinite loop on M #422

Closed
dbarwacz opened this issue Feb 11, 2016 · 8 comments
Closed

RequestStoragePermissionActivity infinite loop on M #422

dbarwacz opened this issue Feb 11, 2016 · 8 comments

Comments

@dbarwacz
Copy link

Using leak canary requires external storage permission. On android 6 runtime permissions come into play. Unfortunately, if original app does not define this permission as requested, attempt to turn it on from notification issued by leak canary silently crashes.
I don't know how app + leak canary hybrid works but: is there a way to attach required permission / add permissions paragraph to instruction?


Edit by py: this is an infinite loop with RequestStoragePermissionActivity when the storage permission is permanently not granted.

@fingertricks
Copy link

Possible duplicate of #382 ?

@dbarwacz
Copy link
Author

I don't think so, I see no problem observed by reporter. The notification is issued (as this was fix for mentioned issue) but there is the problem to enable storage permission when original app does not request it in manifest.

@fingertricks
Copy link

What version of the library are you using?

Can you post a crash stack?

@dbarwacz
Copy link
Author

Version 1.4-beta1
Actually, there is none, it enters loop of:

02-12 17:23:19.204 795-810/? I/ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller cmp=com.android.packageinstaller/.permission.ui.GrantPermissionsActivity (has extras)} from uid 10206 on display 0
02-12 17:23:19.266 795-30678/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@788dfaf attribute=null, token = android.os.BinderProxy@f4ee742

@dbarwacz
Copy link
Author

This is weird, I tried to debug it and the only thing that happens there is RequestStoragePermissionActivity.class is launched.

@dbarwacz
Copy link
Author

dbarwacz commented Mar 7, 2016

I think debug app should specify that it wants to request storage permission in runtime. During manifest merging of final apk, debug versions would have external storage persmissions available, release builds would not. That might break certain setups but the only other solution I see is:

  • app has no storage permissions, check if storage request has been specified:
    • NOT:, tell developer to add that params in debug builds
    • YES: request permission from user.

@kaibookblue
Copy link

Not sure if this is related but I saw the same thing on our app. We ask for that permission in app but as it's not essential I had declined with don't ask again. When LC kicked in I saw the notification saying it needed permission but when I tapped on the notification I got into the same loop as mentioned.

@pyricau
Copy link
Member

pyricau commented Mar 20, 2016

Pretty sure it's caused by this: https://github.com/square/leakcanary/blob/master/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/RequestStoragePermissionActivity.java#L42

I've been lazy and didn't do the result checking.

Not sure what we should do when the permission is refused after we ask.

@pyricau pyricau changed the title Permission exception on android 6 RequestStoragePermissionActivity infinite loop on M Mar 20, 2016
pyricau added a commit that referenced this issue Mar 30, 2016
If the storage permission is denied, don't retry, just show a toast.

Fixes #422
pyricau added a commit that referenced this issue Mar 30, 2016
If the storage permission is denied, don't retry, just show a toast.

Fixes #422
pyricau added a commit that referenced this issue Mar 30, 2016
If the storage permission is denied, don't retry, just show a toast.

Fixes #422
Pengchengxiang pushed a commit to XLibrarys/leakcanary that referenced this issue Jan 2, 2017
If the storage permission is denied, don't retry, just show a toast.

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

No branches or pull requests

4 participants