Adaway: Missing Storage permission for local Hosts source files

Created on 16 Jul 2020  路  10Comments  路  Source: AdAway/AdAway

Describe the bug
In v5.0.3 Storage Permission was supported:
400027400120_233783
With that, user was able to add his local hosts source file from Internal memory, e.g. /Download/mysource.txt to the Hosts sources list as file:///sdcard/Download/mysource.txt:
Screenshot_20200716_142435_org adaway

However, in v5.0.5, Storage permission is removed:
Screenshot_20200716_134108_com google android packageinstaller
and if you add your local file to the List, it fails to Apply the new configuration:
Screenshot_20200716_134300_org adaway

Expected behavior
User should be able to add his local hosts source file to the List.
Popup says that file:// URL type is supported

Device

  • AdAway version: v5.0.5
  • Xiaomi Mi 9T, Huawei Mate 9
  • Android version: 9, 10
  • Magisk Canary, VPN
bug

Most helpful comment

I started to rewrote the UI to add and edit source. No more long press action the source list. A simple click will open the UI.

It looks like this for now:

image
image

The source list will also receive an update to display label and entry size.

All 10 comments

Hi @zgfg !

I just read the XDA thread... I will need to have a deeper look about the whole storage documentation to find a way to fix it.
May be it's time to improve the UI to select host file and create a dedicated folder for the app on external storage.
I will try to avoid to ask for the whole storage read permission if I can.

Thanks for the issue anyway! 馃槈

Hi @zgfg !

I just read the XDA thread... I will need to have a deeper look about the whole storage documentation to find a way to fix it.
May be it's time to improve the UI to select host file and create a dedicated folder for the app on external storage.
I will try to avoid to ask for the whole storage read permission if I can.

Thanks for the issue anyway!

You can check how DNS66 does - it takes Storage permission but uses contemt:// type.

Then user can navigate with file explorer to the file.
But in XDA I have commented an issue with that approach:
I have stock Files and MiXPlorer.
DNS66 gives me an option to select file explorer, if I take MiXPlorer, DNS66 would not be able to open its URL (URL is different than if I navigate to the sane file with stock Files and it seems that DNS66 uses stock Files as a content provider)

Hum.. Will try an implementation based on SAF as it's the recommended way to do it.

_Note for myself:_ Here is how to persist the permission. Need to find when call it (I guess in the onActivityResult).

I started to rewrote the UI to add and edit source. No more long press action the source list. A simple click will open the UI.

It looks like this for now:

image
image

The source list will also receive an update to display label and entry size.

Nice, thanks, pls post also screenstot for File when ready

Nothing fancy here:

image

Typing the "File" button or the content URL open the document picker to select a custom host file from any Document provider (maybe it could work with GDrive 馃槒 )

Please test how the content provider works if you have more than one File manager (e.g., stock Files and MiXYPlorer)

Then try to navigate to the file by one or another File manager and check if upon reboot, AdAway still correctly reads the local hosts file

Don't worry @zgfg You can test it as soon as it gets ready 馃槈
I setup automatic builds on github commit so you can grab an apk and test it when you want.

(sadly not right now as I'm waiting for the weekly GitHub update to get the latest Android build tool version to fix the build...)

A WIP screenshot of the new source screen

image

Sources now have a title (easier to understand who's who) and URL is display on two lines to read them easily.
I am not really satisfied with the whole result but it's a WIP after all...

EDIT: I now display the number of hosts the sources have.

The features is now complete and merge to master branch.
It will be shipped in the next beta.

And good news, it also works fine with other content providers like Google drive. So you can store, backup and share some hosts file in gdrive and use them in AdAway 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kabo picture kabo  路  3Comments

thany picture thany  路  12Comments

ipdev99 picture ipdev99  路  3Comments

xxlsm picture xxlsm  路  12Comments

pvlb picture pvlb  路  6Comments