pyload / pyload-android

A modern and feature-rich Android client for pyLoad
https://f-droid.org/repository/browse/?fdid=org.pyload.android.client
64 stars 25 forks source link

Check & request operation missing before choosing container file #39

Closed aper-project closed 3 years ago

aper-project commented 3 years ago

Hi, there, I've found a issue in version 0.3.7, which is downloaded from F-Droid.

Description

This app does not check nd request the WRITE_EXTERNAL_STORAGE permission when I want choose a container file form storage. There are two unexpected behaviors:

  1. choose file page is empty until I grant this permission in the system setting
  2. it will crash if I continue chose Parent Directory

    Reproduce

    • Step 1 : Open pyLoad and select Add Links button. image
    • Step 2 : Click "CHOOSE" for choose container file Because this version does not check and request permission when I click "CHOOSE" button , no folders and files are read out on this page. image

The call chain related to this bug :

    org.pyload.android.client.module.FileChooser.onCreate(android.os.Bundle)void
     org.pyload.android.client.module.FileChooser.<clinit>()void
      android.os.Environment.getExternalStorageDirectory()java.io.File

@GammaC0de
Could you help me review this issue? Very thanks!

GammaC0de commented 3 years ago

Android support for checking for this setting starts from android 11.

aper-project commented 3 years ago

Android support for checking for this setting starts from android 11.

Which update do you refer to? It seems that Android cannot automatically check and request a certain permission. If that permission is missing and you call an API that requires the permission, it simply crashes.

Android 11's updates to the permission system: https://developer.android.com/about/versions/11/privacy/permissions

GammaC0de commented 3 years ago

I mean that there can be a fix for that but just for Android 11 and up, older versions (this app runs on 4.2 and up) cannot be dealt because of lack of support in the Android OS, they must set this settings manually

aper-project commented 3 years ago

I mean that there can be a fix for that but just for Android 11 and up, older versions (this app runs on 4.2 and up) cannot be dealt because of lack of support in the Android OS, they must set this settings manually

https://user-images.githubusercontent.com/68948244/124410667-85c71780-dd7d-11eb-98d1-700ab618d79c.mp4

I tested it on an 11 device, and it seems that Android 11 also cannot grant that permission.

In fact, it can request for the permission programmatically, and it only requires Android 6 and above.

This is documented in Android's official tutorial.