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

Runtime permissions - External Storage permission #3118

Closed
wants to merge 2 commits into from
Closed

Runtime permissions - External Storage permission #3118

wants to merge 2 commits into from

Conversation

philipwhiuk
Copy link
Contributor

Contacts is more deeply embedded so that's a bit more work. But here's a PR for the external storage permission handling.

@cketti
Copy link
Member

cketti commented Jan 25, 2018

The change to Accounts shouldn't be necessary because we don't use direct access to external storage when exporting settings on KitKat and above. See:

https://github.com/k9mail/k-9/blob/a36254dbc0fcd2f307126cf644c0c26c8d557cb0/k9mail/src/main/java/com/fsck/k9/activity/Accounts.java#L1929-L1939

I'd like us to use the same approach for "save attachment" instead of requesting external storage permission when saving attachments. See #2844.

We still allow the user to move the message database to external storage. In that case we also need to request the permission.

@philipwhiuk
Copy link
Contributor Author

Yeah, I saw this is as a short term easier fix. I'll remove it for Accounts though.

fat-tire added a commit to fat-tire/k-9 that referenced this pull request Jan 31, 2018
WHAT THIS HOPEFULLY DOES DO:

* Update gradle plugin to latest to date in Android Studio 3.1 beta 1
* Update gradle from 3.3 to 4.5 release
* Update target API from 22 to 27 (min now 14)
* Update to Java 1.8
* Enable new Dex compiler
* Use new "implementation" syntax in build.gradle
* Update (most?) non-testing google/3rd party libraries to latest
* Add simple default notification channel (for Android 8+ compatibility)

THIS DOES NOT:

*  Do a full material conversion (I see this was already started in
   PR thunderbird#3124) although it has been tested on chromebooks with material
   design and looks cool.
*  Check runtime permissions (this has been started in PR thunderbird#3118).  If you
   don't manually grant permissions in settings, it will likely crash.
*  Update most testImplementation libraries
fat-tire added a commit to fat-tire/k-9 that referenced this pull request Jan 31, 2018
WHAT THIS HOPEFULLY DOES DO:

* Update gradle plugin to latest to date in Android Studio 3.1 beta 1
* Update gradle from 3.3 to 4.5 release
* Update target API from 22 to 27 (min now 14)
* Update to Java 1.8
* Enable new Dex compiler
* Use new "implementation" syntax in build.gradle
* Update (most?) non-testing google/3rd party libraries to latest
* Add simple default notification channel (for Android 8+ compatibility)

THIS DOES NOT:

*  Do a full material conversion (I see this was already started in
   PR thunderbird#3124) although it has been tested on chromebooks with material
   design and looks cool.
*  Check runtime permissions (this has been started in PR thunderbird#3118).  If you
   don't manually grant permissions in settings, it will likely crash.
*  Update most testImplementation libraries
fat-tire added a commit to fat-tire/k-9 that referenced this pull request Feb 1, 2018
The approach was to make it so that any K9Activity can easily request
whatever permission in the future.

The Contacts permission is now requested in two locations:

1.  When a list of Messages is displayed
2.  When a new message is first started to be composed.

The permission request is displayed ONCE per onCreate(). Any more than this
and it got really annoying.  A typical user who reads or writes emails
WILL see the request, trust me.  Once they see the message 2x, they
also have the option to block the requests from appearing.

If they DECLINE the request (or decline + DENY any further attempts),
the app should continues to work, albeit without incorporating contact data
(thumbnails, autocomplete, etc.). Contacts may still be added to the
Contacts app, as this uses an Intent and does not require any permission.

Once the Read Contacts permission is enabled, the app immediately begins
to use it.

To add other permissions in the future (such as External Storage access),
the request can be made in a similar way and the permission request result
handled appropriately by just adding it to K9Activity (or overriding in
a particular Activity).

I did *not* implement this for external storage access, as 1. there is a PR
waiting (thunderbird#3118) and 2. I think that using the Storage Access Framework
is a much better way to approach that as suggested in Issue thunderbird#2844.

I noticed there are 3 additional custom permissions in the manifest having
to do with other apps controlling K9, but I don't think they're required by
k9 itself.  If so, they can be requested from any K9Activity.
fat-tire added a commit to fat-tire/k-9 that referenced this pull request Feb 9, 2018
WHAT THIS HOPEFULLY DOES DO:

* Update gradle plugin to latest to date in Android Studio 3.1 beta 1
* Update gradle from 3.3 to 4.5 release
* Update target API from 22 to 27 (min now 14)
* Update to Java 1.8
* Enable new Dex compiler
* Use new "implementation" syntax in build.gradle
* Update (most?) non-testing google/3rd party libraries to latest
* Add simple default notification channel (for Android 8+ compatibility)

THIS DOES NOT:

*  Do a full material conversion (I see this was already started in
   PR thunderbird#3124) although it has been tested on chromebooks with material
   design and looks cool.
*  Check runtime permissions (this has been started in PR thunderbird#3118).  If you
   don't manually grant permissions in settings, it will likely crash.
*  Update most testImplementation libraries
fat-tire added a commit to fat-tire/k-9 that referenced this pull request Feb 9, 2018
The approach was to make it so that any K9Activity can easily request
whatever permission in the future.

The Contacts permission is now requested in two locations:

1.  When a list of Messages is displayed
2.  When a new message is first started to be composed.

The permission request is displayed ONCE per onCreate(). Any more than this
and it got really annoying.  A typical user who reads or writes emails
WILL see the request, trust me.  Once they see the message 2x, they
also have the option to block the requests from appearing.

If they DECLINE the request (or decline + DENY any further attempts),
the app should continues to work, albeit without incorporating contact data
(thumbnails, autocomplete, etc.). Contacts may still be added to the
Contacts app, as this uses an Intent and does not require any permission.

Once the Read Contacts permission is enabled, the app immediately begins
to use it.

To add other permissions in the future (such as External Storage access),
the request can be made in a similar way and the permission request result
handled appropriately by just adding it to K9Activity (or overriding in
a particular Activity).

I did *not* implement this for external storage access, as 1. there is a PR
waiting (thunderbird#3118) and 2. I think that using the Storage Access Framework
is a much better way to approach that as suggested in Issue thunderbird#2844.

I noticed there are 3 additional custom permissions in the manifest having
to do with other apps controlling K9, but I don't think they're required by
k9 itself.  If so, they can be requested from any K9Activity.
fat-tire added a commit to fat-tire/k-9 that referenced this pull request Feb 10, 2018
WHAT THIS HOPEFULLY DOES DO:

* Update gradle plugin to latest to date in Android Studio 3.1 beta 1
* Update gradle from 3.3 to 4.5 release
* Update target API from 22 to 27 (min now 14)
* Update to Java 1.8
* Enable new Dex compiler
* Use new "implementation" syntax in build.gradle
* Update (most?) non-testing google/3rd party libraries to latest
* Add simple default notification channel (for Android 8+ compatibility)

THIS DOES NOT:

*  Do a full material conversion (I see this was already started in
   PR thunderbird#3124) although it has been tested on chromebooks with material
   design and looks cool.
*  Check runtime permissions (this has been started in PR thunderbird#3118).  If you
   don't manually grant permissions in settings, it will likely crash.
*  Update most testImplementation libraries
fat-tire added a commit to fat-tire/k-9 that referenced this pull request Feb 10, 2018
The approach was to make it so that any K9Activity can easily request
whatever permission in the future.

The Contacts permission is now requested in two locations:

1.  When a list of Messages is displayed
2.  When a new message is first started to be composed.

The permission request is displayed ONCE per onCreate(). Any more than this
and it got really annoying.  A typical user who reads or writes emails
WILL see the request, trust me.  Once they see the message 2x, they
also have the option to block the requests from appearing.

If they DECLINE the request (or decline + DENY any further attempts),
the app should continues to work, albeit without incorporating contact data
(thumbnails, autocomplete, etc.). Contacts may still be added to the
Contacts app, as this uses an Intent and does not require any permission.

Once the Read Contacts permission is enabled, the app immediately begins
to use it.

To add other permissions in the future (such as External Storage access),
the request can be made in a similar way and the permission request result
handled appropriately by just adding it to K9Activity (or overriding in
a particular Activity).

I did *not* implement this for external storage access, as 1. there is a PR
waiting (thunderbird#3118) and 2. I think that using the Storage Access Framework
is a much better way to approach that as suggested in Issue thunderbird#2844.

I noticed there are 3 additional custom permissions in the manifest having
to do with other apps controlling K9, but I don't think they're required by
k9 itself.  If so, they can be requested from any K9Activity.
fat-tire added a commit to fat-tire/k-9 that referenced this pull request Feb 10, 2018
WHAT THIS HOPEFULLY DOES DO:

* Update gradle plugin to latest to date in Android Studio 3.1 beta 1
* Update gradle from 3.3 to 4.5 release
* Update target API from 22 to 27 (min now 14)
* Update to Java 1.8
* Enable new Dex compiler
* Use new "implementation" syntax in build.gradle
* Update (most?) non-testing google/3rd party libraries to latest
* Add simple default notification channel (for Android 8+ compatibility)

THIS DOES NOT:

*  Do a full material conversion (I see this was already started in
   PR thunderbird#3124) although it has been tested on chromebooks with material
   design and looks cool.
*  Check runtime permissions (this has been started in PR thunderbird#3118).  If you
   don't manually grant permissions in settings, it will likely crash.
*  Update most testImplementation libraries
fat-tire added a commit to fat-tire/k-9 that referenced this pull request Feb 10, 2018
The approach was to make it so that any K9Activity can easily request
whatever permission in the future.

The Contacts permission is now requested in two locations:

1.  When a list of Messages is displayed
2.  When a new message is first started to be composed.

The permission request is displayed ONCE per onCreate(). Any more than this
and it got really annoying.  A typical user who reads or writes emails
WILL see the request, trust me.  Once they see the message 2x, they
also have the option to block the requests from appearing.

If they DECLINE the request (or decline + DENY any further attempts),
the app should continues to work, albeit without incorporating contact data
(thumbnails, autocomplete, etc.). Contacts may still be added to the
Contacts app, as this uses an Intent and does not require any permission.

Once the Read Contacts permission is enabled, the app immediately begins
to use it.

To add other permissions in the future (such as External Storage access),
the request can be made in a similar way and the permission request result
handled appropriately by just adding it to K9Activity (or overriding in
a particular Activity).

I did *not* implement this for external storage access, as 1. there is a PR
waiting (thunderbird#3118) and 2. I think that using the Storage Access Framework
is a much better way to approach that as suggested in Issue thunderbird#2844.

I noticed there are 3 additional custom permissions in the manifest having
to do with other apps controlling K9, but I don't think they're required by
k9 itself.  If so, they can be requested from any K9Activity.
@wiktor-k
Copy link
Contributor

Can this be closed in favor of #3818?

@Valodim
Copy link
Contributor

Valodim commented Dec 14, 2018

Yup 👍

@Valodim Valodim closed this Dec 14, 2018
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

Successfully merging this pull request may close these issues.

None yet

4 participants