IvanVolosyuk / diskusage

Automatically exported from code.google.com/p/diskusage
GNU General Public License v2.0
334 stars 59 forks source link

Adapt to API 30 #75

Closed WhiredPlanck closed 2 years ago

WhiredPlanck commented 2 years ago

Overview

As many features and changes come up with new Android SDK version (latest is 32), our 19-target-SDK-version app seems to be a little out-of-date. This PR is to adapt it to Android SDK API level 30 (corresponds to Android 11).

Main Changes

Test Result

LGTM on my Android 10 phone and pad.

Screenshot

Screenshot_20220411_225511_com google android diskusage Screenshot_20220411_230852_com google android diskusage Screenshot_20220411_230846_com google android diskusage
IvanVolosyuk commented 2 years ago

Wow, that's a lot of changes. I will have a look. How's the compatibility with older API versions?

On Tue, 12 Apr 2022, 01:21 WhiredPlanck, @.***> wrote:

Overview

As many features and changes come up with new Android SDK version (latest is 32), our 19-target-SDK-version app seems to be a little out-of-date. This PR is to adapt it to Android SDK API level 30 (corresponds to Android 11). Main Changes

  • Adapt to Scoped Storage feature.
  • Use NDK to build C module with Gradle
    • Thus, the C module executable named libscan.so can be ran from app's native library directory directory, no need to chmod any more.

Other small changes

  • Introduction of Kotlin library, which enables developers to use Kotlin in the future.
  • Build ProtoBuf with Gradle to manage version and generation easier.
  • Replace some deprecated API usage, like non-recommended AsyncTask.
  • Polish code style (not very useful :P).
  • Regroup code files / polish tree structure.
  • Update Chinese translations.
  • Add About dialog.
  • Use device default theme style to make look more modern.
  • ...

Test Result

LGTM on my Android 10 phone and pad. Screenshot

[image: Screenshot_20220411_225511_com google android diskusage] https://user-images.githubusercontent.com/47623588/162768009-23542349-ea57-4860-8278-6ecac22727c5.jpg

[image: Screenshot_20220411_230852_com google android diskusage] https://user-images.githubusercontent.com/47623588/162771788-f2645f2d-29c6-4d9b-97a1-7b50a6e41d08.jpg

[image: Screenshot_20220411_230846_com google android diskusage] https://user-images.githubusercontent.com/47623588/162772055-b44fba71-b37a-4c0b-aeb2-48df291e2ca6.jpg

You can view, comment on, or merge this pull request online at:

https://github.com/IvanVolosyuk/diskusage/pull/75 Commit Summary

File Changes

(103 files https://github.com/IvanVolosyuk/diskusage/pull/75/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/IvanVolosyuk/diskusage/pull/75, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXQ6HI4NALJHYLNDERZN7DVEQ7O5ANCNFSM5TDRWY6A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

WhiredPlanck commented 2 years ago

Wow, that's a lot of changes. I will have a look. How's the compatibility with older API versions?

So sad that my old phone isn't working and I didn't test with old API versions yet. :rofl: But I will manage to do tests soon.

WhiredPlanck commented 2 years ago

I've updated min SDK versiont to 21. This make new version app can be less concerned about the limitations of low API level.

And I've used the emulator to test, LGTM on API 21 (Android 5) and 28 (Android 9).

IvanVolosyuk commented 2 years ago

I merged this PR as it is much better than having non compiling broken source code. I see a few breakages comparing to the version on play store for me (android 12, Pixel 4 XL):

WhiredPlanck commented 2 years ago

I merged this PR as it is much better than having non compiling broken source code. I see a few breakages comparing to the version on play store for me (android 12, Pixel 4 XL):

* The app is crashing at the start as Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION) is not available. I defaulted to Android.M variant to get some permissions.

* Viewing files is not working. It seems the intent created is correct, but somehow viewer is not found. Not sure what google broke here this time.

* Only a few apps are displayed, the rest throwing exceptions and as a results all corresponding space is attributed to system data.

As far as I know, Android 12 has some breaking changes in some way which is a little difficult to figure out. On Android 10 and below,Android/data in Internal Storage is still accessible like other scopes, so this part will be duplicate with the Apps part in the view. And viewing files has been broken already before I work on this PR. I don't want to make this PR too complex so I doesn't fix them. (Actually I also have no idea to workaround them 🤣 )

IvanVolosyuk commented 2 years ago

As I said, this entire effort became a compatibility nightmare. Android doesn't seem to provide a stable API for apps like this and it is just frustrating to make anything work especially if you don't have access to a pool of test devices.

On Fri, Apr 15, 2022 at 6:44 PM WhiredPlanck @.***> wrote:

I merged this PR as it is much better than having non compiling broken source code. I see a few breakages comparing to the version on play store for me (android 12, Pixel 4 XL):

  • The app is crashing at the start as Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION) is not available. I defaulted to Android.M variant to get some permissions.

  • Viewing files is not working. It seems the intent created is correct, but somehow viewer is not found. Not sure what google broke here this time.

  • Only a few apps are displayed, the rest throwing exceptions and as a results all corresponding space is attributed to system data.

As far as I know, Android 12 has some breaking changes in some way which is a little difficult to figure out. On Android 10 and below,Android/data in Internal Storage is still accessible like other scopes, so this part will be duplicate with the Apps part in the view. And viewing files has been broken already before I work on this PR. I don't want to make this PR too complex so I doesn't fix them. (Actually I also have no idea to workaround them 🤣 )

— Reply to this email directly, view it on GitHub https://github.com/IvanVolosyuk/diskusage/pull/75#issuecomment-1099969998, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXQ6HKP2EXK2CPWNMCJIG3VFET6BANCNFSM5TDRWY6A . You are receiving this because you modified the open/close state.Message ID: @.***>