You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have installed owncloud on a fresh android 6 system.
After installing I could not download any file because the "storage" permission was not granted.
This should, according to the new permission system, catched during runtime and the user should be asked if one wants to grant this permission.
We can implement this via the AppCompat lib so it works in a backwards compatible way :) What suprises me a little is the fact that the storage permission is missing since that would lead to the same problem on any Android version and Android 6 still supports the now legacy permission model?!
I deployed a permissions requsting implementation for WRITE_EXTERNAL_STORAGE in the Marshmallow branch and the beta version 😀
This also means I implemented the new permissions API introduced with Android M in a backwards compatible (yet untested) way. Relevant commit can be checked out here: 3732352
Requesting the write permission leads to also getting the read permission when the write permission is granted by the user.
Looping in @jancborchardt@masensio@davivel@przybylski and also @LukasReschke since this is just a simple implementation to get the app working again for Marshmallow compile targeting (and the beta) but this has some impact on user interaction and is also a security/permissions topic in general. The implementation basically works like dropbox, that means whenever you open up the app the first time, add your first account and open up the list (after hitting the connect button) the app will ask you for the external storage access right. It will always ask for the right if it hasn't been granted since with compiling against v23 the app simple won't let you browse the storage, download or upload files - at least not on Marshmallow.
In Marshmallow rights can be revoked even after installing the app and this is mainly why the check has to happen over and over again. In case the permission has been denied or revoked the app now shows a snack-bar with an explanation on why the user needs to grant the right (see screenshot 1). After the user clicks OK, the permission dialog pops up the give the user the possibility to grant the right (screenshot 2).
Screenshot 1 @jancborchardt the OK text color can be changed afaik, just let me know which color you prefer, in case we stick with the snackbar implementation...
Screenshot 2
Looping you all in since this change has an impact on user interaction and will whenever my Marshmallow PR gets merged will also impact the way we deal with permissions.
Imho there are thus 2 issues that need to be discussed:
where do we check for permissions and get them granted? (right now I request it like Dropbox right at the beginning, another way would be to do it everywhere the permission is actually needed, which is nearly impossible to handle regarding background syncs but it might work for other permissions than the external storage access)
how do we ask for the permissions after a denial/revoke of the right? (I now did it with a snackbar which is basically a non-blocking operation)
The implementation can be checked out on the beta branch
@przybylski and @tobiasKaminsky can the two of you also test drive the latest beta branch since this is quite the change (technically not LoC wise) and shouldn't be released to f-droid before anyone besides me gave it a spin 😃
@przybylski I think seeing if this (still) works on a pre-Android-M device would be quite important since I have no idea how the AppCompat implementation behaves on older Android versions handling this...
If you can confirm it still works on your device that would be great (upload/download/instant-upload), probably with a fresh installation though (not sure if that changes anything...)
Proposal sounds good, this should be fixed for sure. :) A few remarks:
What does the »OK« button do? Open the popup? Is this the normal way also Dropbox does this? Shouldn’t we simply show the popup directly when a relevant action like upload/download is performed?
If the toast stays: Change wording to »Additional permissions required to upload & download files«, and color of »OK« to white.
Is the layout of the permissions popup standard then? Like the files icon, and the alignment of the »don’ŧ ask again« checkbox? Because at least the checkbox looks misaligned and should either be left aligned with the text above, or should be aligned so that the text of the checkbox label is left aligned with that text. ;)
@jancborchardt that is basically how it is :) I'm sorry if I wasn't specific/detailed enough.
Scenarios how the permission implementation works (which is also inline with Google's guidelines):
Scenarios:
User opens the app and the apps checks for the permission the first time: Screenshot 1 (permission pop up is shown)
permission pop up is shown)
User opens the app (restart) and has denied the permission earlier: Screenshot 2 (snackbar is shown with the so called "Rationale"), clicking "OK", Screenshot 1 (77e72f2)
User revokes the permission in the Android settings screen and then opens the app: Screenshot 2 (snackbar is shown with the so called "Rationale"), clicking "OK", Screenshot 1 (77e72f2)
To answer you other questions:
OK opens the permission popup
snackbar has been changed according to your comment, please review since now the text is white and the action also which makes you loose the visual for the action (except for capital letters and bold)
The permission pop up is part of Android so this always looks like that 😞 The checkbox is only shown in certain scenarios but that is also decided upon by Android itself not the app.
Screenshot of the snackbar now:
One "problem" still exists for now:
The user can still choose "DENY" and basically continue working with the app but nearly nothing will work. So do we want to deal with this, since we would basically have to check for persimissions and then ask for permissions and in case of denial block actions within the app. Example:
User opens the app the first time, denies the access write and the clicks on upload. The upload logic doesn't check for the permission yet, so it will open the upload list view but the list will be empty since the user denied access rights.
Imho the proper way would be to always check for the needed permission and then ask for it... But that also means quite some work but it would also mean the user gets asked for a certain permission in the relevant contexts.
To make an example for the read/write permission. Areas I can think of where this checks needs to be implemented:
before downloading a file
before uploading a file (via menu/FAB)
before activation instant upload (for photo and for video)
probably also somewhere where the user might be able to choose external storage (topic for @tobiasKaminsky and @przybylski)
Any comments on this? Looking forward to the discussion since this is really a general question.
@tobiasKaminsky@przybylski can you have a look at the implementation? I moved as much as I though makes sense to a PermissionUtil class and also created a colorSnackbar method in DisplayUtil to have this centralized but left anything else to the permission asking class. (implementation is available on the marshmallow branch and on beta)
@davivel Does it make sense to explicitly make the snackbar colors available to the setup.xml? ATM it is white so it probably doesn't make sence, but I can expose the values if you want me to (at least for snackbar text and action text color.
@davivel can you give me a hint where the app accesses contacts? Just asking since this permission is in the manifest and on Android M I can revoke this right but I have no idea where we would need to ask for it 😞
@AndyScherzinger As this "permission" PR seems to be getting more and more complex this should be definitivly in a new PR and not in "your" marshmallow branch.
So you need to revert these changes and instead open a PR against master.
[I will try to follow up with this discussion as soon as possible].
tl;dr the marhmallow branch breaks the app without having the permission api implementation. Thus permission PRs should target the marshmallow branch, be merged into this branch and after successful testing being merged into master (after the FAB branch merge though).
Unfortunately it will have to stay on this PR and the follow up PRs regarding permissions have to target the marshmallow branch. This is imho simply due to the fact that the change on the marshmallow branch (compiletarget = 23) basically breaks the permissions und thus with the change of the branch the permission implementation needs to be "updated" thus this all should be done on this branch and then the branch should be merged to master. It all has to be done here else one would have to redo the compile target update on the other permission branches which is quite some work and in order for the app to properly work all these changes need to be in place.
Thus I would vote for the process of having permission PRs targeting/based on the marshmallow branch.
Only reason to redo this branch would be to get rid of the FAB branch being the actual base for this branch.
Just my point of view though - up for discussion. Any comment from you guys @davivel@masensio what would work best for you?
You are right that the new permission "PR" would depend on this one.
But I thought it is easier to review a smaller PR.
The new permission PR can then depend on this one and once this one is merged it is very easy to merge the new one into master. But with this approach it is easier to review both PRs.
ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE)
while debugging returns 0 which says that the app is allowed to write.
But still the file is not delete-able.
No, not like #1626. That's a mistake I made during the uploads view refactoring, moving a temporary file that I should have removed.
I loosely remember the SD cards need special treatment from Android 5 or Android 6, and it stayed unnoticed for a time because Nexus devices didn't ship with SD card readers anymore. We should search for that information.
Right now I don't know of any case that makes this issue critical, I'd reschedule it to another release so that we have a fast bug-fixing 2.0.1 in the market.
An improvement easy to see is getting rid of the 'contacts' permission group that appears as requested by the app, but disabled by default, and that is not really needed. Is related to the permissions requested in the Manifest to access the AccountManager, but maybe not all of them are needed. With a review of the code of AccountUtils in the oc-library, we probably could remove some of those permissions and, with some luck, make the 'contacts' permission group disappear.
Activity
AndyScherzinger commentedon Dec 14, 2015
We can implement this via the AppCompat lib so it works in a backwards compatible way :) What suprises me a little is the fact that the storage permission is missing since that would lead to the same problem on any Android version and Android 6 still supports the now legacy permission model?!
ContextCompat should be able to handle all this: https://developer.android.com/training/permissions/requesting.html But since I haven't played around with this I have no feeling how easy this will work and if using ApPCompat means it will work completely backward compatible... Using this then means #1220 has to be merged first since permissions require AppCompat >= 23.x
AndyScherzinger commentedon Dec 29, 2015
I deployed a permissions requsting implementation for WRITE_EXTERNAL_STORAGE in the Marshmallow branch and the beta version 😀
This also means I implemented the new permissions API introduced with Android M in a backwards compatible (yet untested) way. Relevant commit can be checked out here: 3732352
Requesting the write permission leads to also getting the read permission when the write permission is granted by the user.
Looping in @jancborchardt @masensio @davivel @przybylski and also @LukasReschke since this is just a simple implementation to get the app working again for Marshmallow compile targeting (and the beta) but this has some impact on user interaction and is also a security/permissions topic in general. The implementation basically works like dropbox, that means whenever you open up the app the first time, add your first account and open up the list (after hitting the connect button) the app will ask you for the external storage access right. It will always ask for the right if it hasn't been granted since with compiling against v23 the app simple won't let you browse the storage, download or upload files - at least not on Marshmallow.
In Marshmallow rights can be revoked even after installing the app and this is mainly why the check has to happen over and over again. In case the permission has been denied or revoked the app now shows a snack-bar with an explanation on why the user needs to grant the right (see screenshot 1). After the user clicks OK, the permission dialog pops up the give the user the possibility to grant the right (screenshot 2).
Screenshot 1

@jancborchardt the OK text color can be changed afaik, just let me know which color you prefer, in case we stick with the snackbar implementation...
Screenshot 2

Looping you all in since this change has an impact on user interaction and will whenever my Marshmallow PR gets merged will also impact the way we deal with permissions.
Imho there are thus 2 issues that need to be discussed:
The implementation can be checked out on the beta branch
AndyScherzinger commentedon Dec 29, 2015
Any changes to the permission API implementation should target #1220 and the
target_marshmallowbranchAndyScherzinger commentedon Dec 29, 2015
@przybylski and @tobiasKaminsky can the two of you also test drive the latest beta branch since this is quite the change (technically not LoC wise) and shouldn't be released to f-droid before anyone besides me gave it a spin 😃
przybylski commentedon Dec 29, 2015
I don't have device with 6.0 so I guess I won't be a big help :( but ill have a look in the simulator
AndyScherzinger commentedon Dec 29, 2015
@przybylski I think seeing if this (still) works on a pre-Android-M device would be quite important since I have no idea how the AppCompat implementation behaves on older Android versions handling this...
If you can confirm it still works on your device that would be great (upload/download/instant-upload), probably with a fresh installation though (not sure if that changes anything...)
jancborchardt commentedon Dec 29, 2015
Proposal sounds good, this should be fixed for sure. :) A few remarks:
AndyScherzinger commentedon Dec 29, 2015
@jancborchardt that is basically how it is :) I'm sorry if I wasn't specific/detailed enough.
Scenarios how the permission implementation works (which is also inline with Google's guidelines):
Scenarios:
permission pop up is shown)
To answer you other questions:
Screenshot of the snackbar now:

One "problem" still exists for now:
Imho the proper way would be to always check for the needed permission and then ask for it... But that also means quite some work but it would also mean the user gets asked for a certain permission in the relevant contexts.
To make an example for the read/write permission. Areas I can think of where this checks needs to be implemented:
Any comments on this? Looking forward to the discussion since this is really a general question.
AndyScherzinger commentedon Dec 29, 2015
@tobiasKaminsky @przybylski can you have a look at the implementation? I moved as much as I though makes sense to a PermissionUtil class and also created a colorSnackbar method in DisplayUtil to have this centralized but left anything else to the permission asking class. (implementation is available on the marshmallow branch and on beta)
@davivel Does it make sense to explicitly make the snackbar colors available to the setup.xml? ATM it is white so it probably doesn't make sence, but I can expose the values if you want me to (at least for snackbar text and action text color.
AndyScherzinger commentedon Dec 29, 2015
@davivel can you give me a hint where the app accesses contacts? Just asking since this permission is in the manifest and on Android M I can revoke this right but I have no idea where we would need to ask for it 😞
tobiasKaminsky commentedon Dec 29, 2015
@AndyScherzinger As this "permission" PR seems to be getting more and more complex this should be definitivly in a new PR and not in "your" marshmallow branch.
So you need to revert these changes and instead open a PR against master.
[I will try to follow up with this discussion as soon as possible].
AndyScherzinger commentedon Dec 29, 2015
tl;dr the marhmallow branch breaks the app without having the permission api implementation. Thus permission PRs should target the marshmallow branch, be merged into this branch and after successful testing being merged into master (after the FAB branch merge though).
Unfortunately it will have to stay on this PR and the follow up PRs regarding permissions have to target the marshmallow branch. This is imho simply due to the fact that the change on the marshmallow branch (compiletarget = 23) basically breaks the permissions und thus with the change of the branch the permission implementation needs to be "updated" thus this all should be done on this branch and then the branch should be merged to master. It all has to be done here else one would have to redo the compile target update on the other permission branches which is quite some work and in order for the app to properly work all these changes need to be in place.
Thus I would vote for the process of having permission PRs targeting/based on the marshmallow branch.
Only reason to redo this branch would be to get rid of the FAB branch being the actual base for this branch.
Just my point of view though - up for discussion. Any comment from you guys @davivel @masensio what would work best for you?
tobiasKaminsky commentedon Dec 30, 2015
You are right that the new permission "PR" would depend on this one.
But I thought it is easier to review a smaller PR.
The new permission PR can then depend on this one and once this one is merged it is very easy to merge the new one into master. But with this approach it is easier to review both PRs.
20 remaining items
tobiasKaminsky commentedon Apr 27, 2016
ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE)
while debugging returns 0 which says that the app is allowed to write.
But still the file is not delete-able.
AndyScherzinger commentedon Apr 27, 2016
To be honest, I have no clue at the moment and I don't have any device with an sd card
tobiasKaminsky commentedon Apr 27, 2016
@davivel do you have an idea?
This can be related to #1626
davivel commentedon May 26, 2016
No, not like #1626. That's a mistake I made during the uploads view refactoring, moving a temporary file that I should have removed.
I loosely remember the SD cards need special treatment from Android 5 or Android 6, and it stayed unnoticed for a time because Nexus devices didn't ship with SD card readers anymore. We should search for that information.
Right now I don't know of any case that makes this issue critical, I'd reschedule it to another release so that we have a fast bug-fixing 2.0.1 in the market.
cc @rperezb @MTRichards @cmonteroluque
davivel commentedon Apr 11, 2017
Today we can say there is no problem pending.
An improvement easy to see is getting rid of the 'contacts' permission group that appears as requested by the app, but disabled by default, and that is not really needed. Is related to the permissions requested in the Manifest to access the AccountManager, but maybe not all of them are needed. With a review of the code of
AccountUtilsin the oc-library, we probably could remove some of those permissions and, with some luck, make the 'contacts' permission group disappear.EDIT: closed in favor of #1940