Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Bug report
description: Something does not work as expected
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thanks for the report. Please check first whether the issue already exists.
- type: input
id: version
attributes:
label: DiskUsage version
description: Shown in the About dialog (`⋮ → About`) or in the release file name.
placeholder: "5.0.0"
validations:
required: true
- type: input
id: android
attributes:
label: Android version
description: Android version and, if relevant, the ROM (One UI, LineageOS, …).
placeholder: "Android 16 (API 36), LineageOS 23"
validations:
required: true
- type: input
id: device
attributes:
label: Device
placeholder: "Pixel 8"
validations:
required: true
- type: dropdown
id: permissions
attributes:
label: Which permissions are granted?
multiple: true
options:
- All files access
- Usage access
- Root
- None
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: |
1. Open DiskUsage
2. Select "Storage card"
3. ...
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behaviour
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual behaviour
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: |
`adb logcat -d | grep -i diskusage` (or a crash report) helps a lot.
render: shell
- type: textarea
id: additional
attributes:
label: Additional context
description: Screenshots, whether the storage is a removable SD card or USB drive, …
35 changes: 0 additions & 35 deletions .github/workflows/build-apk.yml

This file was deleted.

93 changes: 93 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
JAVA_VERSION: '17'
GRADLE_OPTS: >-
-Dorg.gradle.jvmargs=-Xmx4g
-Dorg.gradle.daemon=false
-Dkotlin.incremental=false

jobs:
build:
name: Build, test and lint
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Set up JDK
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
with:
cache-read-only: ${{ github.event_name == 'pull_request' }}

- name: Install Android SDK components
uses: android-actions/setup-android@v4
with:
packages: >-
platforms;android-37.0
build-tools;36.0.0
ndk;28.2.13676358

- name: Unit tests
run: ./gradlew testDebugUnitTest --stacktrace

- name: Assemble debug APK
run: ./gradlew assembleDebug --stacktrace

- name: Lint
run: ./gradlew lintDebug --stacktrace

- name: Upload debug APK
uses: actions/upload-artifact@v7
with:
name: diskusage-debug-${{ github.sha }}
path: app/build/outputs/apk/debug/*.apk
retention-days: 14
if-no-files-found: error

- name: Upload reports
if: always()
uses: actions/upload-artifact@v7
with:
name: reports-${{ github.sha }}
path: |
app/build/reports/tests/**
app/build/reports/lint-results-*.html
retention-days: 14
if-no-files-found: ignore

- name: Verify 16 KB page size support of native libraries
run: |
set -euo pipefail
apk=$(ls app/build/outputs/apk/debug/*.apk | head -n1)
mkdir -p /tmp/apk-libs
unzip -q -o "$apk" 'lib/*' -d /tmp/apk-libs
readelf="$ANDROID_HOME/ndk/28.2.13676358/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf"
for so in /tmp/apk-libs/lib/arm64-v8a/*.so /tmp/apk-libs/lib/x86_64/*.so; do
[ -e "$so" ] || continue
align=$("$readelf" -l "$so" | awk '/LOAD/ {print $NF}' | sort -u | tr '\n' ' ')
echo "$(basename "$so"): $align"
case "$align" in
*0x4000*) ;;
*) echo "::error::$so is not 16 KB aligned"; exit 1 ;;
esac
done
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
/local.properties
/DiskUsage.iml
/app/app.iml
/keystore.properties
*.jks
*.keystore
/dist
92 changes: 92 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Changelog

All notable changes to this project are documented here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versions follow
[Semantic Versioning](https://semver.org/).

## [Unreleased]

## [5.0.1] - 2026-11-18

### Fixed

* **"Show" on a folder** now offers the system Files app instead of a random
selection of apps. The external storage document URI is used (Android has no
standard "open this folder" intent) and the read-grant flag is no longer added
for URIs the app does not own — that flag made the system throw a
`SecurityException`, which silently fell through to a useless chooser.
Folders that cannot be opened now offer to copy the path.
* **Crash when app data was just cleared** (`NullPointerException` in the app
list): `getExternalCacheDir()`/`getExternalFilesDir()` can return `null`
(MIUI/HyperOS, full storage), which aborted the whole application list.
* **Scan progress stuck at 0 %**: the native tree walker buffered the entire
result before handing it over. It now streams records while walking, so the
progress bar and the current path update live and memory stays flat.
* **Usage access shown as denied although the toggle was enabled**: several
ROMs keep the app-op at "default" after the user grants it. The state is now
verified against `UsageStatsManager` and no longer blocks startup; it is
shown in *menu → Permissions* together with "All files access".
* **"Internal storage" was labelled "SD card"** in German (and "Storage card" in
English) although it is the primary volume.
* Progress dialog layout: the percentage was printed on top of the path.
* **Back button left the user in a loop**: with predictive back (Android 13+)
`KEYCODE_BACK` no longer reached the graph view, so the activity fell back to
a plain `finish()` and surfaced the volume chooser again — hardware back and
the navigation bar behaved differently. Back is now handled through
`OnBackPressedDispatcher`: on a single-volume device it leaves the app (task
retained, `alwaysRetainTaskState`), on multi-volume devices it returns to the
chooser. Cancelling the scan or the permission dialog now also leaves the app
instead of reopening the chooser.

## [5.0.0] - 2026-11-18

Complete modernization of the Android build and the app itself.

### Changed

* Build toolchain: AGP 9.5.1, Gradle 9.9.1, built-in Kotlin, JDK 17, version
catalog, R8 with resource shrinking, configuration cache.
* `compileSdk`/`targetSdk` 37 (Android 17), `minSdk` 24 (Android 7.0).
* NDK r28c, native scanner rebuilt for all four ABIs with 16 KB page-size
alignment.
* UI migrated to AppCompat activities with real toolbars, DayNight theme and
edge-to-edge insets (required from Android 15/16 on).
* Volume discovery uses `StorageManager.getStorageVolumes()`; SD cards and USB
drives are listed with their user-visible description.
* App storage list is built from the package manager instead of
`UsageStatsManager`; cache sizes are reported again.
* Delete confirmation lists content on a worker thread instead of the UI thread.
* `PermissionRequestActivity` re-checks permissions in `onResume` and only
requests what the running Android version needs.
* Timestamps and version information come from `version.properties`.

### Added

* Automatic GitHub releases (tag + APK + SHA256) and a daily nightly prerelease.
* CI with unit tests, lint, debug APK artifact and a 16 KB page-size check.
* F-Droid metadata (`fastlane/`), icon, feature graphic, screenshots and
changelogs in English and German; submission guide in `docs/fdroid`.
* Adaptive, round and monochrome (themed) launcher icons, TV banner and leanback
launcher entry, per-app language configuration.
* Used/free space is shown with the occupied percentage.
* Double tap opens files and folders.
* Unit tests for volume path handling.

### Fixed

* The native scanner never worked on modern Android: the shared library was
executed as a child process (segfault), the protocol had a stale leading NUL
byte and the build was missing the JNI entry point. It now runs in-process via
JNI, so scanning is fast again; failures still fall back to the Java scanner
(`Error: no more data`, `Cannot run program …libscan.so`).
* "No viewer found" and wrong MIME types when opening files; content URIs now
carry explicit read grants.
* Scan worker could leave the progress dialog on screen forever.
* Missing internal storage / SD card / USB volumes in the chooser.
* Apps without recent usage statistics disappeared from the app list.
* NPE when the option menu updated without a selection.
* Automatic selection when only one volume is available.

[Unreleased]: https://github.com/bartman081523/diskusage/compare/v5.0.1...HEAD
[5.0.1]: https://github.com/bartman081523/diskusage/releases/tag/v5.0.1
[5.0.0]: https://github.com/bartman081523/diskusage/releases/tag/v5.0.0
68 changes: 68 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Contributing

Thanks for helping with DiskUsage.

## Before you start

* The app targets Android 17 (API 37) and supports Android 7.0 (API 24) and
newer.
* Please keep changes focused. A bug fix should not contain unrelated
refactoring.
* Java and Kotlin are both used. New UI/data code should be Kotlin; the scanner
and renderer cores stay Java (they are performance critical and use a lot of
bit twiddling).

## Build

```bash
export JAVA_HOME=/path/to/jdk-17
export ANDROID_HOME=$HOME/Android/Sdk
./gradlew assembleDebug testDebugUnitTest lintDebug
```

Required SDK components:

* `platforms;android-37.0`
* `build-tools;36.0.0`
* `ndk;28.2.13676358`

## Pull requests

1. Fork the repository and create a topic branch.
2. Make sure `./gradlew testDebugUnitTest lintDebug assembleDebug` passes.
3. Update `CHANGELOG.md` under `## [Unreleased]` for user-visible changes.
4. Describe *what* changes and *why*; mention related issue numbers.
5. Do not add gradle wrappers, binaries or generated files.

## Translations

Translations live in `app/src/main/res/values-<locale>/strings.xml`. Adding a
locale additionally requires:

* an entry in `app/src/main/res/xml/locales_config.xml`,
* a `fastlane/metadata/android/<locale>/` folder (title, descriptions,
changelog) if store metadata should be translated.

## Commit messages

Conventional Commits are appreciated as they feed the release notes:

```
fix: detect USB volumes on Android 14
feat: show the occupied percentage
docs: explain the F-Droid submission
```

## Reporting bugs

Use the GitHub issue template. A useful report contains:

* Android version and device/ROM,
* whether "All files access" and "Usage access" are granted,
* steps to reproduce, expected and actual behaviour,
* a logcat excerpt (`adb logcat | grep -i diskusage`) for crashes.

## License

By contributing you agree that your changes are licensed under the GNU General
Public License version 2 or later, like the rest of the project.
Loading