From c2b8ed642e583bf25aa64f87ce73ac4f09f37047 Mon Sep 17 00:00:00 2001 From: Waozi Date: Tue, 6 Oct 2026 12:01:56 -0300 Subject: [PATCH] Release 2.0.12 with Android graphics recovery and regression checks --- CHANGELOG.md | 5 + Makefile | 19 +++ droid/app/build.gradle | 4 +- .../metadata/android/en-US/changelogs/136.txt | 4 + packaging/click/control | 2 +- packaging/click/inbe.metainfo.xml | 2 +- packaging/click/manifest.json | 2 +- packaging/firefox-addons/manifest.json | 2 +- packaging/linux/appimage/inbe.appdata.xml | 2 +- packaging/snap/snap/gui/inbe.metainfo.xml | 2 +- packaging/snap/snap/snapcraft.yaml | 2 +- src/app/app_frame_transition.zi | 15 ++ src/app/application.zi | 10 +- src/core/version.h | 4 +- src/core/version.zi | 4 +- tests/android_graphics_recovery_device.py | 151 ++++++++++++++++++ tests/graphics_transition_behavior.zi | 50 ++++++ tests/graphics_transition_test.sh | 28 ++++ windows/inbe.rc | 8 +- ziran.lock | 18 +-- 20 files changed, 302 insertions(+), 32 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/136.txt create mode 100644 tests/android_graphics_recovery_device.py create mode 100644 tests/graphics_transition_behavior.zi create mode 100644 tests/graphics_transition_test.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d30858da..8d803ed26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # Changelog +## [2.0.12] - 2026-10-06 +### Fixed +- Restore banners and navigation icons when returning to the Android app or changing orientation. +- Keep images from disappearing or showing font characters after graphics resources are recreated. + ## [2.0.11] - 2026-10-04 ### Changed - Lists, Habits, and Practice now load as separate modules inside Inner Breeze, with shared navigation, settings, and saved data. diff --git a/Makefile b/Makefile index bf36b99ec..eb6e6dcdb 100644 --- a/Makefile +++ b/Makefile @@ -1670,6 +1670,25 @@ android-lifecycle-zi-test: $(ZI2C_BIN) test: android-lifecycle-zi-test +.PHONY: raylib-graphics-test android-graphics-device-test +raylib-graphics-test: $(ZI2C_BIN) + @env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \ + ZIRAN_ROOT="$(ZIRAN_DIR)" ZIRAN_BIN="$(ZIRAN_BUILD_DIR)/bin/ziran" \ + sh "$(KRYON_DIR)/tests/ziran_raylib_graphics_test.sh" + +test: raylib-graphics-test + +.PHONY: graphics-transition-test +graphics-transition-test: $(ZI2C_BIN) + @sh tests/graphics_transition_test.sh $(ZIRAN_BUILD_DIR)/bin + +test: graphics-transition-test + +# Explicit device check; never part of the CI or ordinary test target. +# Inbe's Device settings must allow System orientation for real rotation. +android-graphics-device-test: + @python3 tests/android_graphics_recovery_device.py $(ANDROID_GRAPHICS_ARGS) + .PHONY: language-selection-zi-test language-selection-zi-test: $(ZI2C_BIN) @env -u DISPLAY -u WAYLAND_DISPLAY \ diff --git a/droid/app/build.gradle b/droid/app/build.gradle index e88a3f510..f3414d57f 100644 --- a/droid/app/build.gradle +++ b/droid/app/build.gradle @@ -53,8 +53,8 @@ android { applicationId "xyz.waozi.inbe" minSdk 21 targetSdk 36 - versionCode 135 - versionName "2.0.11" + versionCode 136 + versionName "2.0.12" manifestPlaceholders = [ inbeAppLabel: "Inner Breeze", inbeUsesCleartextTraffic: "false" diff --git a/fastlane/metadata/android/en-US/changelogs/136.txt b/fastlane/metadata/android/en-US/changelogs/136.txt new file mode 100644 index 000000000..b18582fc4 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/136.txt @@ -0,0 +1,4 @@ +Fixed +--- +- Restore banners and navigation icons when returning to the Android app or changing orientation. +- Keep images from disappearing or showing font characters after graphics resources are recreated. diff --git a/packaging/click/control b/packaging/click/control index 209d0cdad..23324c8b8 100644 --- a/packaging/click/control +++ b/packaging/click/control @@ -1,5 +1,5 @@ Package: inbe.waozi -Version: 2.0.11 +Version: 2.0.12 Architecture: arm64 Maintainer: Waozi Click-Version: 0.4 diff --git a/packaging/click/inbe.metainfo.xml b/packaging/click/inbe.metainfo.xml index 8b5bf1f3a..8bac23a22 100644 --- a/packaging/click/inbe.metainfo.xml +++ b/packaging/click/inbe.metainfo.xml @@ -28,7 +28,7 @@ inbe - + diff --git a/packaging/click/manifest.json b/packaging/click/manifest.json index 44e8a8cc2..49c2e2687 100644 --- a/packaging/click/manifest.json +++ b/packaging/click/manifest.json @@ -1,7 +1,7 @@ { "name": "inbe", "title": "Inner Breeze", - "version": "2.0.11", + "version": "2.0.12", "architecture": "arm64", "framework": "ubuntu-sdk-20.04", "description": "Syncable breathing, meditation, and habit practice app.", diff --git a/packaging/firefox-addons/manifest.json b/packaging/firefox-addons/manifest.json index abe5968ba..fd0ae8a40 100644 --- a/packaging/firefox-addons/manifest.json +++ b/packaging/firefox-addons/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "Inner Breeze", "short_name": "Inbe", - "version": "2.0.11", + "version": "2.0.12", "description": "Breathing, meditation, habit tracking, and encrypted sync.", "permissions": [ "contextMenus" diff --git a/packaging/linux/appimage/inbe.appdata.xml b/packaging/linux/appimage/inbe.appdata.xml index 64039fe24..062151787 100644 --- a/packaging/linux/appimage/inbe.appdata.xml +++ b/packaging/linux/appimage/inbe.appdata.xml @@ -22,7 +22,7 @@ inbe - + diff --git a/packaging/snap/snap/gui/inbe.metainfo.xml b/packaging/snap/snap/gui/inbe.metainfo.xml index 658cbb4af..695a444af 100644 --- a/packaging/snap/snap/gui/inbe.metainfo.xml +++ b/packaging/snap/snap/gui/inbe.metainfo.xml @@ -22,7 +22,7 @@ inbe - + diff --git a/packaging/snap/snap/snapcraft.yaml b/packaging/snap/snap/snapcraft.yaml index 3b6b9f1e3..0b8100ef7 100644 --- a/packaging/snap/snap/snapcraft.yaml +++ b/packaging/snap/snap/snapcraft.yaml @@ -6,7 +6,7 @@ description: | meditation, and habit tracking with visual and audio cues, meditation timers, habit counters, session history, and optional sync. -version: '2.0.11' +version: '2.0.12' license: BSD-3-Clause base: core22 confinement: strict diff --git a/src/app/app_frame_transition.zi b/src/app/app_frame_transition.zi index ece628000..a7dd073c5 100644 --- a/src/app/app_frame_transition.zi +++ b/src/app/app_frame_transition.zi @@ -7,6 +7,21 @@ APP_ROUTE_TRANSITION_SECONDS :: 0.12; +#program_export +app_route_transition_cancel :: (app: *InnerBreeze, context_lost: bool = false) { + if app == null { return } + surface: FrameSurface + surface.texture = app.ui.route_transition_texture + if !context_lost && app.ui.route_transition_texture_owned && + FrameSurfaceValid(surface) { + FrameSurfaceRelease(surface) + } + app.ui.route_transition_texture = Texture2D.{} + app.ui.route_transition_texture_owned = false + app.ui.route_transition_active = false + app.ui.route_transition_pending = false +} + #program_export app_route_transition_request :: (app: *InnerBreeze) { if app == null { return } diff --git a/src/app/application.zi b/src/app/application.zi index 7d7ba09b5..6aecee85a 100644 --- a/src/app/application.zi +++ b/src/app/application.zi @@ -334,12 +334,10 @@ app_reload_graphics_resources :: (app: *InnerBreeze) -> bool { TraceLog(LOG_INFO, "ANDROID: Reloading graphics resources") #if #defined(ANDROID_BUILD) { ResetRaylibGraphics(context_lost) - if context_lost { - app.ui.route_transition_texture = Texture2D.{} - app.ui.route_transition_texture_owned = false - app.ui.route_transition_active = false - app.ui.route_transition_pending = false - } + // Retained frames are gone even when the context survived. A route + // fade must not keep a borrowed texture from the discarded frame. + app_route_transition_cancel(app, context_lost) + app.ui.retained_target_active = false app.ui.retained_frame_unchanged = false } if !LoadLocaleFont(app) { diff --git a/src/core/version.h b/src/core/version.h index 616527acc..ea695558e 100644 --- a/src/core/version.h +++ b/src/core/version.h @@ -3,7 +3,7 @@ #define APP_VERSION_MAJOR 2 #define APP_VERSION_MINOR 0 -#define APP_VERSION_PATCH 11 -#define APP_VERSION_STRING "2.0.11" +#define APP_VERSION_PATCH 12 +#define APP_VERSION_STRING "2.0.12" #endif diff --git a/src/core/version.zi b/src/core/version.zi index 2a799a51c..3fb96f37e 100644 --- a/src/core/version.zi +++ b/src/core/version.zi @@ -1,5 +1,5 @@ // Generated by update_version.sh from CHANGELOG.md. Do not edit by hand. VersionMajor :: 2 VersionMinor :: 0 -VersionPatch :: 11 -VersionString :: "2.0.11" +VersionPatch :: 12 +VersionString :: "2.0.12" diff --git a/tests/android_graphics_recovery_device.py b/tests/android_graphics_recovery_device.py new file mode 100644 index 000000000..9ae92fb2b --- /dev/null +++ b/tests/android_graphics_recovery_device.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python3 +"""Compare Inbe's visible graphics across lifecycle changes on the dev Moto.""" +import argparse +import io +import json +import os +from pathlib import Path +import shlex +import subprocess +import time + +from PIL import Image, ImageChops, ImageStat + +parser = argparse.ArgumentParser(description=__doc__) +parser.add_argument('--host', default='wao@thinkpad.local') +parser.add_argument('--serial', default='ZE2223BQZT') +parser.add_argument('--package', default='xyz.waozi.inbe.debug') +parser.add_argument('--cycles', type=int, default=10) +parser.add_argument('--output', type=Path, default=Path('build/android/graphics-recovery')) +args = parser.parse_args() +if args.serial != 'ZE2223BQZT': + parser.error('This test is restricted to the development Moto; never use the Pixel.') +if args.package not in ('xyz.waozi.inbe.debug', 'xyz.waozi.inbe'): + parser.error('This test may operate only on Inbe.') +if args.cycles < 1: + parser.error('--cycles must be positive') +for key in ('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY', 'DBUS_SESSION_BUS_ADDRESS'): + os.environ.pop(key, None) +args.output.mkdir(parents=True, exist_ok=True) + + +def adb(*command, binary=False): + remote = shlex.join(['adb', '-s', args.serial, *map(str, command)]) + result = subprocess.run( + ['ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=8', args.host, remote], + capture_output=True, timeout=30, check=True) + return result.stdout if binary else result.stdout.decode().strip() + + +def start(): + output = adb('shell', 'am', 'start', '-W', '-n', + args.package + '/xyz.waozi.inbe.MainActivity') + if 'Status: ok' not in output: + raise RuntimeError('Inbe did not start: ' + output) + time.sleep(3) + + +def frame(name): + focus = adb('shell', 'dumpsys', 'window', 'windows') + current = next((line for line in focus.splitlines() if 'mCurrentFocus=' in line), '') + if args.package + '/xyz.waozi.inbe.MainActivity' not in current: + raise RuntimeError('Refusing to capture a window other than Inbe: ' + current) + if adb('shell', 'pidof', args.package) != pid: + raise RuntimeError('Inbe restarted during the recovery test') + data = adb('exec-out', 'screencap', '-p', binary=True) + (args.output / (name + '.png')).write_bytes(data) + image = Image.open(io.BytesIO(data)).convert('RGB') + # Exclude changing Android status/navigation bars. The app, including its + # banners and bottom navigation icons, remains inside the comparison. + width, height = image.size + report.setdefault('frame_sizes', {})[name] = [width, height] + return image.crop((0, int(height * .05), width, int(height * .94))) + + +def compare(reference, actual, name): + if reference.size != actual.size: + raise RuntimeError(name + ': app dimensions changed unexpectedly') + difference = ImageChops.difference(reference, actual) + error = sum(ImageStat.Stat(difference).mean) / 3 + width, height = difference.size + worst_tile = 0.0 + for row in range(8): + for column in range(4): + tile = difference.crop((column * width // 4, row * height // 8, + (column + 1) * width // 4, (row + 1) * height // 8)) + worst_tile = max(worst_tile, sum(ImageStat.Stat(tile).mean) / 3) + # Allow minor antialiasing differences, but reject a missing banner, + # font atlas replacing an image, or black navigation icons. + if error > 1.5 or worst_tile > 3.0: + difference.save(args.output / (name + '-difference.png')) + raise RuntimeError(f'{name}: visible graphics changed (mean {error:.3f}, tile {worst_tile:.3f})') + results.append({'case': name, 'mean_pixel_error': error, 'worst_tile_error': worst_tile}) + print(f'{name}: PASS (mean pixel error {error:.3f})', flush=True) + + +def setting(name, value): + if value == 'null': + adb('shell', 'settings', 'delete', 'system', name) + else: + adb('shell', 'settings', 'put', 'system', name, value) + + +if adb('get-state') != 'device': + raise RuntimeError('Moto is not authorized and ready') +original_rotation = adb('shell', 'settings', 'get', 'system', 'user_rotation') +original_accelerometer = adb('shell', 'settings', 'get', 'system', 'accelerometer_rotation') +results = [] +pid = '' +report = {'serial': args.serial, 'package': args.package, 'passed': False, 'cases': results} +try: + adb('shell', 'input', 'keyevent', 'KEYCODE_WAKEUP') + adb('shell', 'wm', 'dismiss-keyguard') + setting('accelerometer_rotation', '0') + setting('user_rotation', '0') + start() + pid = adb('shell', 'pidof', args.package) + if not pid: + raise RuntimeError('Inbe is not running') + reference = frame('portrait-reference') + for cycle in range(args.cycles): + adb('shell', 'input', 'keyevent', 'KEYCODE_HOME') + time.sleep(2) + start() + name = f'resume-{cycle + 1:02}' + compare(reference, frame(name), name) + + references = {0: reference} + for cycle in range(2): + for rotation in (1, 2, 3, 0): + setting('user_rotation', str(rotation)) + time.sleep(4) + name = f'rotation-{cycle + 1}-{rotation}' + actual = frame(name) + if rotation not in references: + references[rotation] = actual + print(name + ': reference recorded', flush=True) + else: + compare(references[rotation], actual, name) + + if references[1].size == references[0].size: + raise RuntimeError('No actual landscape rotation occurred; use System orientation in Inbe.') + + for cycle in range(3): + adb('shell', 'input', 'keyevent', 'KEYCODE_SLEEP') + time.sleep(2) + adb('shell', 'input', 'keyevent', 'KEYCODE_WAKEUP') + adb('shell', 'wm', 'dismiss-keyguard') + start() + name = f'screen-wake-{cycle + 1}' + compare(reference, frame(name), name) + report['passed'] = True + report['pid'] = pid +finally: + setting('user_rotation', original_rotation) + setting('accelerometer_rotation', original_accelerometer) + if pid: + logs = adb('logcat', '-d', '--pid=' + pid, '-v', 'brief') + (args.output / 'inbe-logcat.txt').write_text(logs) + report['graphics_info_log_messages'] = logs.count('Reloading graphics resources') + report['info_logs_may_be_disabled'] = True + (args.output / 'report.json').write_text(json.dumps(report, indent=2) + '\n') diff --git a/tests/graphics_transition_behavior.zi b/tests/graphics_transition_behavior.zi new file mode 100644 index 000000000..46806ece5 --- /dev/null +++ b/tests/graphics_transition_behavior.zi @@ -0,0 +1,50 @@ +#import, file "../src/app/app_frame_transition.zi"; +#import, file "../src/app/app_types.zi"; +#import "drawing_props" + +released: s32; +wrong_texture: bool; + +#program_export +DisposeFrameTexture :: (texture: Texture2D) { + released += 1 + if texture.id != 42 { + wrong_texture = true + } +} + +Prepared :: (app: *InnerBreeze, owned: bool) { + app.ui.route_transition_texture = Texture2D.{42, 20, 20, 1, 7} + app.ui.route_transition_texture_owned = owned + app.ui.route_transition_active = true + app.ui.route_transition_pending = true +} + +Cleared :: (app: *InnerBreeze) -> bool { + return app.ui.route_transition_texture.id == 0 && + !app.ui.route_transition_texture_owned && + !app.ui.route_transition_active && !app.ui.route_transition_pending +} + +#program_export +main :: () -> s32 { + app: InnerBreeze + // The renderer owns borrowed retained frames. Never delete them twice. + Prepared(*app, false) + app_route_transition_cancel(*app) + if released != 0 || !Cleared(*app) { return 1 } + + // An independently captured frame is released while its context is valid. + Prepared(*app, true) + app_route_transition_cancel(*app) + if released != 1 || wrong_texture || !Cleared(*app) { return 2 } + + // Old context names may now identify unrelated textures. Discard only. + Prepared(*app, true) + app_route_transition_cancel(*app, true) + if released != 1 || !Cleared(*app) { return 3 } + app_route_transition_cancel(*app) + app_route_transition_cancel(null) + if released != 1 { return 4 } + return 0 +} diff --git a/tests/graphics_transition_test.sh b/tests/graphics_transition_test.sh new file mode 100644 index 000000000..8bfa63193 --- /dev/null +++ b/tests/graphics_transition_test.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -eu +root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +bin=${1:-"$root/build/ziran-toolchain/bin"} +work=$(mktemp -d "$root/build/graphics-transition.XXXXXX") +trap 'rm -rf "$work"' EXIT HUP INT TERM +unset DISPLAY WAYLAND_DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS +for target in c cpp; do + "$bin/ziran" build --target="$target" --root "$root" \ + --module-path "$root/build/packages/kryon/src/ui" \ + --module-path "$root/build/packages/ziran/std" \ + -o "$work/$target" "$root/tests/graphics_transition_behavior.zi" + if test "$target" = c; then + compiler=${CC:-cc} + standard=c11 + extension=c + else + compiler=${CXX:-c++} + standard=c++17 + extension=cpp + fi + find "$work/$target" -name "*.$extension" -print > "$work/$target-files" + "$compiler" -std="$standard" -O2 -ffunction-sections -fdata-sections \ + -Wl,--gc-sections -I"$work/$target" @"$work/$target-files" \ + -lm -o "$work/$target-test" + "$work/$target-test" +done +echo 'Graphics recovery cancels borrowed, owned and lost-context route frames in C/C++' diff --git a/windows/inbe.rc b/windows/inbe.rc index 22a4424be..e31fa2b7a 100644 --- a/windows/inbe.rc +++ b/windows/inbe.rc @@ -6,8 +6,8 @@ IDI_APP_ICON ICON "inbe.ico" IDI_NOTIFICATION_ICON ICON "inbe.ico" VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,11,0 - PRODUCTVERSION 2,0,11,0 + FILEVERSION 2,0,12,0 + PRODUCTVERSION 2,0,12,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,11 +24,11 @@ BEGIN BEGIN VALUE "CompanyName", "waozi" VALUE "FileDescription", "Inner Breeze" - VALUE "FileVersion", "2.0.11" + VALUE "FileVersion", "2.0.12" VALUE "InternalName", "inbe" VALUE "OriginalFilename", "inbe-windows-x86_64.exe" VALUE "ProductName", "Inner Breeze" - VALUE "ProductVersion", "2.0.11" + VALUE "ProductVersion", "2.0.12" END END BLOCK "VarFileInfo" diff --git a/ziran.lock b/ziran.lock index 7715681d1..d9cbfd3a8 100644 --- a/ziran.lock +++ b/ziran.lock @@ -9,6 +9,14 @@ "ref": "master", "url": "https://github.com/kryonlabs/kryon.git" }, + { + "commit": "86d71f8e4b07c23cbc9024e39854fa33e3239b81", + "dependencies": {"oqs": "p55635fc8976895a9"}, + "id": "p04b37d424f9e9eb8", + "name": "DaochiClient", + "ref": "master", + "url": "https://github.com/ziranlang/daochi-client.git" + }, { "commit": "b31299434c785d0f2bd82f36b5bfd2fd36ba1216", "dependencies": {}, @@ -79,14 +87,6 @@ "source": true, "url": "https://github.com/LoupVaillant/Monocypher.git" }, - { - "commit": "753211d4d6706ef8c38a8de1dfcb20e7d8c401ae", - "dependencies": {"oqs": "p55635fc8976895a9"}, - "id": "pd84d39ba79dc890c", - "name": "DaochiClient", - "ref": "master", - "url": "https://github.com/ziranlang/daochi-client.git" - }, { "commit": "e1f07e615e9255a513dbb6d66e5e6e9d335ef690", "dependencies": {"kryon": "p0005addd0de6e17d"}, @@ -97,7 +97,7 @@ } ], "root": { - "dependencies": {"curl": "pc4b263336680098b", "daochi_client": "pd84d39ba79dc890c", "game2d": "p7b9204ab0ad2089f", "kryon": "p0005addd0de6e17d", "kss": "pfdf70946e0505dfe", "liboqs": "pb34994bf01670ac3", "monocypher": "pccdfe79ccaafde45", "oqs": "p55635fc8976895a9", "rini": "p09fa77e94b0dfc6c", "sqlite": "p151b83a361c86f2d"}, + "dependencies": {"curl": "pc4b263336680098b", "daochi_client": "p04b37d424f9e9eb8", "game2d": "p7b9204ab0ad2089f", "kryon": "p0005addd0de6e17d", "kss": "pfdf70946e0505dfe", "liboqs": "pb34994bf01670ac3", "monocypher": "pccdfe79ccaafde45", "oqs": "p55635fc8976895a9", "rini": "p09fa77e94b0dfc6c", "sqlite": "p151b83a361c86f2d"}, "name": "Inbe" }, "toolchain": {