diskusage icon indicating copy to clipboard operation
diskusage copied to clipboard

Android 10 compatibility

Open KopfKrieg opened this issue 4 years ago • 13 comments

On an Android 10 device a warning message appears. It's rough translation reads as follows:

This app was developed for an older Android version and may not work properly. Check if updates are available or contact the developer.

Seems like an update is necessary in the future, not sure why though.

I'm running DiskUsage v3.8.0 from F-Droid.

Here's a picture (text is German):

Screenshot_20200604-193644_DiskUsage

KopfKrieg avatar Jun 16 '20 16:06 KopfKrieg

Hi, I also use the 3.8.0 version from F-Droid on Samsung Galaxy 10, it still works perfectly despite the warning.

I don't know, with all the modifications coming with Android 11, if it will continue, but it's the best program like this - I didn't find any other application in Google Play which is better, and still updated. And Disk Usage is opensource !

Would be ready to pay to get an update, as I have absolutely no knowing to code.

Valeryan24 avatar Jul 13 '20 13:07 Valeryan24

I guess, the major problem with Android 10 (and 11) is "scoped storage".

I can image, that DiskUsage will need some extra permissions on Android 11.

ChristianTacke avatar Nov 14 '20 21:11 ChristianTacke

I guess, the major problem with Android 10 (and 11) is "scoped storage".

I can image, that DiskUsage will need some extra permissions on Android 11.

Android 10 and above versions don't allow app run program from app private directories like/data/user/0/<package_name> or /data/data/<package_name> any more, which is DiskUsage's method to run a C program to scan the device storage.

A workaround for this is generating or linking native libraries appropriately (.so files). Because libraries on Android can get executable naturally. For this, we can run native program from native library directories directly.

In addition, I'd like to ask @IvanVolosyuk is the scan.c there still the source code of scan or scan5 in assets? If so, we may be able to workaround this in a more professional way.

WhiredPlanck avatar Apr 03 '22 13:04 WhiredPlanck

Yes scan.c is the source for both binaries which were compiled with different NDK versions in the past. At some point the old version of the 'scan' stopped working on newer devices, so I compiled it with newer NDK, but kept the original binary for older android API versions to avoid breaking them. Thus I have two of them. I don't actively program for android and don't have a large set of testing devices, thus developing any further version of this app became a compatibility nightmare.

On Sun, Apr 3, 2022 at 11:16 PM WhiredPlanck @.***> wrote:

I guess, the major problem with Android 10 (and 11) is "scoped storage".

I can image, that DiskUsage will need some extra permissions on Android 11.

Android 10 and above versions don't allow app run program from app private directories like/data/user/0/<package_name> or /data/data/<package_name> any more, which is DiskUsage's method to run a C program to scan the device storage.

A workaround for this is generating or linking native libraries https://developer.android.google.cn/studio/projects/gradle-external-native-builds#jniLibs appropriately (.so files). Because libraries on Android can get executable naturally. For this, we can run native program from native library directories directly.

In addition, I'd like to ask @IvanVolosyuk https://github.com/IvanVolosyuk is the scan.c https://github.com/IvanVolosyuk/diskusage/blob/master/jni/scan.c there still the source code of scan or scan5 in assets https://github.com/IvanVolosyuk/diskusage/tree/master/app/src/main/assets? If so, we may be able to workaround this in a more professional way.

— Reply to this email directly, view it on GitHub https://github.com/IvanVolosyuk/diskusage/issues/65#issuecomment-1086866807, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXQ6HPGC66VFMEI4VMWPMTVDGKY7ANCNFSM4N7Y6IFQ . You are receiving this because you were mentioned.Message ID: @.***>

IvanVolosyuk avatar Apr 03 '22 13:04 IvanVolosyuk

I don't actively program for android and don't have a large set of testing devices, thus developing any further version of this app became a compatibility nightmare.

I see. I'd like to give it a try to workaround this. :smile:

WhiredPlanck avatar Apr 03 '22 14:04 WhiredPlanck

@IvanVolosyuk I notice that this project uses Protobuf, and I'd like to know how did you build / generate Java nano code ......?

WhiredPlanck avatar Apr 05 '22 18:04 WhiredPlanck

I honestly don't remember. The code is there just to collect the dump of filesystem structure and errors for collecting debugging information from users who asked to fix the issue on their devices and I had no clue what was happening there. You can just delete https://github.com/IvanVolosyuk/diskusage/tree/master/app/src/main/java/com/google/android/diskusage/proto and https://github.com/IvanVolosyuk/diskusage/tree/master/app/src/main/java/com/google/protobuf/nano and app should compile fine. This is what I was doing for release version on the play store.

IvanVolosyuk avatar Apr 06 '22 02:04 IvanVolosyuk

I honestly don't remember. The code is there just to collect the dump of filesystem structure and errors for collecting debugging information from users who asked to fix the issue on their devices and I had no clue what was happening there. You can just delete https://github.com/IvanVolosyuk/diskusage/tree/master/app/src/main/java/com/google/android/diskusage/proto and https://github.com/IvanVolosyuk/diskusage/tree/master/app/src/main/java/com/google/protobuf/nano and app should compile fine. This is what I was doing for release version on the play store.

Ah, I have deleted them in my PR (#75) and introduced protobuf-javelitedependency in build.gradle to improve management... I can remove dependency if you think it's necessary.

WhiredPlanck avatar Apr 11 '22 15:04 WhiredPlanck

I have android 12 and originally compiled app actually works for me, but with the fix I have several problems, like: crash at startup, no ability to view files and a lot of applications are missing and shown as system data. It feels like I'm kinda stuck with compatibility mode to make the app work after various lock downs, so no updates is possible anymore on play store I guess.

IvanVolosyuk avatar Apr 15 '22 05:04 IvanVolosyuk

I think it is fine to get rid of all this additional indirection and debug dump creation. It adds too much complexity and I have no idea if it still works.

The idea of this was to be able to replay all the filesystem calls from a device I have no access to. User creates the dump where all the low level API calls are stored to the dump in addition to normal flow. Next, the user sends me this dump. I can run the app and instead of doing low level API calls to my own device, the app replays them from the dump. Thus I could see what was going wrong on someone else's device.

On Tue, Apr 12, 2022 at 1:31 AM WhiredPlanck @.***> wrote:

I honestly don't remember. The code is there just to collect the dump of filesystem structure and errors for collecting debugging information from users who asked to fix the issue on their devices and I had no clue what was happening there. You can just delete https://github.com/IvanVolosyuk/diskusage/tree/master/app/src/main/java/com/google/android/diskusage/proto and https://github.com/IvanVolosyuk/diskusage/tree/master/app/src/main/java/com/google/protobuf/nano and app should compile fine. This is what I was doing for release version on the play store.

Ah, I have deleted them in my PR (#75 https://github.com/IvanVolosyuk/diskusage/pull/75) and introduced protobuf-javelitedependency in build.gradle to improve management... I can remove dependency if you think it's necessary.

— Reply to this email directly, view it on GitHub https://github.com/IvanVolosyuk/diskusage/issues/65#issuecomment-1095202334, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXQ6HMVCBWM7FSP7V6DQVTVERAWTANCNFSM4N7Y6IFQ . You are receiving this because you were mentioned.Message ID: @.***>

IvanVolosyuk avatar Apr 15 '22 15:04 IvanVolosyuk

I think it is fine to get rid of all this additional indirection and debug dump creation. It adds too much complexity and I have no idea if it still works.

OK, if you think it's OK to drop the protobuf, I'll try to do it.

WhiredPlanck avatar May 01 '22 13:05 WhiredPlanck

You can just delete it and all the package depending on it. It is used via dynamic loading and if it doesn't exist nothing should break.

On Sun, May 1, 2022 at 11:58 PM WhiredPlanck @.***> wrote:

I think it is fine to get rid of all this additional indirection and debug dump creation. It adds too much complexity and I have no idea if it still works.

OK, if you think it's OK to drop the protobuf, I'll try to do it.

— Reply to this email directly, view it on GitHub https://github.com/IvanVolosyuk/diskusage/issues/65#issuecomment-1114245038, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXQ6HILFK36FU37ELIC6QTVH2EY3ANCNFSM4N7Y6IFQ . You are receiving this because you were mentioned.Message ID: @.***>

IvanVolosyuk avatar May 02 '22 01:05 IvanVolosyuk

You can just delete it and all the package depending on it. It is used via dynamic loading and if it doesn't exist nothing should break.

I've deleted them on my local branch. And other refactors and optimization is coming up. :smiling_face_with_three_hearts:

WhiredPlanck avatar May 02 '22 02:05 WhiredPlanck